diff --git a/CHANGES b/CHANGES index e88d2a1c..f12b32de 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +v0.7.6 + - Corrected faulty version numbers in v0.7.5 + - Improved logging of database errors + - Sanitized default configuration + v0.7.5 - Change build script to autotools - Updated PostgreSQL data provider to v3.1.9 @@ -41,4 +46,4 @@ v0.7.0 - Updated jQuery to v2.2.4 -Changes prior to 0.7.0 is not recorded. +Changes prior to 0.7.0 are not recorded. diff --git a/DATABASE b/DATABASE new file mode 100644 index 00000000..ab93ec0f --- /dev/null +++ b/DATABASE @@ -0,0 +1,25 @@ +Manually setup a MySQL user on localhost +---------------------------------------- + +Log in as root: +# mysql -uroot -p + +Create database and grant privileges: +# CREATE DATABASE ntpa; +# CREATE USER 'ntpau'@'localhost' IDENTIFIED BY 'password'; +# GRANT ALL PRIVILEGES ON ntpa . * TO 'ntpau'@'localhost'; +# FLUSH PRIVILEGES; + + +Manually setup a MySQL user on a foreign host +--------------------------------------------- + +Log in as root: +# mysql -uroot -p + +Create database and grant privileges: +# CREATE DATABASE ntpa; +# CREATE USER 'ntpau'@'192.168.1.1' IDENTIFIED BY 'password'; +# GRANT ALL PRIVILEGES ON ntpa . * TO 'ntpau'@'192.168.1.1'; +# FLUSH PRIVILEGES; + diff --git a/Ntp.Analyzer.Data/Log/LogExtensions.cs b/Ntp.Analyzer.Data/Log/LogExtensions.cs index 566d51fe..f2d035b6 100644 --- a/Ntp.Analyzer.Data/Log/LogExtensions.cs +++ b/Ntp.Analyzer.Data/Log/LogExtensions.cs @@ -53,20 +53,23 @@ namespace Ntp.Analyzer.Data.Log internal static void DeleteError(this LogBase log, string table, Exception e) { - log.WriteLine($"Error while deleting from table {table}: {e.Message}", Severity.Error); + log.WriteLine($"Error while deleting from table {table}: {e.Message}", Severity.Warn); log.WriteLine(e); + Advice(log); } internal static void InsertError(this LogBase log, string table, Exception e) { - log.WriteLine($"Error while inserting into table {table}: {e.Message}", Severity.Error); + log.WriteLine($"Error while inserting into table {table}: {e.Message}", Severity.Warn); log.WriteLine(e); + Advice(log); } internal static void ReadError(this LogBase log, string table, Exception e) { - log.WriteLine($"Error while reading from table {table}: {e.Message}", Severity.Error); + log.WriteLine($"Error while reading from table {table}: {e.Message}", Severity.Warn); log.WriteLine(e); + Advice(log); } internal static void TableExists(this LogBase log, string table) @@ -78,8 +81,14 @@ namespace Ntp.Analyzer.Data.Log internal static void UpdateError(this LogBase log, string table, Exception e) { - log.WriteLine($"Error while updating table {table}: {e.Message}", Severity.Error); + log.WriteLine($"Error while updating table {table}: {e.Message}", Severity.Warn); log.WriteLine(e); + Advice(log); + } + + private static void Advice(LogBase log) + { + log.WriteLine($"Try setting 'Create Yes' in configuration.", Severity.Notice); } } } \ No newline at end of file diff --git a/Ntp.Data/Log/LogExtensions.cs b/Ntp.Data/Log/LogExtensions.cs index fcb12a1b..8a3417ad 100644 --- a/Ntp.Data/Log/LogExtensions.cs +++ b/Ntp.Data/Log/LogExtensions.cs @@ -109,6 +109,11 @@ namespace Ntp.Data.Log internal static void SchemaVersionError(this LogBase log, int database, int application) { + if (database == -1) + { + log.WriteLine("Database version is -1. Did you set 'Create Yes' in configuration ?", Severity.Notice); + } + log.WriteLine( $"Application version is {application} but database version is {database}.", Severity.Error);