mirror of
https://bitbucket.org/anguist/ntpa
synced 2025-11-21 18:51:50 +00:00
Show stack trace when encountering errors
This commit is contained in:
@ -142,7 +142,7 @@ namespace Ntp.Analyzer.Data.Import
|
||||
catch (Exception e)
|
||||
{
|
||||
log.WriteLine("Could not parse TimeServer HTML.", Severity.Error);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ namespace Ntp.Analyzer.Data.Import
|
||||
catch (Exception e)
|
||||
{
|
||||
log.WriteLine("Could not find TimeServer HTML.", Severity.Error);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -105,12 +105,12 @@ namespace Ntp.Analyzer.Data.Import
|
||||
log.WriteLine("Error while contacting support.ntp.org with ID " + orgId, Severity.Error);
|
||||
}
|
||||
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.WriteLine("Error while contacting support.ntp.org with ID " + orgId, Severity.Error);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@ -35,7 +35,7 @@ namespace Ntp.Analyzer.Data.Log
|
||||
internal static void CreateDatabaseError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine("Failed to create database.", Severity.Error);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void CreateTable(this LogBase log, string table)
|
||||
@ -48,38 +48,38 @@ namespace Ntp.Analyzer.Data.Log
|
||||
internal static void CreateTableError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine("Could not create database table.", Severity.Error);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
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(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
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(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
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(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void TableExists(this LogBase log, string table)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Table '{table}' already exist.",
|
||||
$"Skipping table '{table}'. Already exist.",
|
||||
Severity.Debug);
|
||||
}
|
||||
|
||||
internal static void UpdateError(this LogBase log, string table, Exception e)
|
||||
{
|
||||
log.WriteLine($"Error while updating table {table}: {e.Message}", Severity.Error);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -40,29 +40,23 @@ namespace Ntp.Analyzer.Process.Log
|
||||
internal static void ClusterError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine("Error during initialization of cluster node.", Severity.Error);
|
||||
log.WriteLine(e.Message, Severity.Debug);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void ClusterReady(this LogBase log, NodeConfiguration node)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Requesting to cluster {node.Address}",
|
||||
Severity.Notice);
|
||||
log.WriteLine($"Requesting to cluster {node.Address}", Severity.Notice);
|
||||
}
|
||||
|
||||
internal static void ConfigFile(this LogBase log, string file)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Using configuration {file}",
|
||||
Severity.Notice);
|
||||
log.WriteLine($"Using configuration {file}", Severity.Notice);
|
||||
}
|
||||
|
||||
internal static void DatabaseError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine("Error during initialization of database.", Severity.Error);
|
||||
log.WriteLine(e.Message, Severity.Debug);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void HostImportError(this LogBase log, Exception e)
|
||||
@ -73,51 +67,39 @@ namespace Ntp.Analyzer.Process.Log
|
||||
|
||||
internal static void HostNotFound(this LogBase log, int hostId)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Host with ID {hostId} does not exists in database.",
|
||||
Severity.Warn);
|
||||
log.WriteLine($"Host with ID {hostId} does not exists in database.", Severity.Warn);
|
||||
}
|
||||
|
||||
internal static void InitializationError(this LogBase log, Exception ex)
|
||||
internal static void InitializationError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Cannot create logs: {ex.Message}",
|
||||
Severity.Error);
|
||||
log.WriteLine($"Cannot create logs: {e.Message}", Severity.Error);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void InstanceName(this LogBase log, string name)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Instance named {name}",
|
||||
Severity.Notice);
|
||||
log.WriteLine($"Instance named {name}", Severity.Notice);
|
||||
}
|
||||
|
||||
internal static void JobInitEnd(this LogBase log)
|
||||
{
|
||||
log.WriteLine(
|
||||
"All jobs initialized.",
|
||||
Severity.Debug);
|
||||
log.WriteLine("All jobs initialized.", Severity.Debug);
|
||||
}
|
||||
|
||||
internal static void JobInitStart(this LogBase log)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Initializing jobs.",
|
||||
Severity.Info);
|
||||
log.WriteLine("Initializing jobs.", Severity.Info);
|
||||
}
|
||||
|
||||
internal static void ListenerError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine("Error during initialization of command channels.", Severity.Warn);
|
||||
log.WriteLine(e.Message, Severity.Debug);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void ListenerReady(this LogBase log, Listener listener)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Opening command channel on {listener}",
|
||||
Severity.Notice);
|
||||
log.WriteLine($"Opening command channel on {listener}", Severity.Notice);
|
||||
}
|
||||
|
||||
internal static void NewHost(this LogBase log, HostConfiguration server, IPAddress ip)
|
||||
@ -136,16 +118,12 @@ namespace Ntp.Analyzer.Process.Log
|
||||
|
||||
internal static void NoConfig(this LogBase log, string file)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Cannot find configuration file {file}",
|
||||
Severity.Error);
|
||||
log.WriteLine($"Cannot find configuration file {file}", Severity.Error);
|
||||
}
|
||||
|
||||
internal static void OpenNtpConfigError(this LogBase log)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Traffic data collection is not supported for OpenNTP.",
|
||||
Severity.Warn);
|
||||
log.WriteLine("Traffic data collection is not supported for OpenNTP.", Severity.Warn);
|
||||
}
|
||||
|
||||
internal static void PeerImportError(this LogBase log, Exception e)
|
||||
@ -163,58 +141,44 @@ namespace Ntp.Analyzer.Process.Log
|
||||
|
||||
internal static void PeerIpNotFound(this LogBase log, AssociationEntry entry)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Peer with IP {entry.Remote} does not exists in database.",
|
||||
Severity.Warn);
|
||||
log.WriteLine($"Peer with IP {entry.Remote} does not exists in database.", Severity.Warn);
|
||||
}
|
||||
|
||||
internal static void PidFileError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Cannot create pid file. {e.Message}",
|
||||
Severity.Warn);
|
||||
log.WriteLine($"Cannot create pid file. {e.Message}", Severity.Warn);
|
||||
}
|
||||
|
||||
internal static void ProcessId(this LogBase log, int pid)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Running with process ID {pid}",
|
||||
Severity.Notice);
|
||||
log.WriteLine($"Running with process ID {pid}", Severity.Notice);
|
||||
}
|
||||
|
||||
internal static void SchedulerError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine("Error during initialization of scheduler.", Severity.Error);
|
||||
log.WriteLine(e.Message, Severity.Debug);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void Starting(this LogBase log, string version)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"NTP Analyzer {version} started.",
|
||||
Severity.Notice);
|
||||
log.WriteLine($"NTP Analyzer {version} started.", Severity.Notice);
|
||||
}
|
||||
|
||||
internal static void TableError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine("Could not populate tables with data.", Severity.Error);
|
||||
log.WriteLine(e.Message, Severity.Debug);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void UserId(this LogBase log, uint userId)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Running under user id {userId}",
|
||||
Severity.Info);
|
||||
log.WriteLine($"Running under user id {userId}", Severity.Info);
|
||||
}
|
||||
|
||||
internal static void UserIdError(this LogBase log, uint userId)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Failed to set user id {userId}",
|
||||
Severity.Warn);
|
||||
log.WriteLine($"Failed to set user id {userId}", Severity.Warn);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,110 +73,77 @@ namespace Ntp.Data.Log
|
||||
|
||||
internal static void DbLinkDown(this LogBase log)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Database link is down.",
|
||||
Severity.Notice);
|
||||
log.WriteLine("Database link is down.", Severity.Notice);
|
||||
}
|
||||
|
||||
internal static void DbLinkError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine(
|
||||
e.Message,
|
||||
Severity.Info);
|
||||
log.WriteLine(e.Message, Severity.Info);
|
||||
}
|
||||
|
||||
internal static void DbLinkUp(this LogBase log)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Database link is up.",
|
||||
Severity.Notice);
|
||||
log.WriteLine("Database link is up.", Severity.Notice);
|
||||
}
|
||||
|
||||
internal static void SchemaChangesApplied(this LogBase log, string version)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Changes for version {version} applied.",
|
||||
Severity.Notice);
|
||||
log.WriteLine($"Changes for version {version} applied.", Severity.Notice);
|
||||
}
|
||||
|
||||
internal static void SchemaUpdated(this LogBase log, string version)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Database schema updated to version {version}",
|
||||
Severity.Notice);
|
||||
log.WriteLine($"Database schema updated to version {version}", Severity.Notice);
|
||||
}
|
||||
|
||||
internal static void SchemaUpdateError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Failed to apply database change script.",
|
||||
Severity.Error);
|
||||
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine("Failed to apply database change script.", Severity.Error);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void SchemaUpToDate(this LogBase log)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Database schema is latest version.",
|
||||
Severity.Info);
|
||||
log.WriteLine("Database schema is latest version.", Severity.Info);
|
||||
}
|
||||
|
||||
internal static void SchemaVersionError(this LogBase log, int current, int latest)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Application version is {current} but database version is {latest}.",
|
||||
Severity.Error);
|
||||
log.WriteLine($"Application version is {current} but database version is {latest}.", Severity.Error);
|
||||
}
|
||||
|
||||
internal static void VersionTableCreated(this LogBase log)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Created new version table.",
|
||||
Severity.Notice);
|
||||
log.WriteLine("Created new version table.", Severity.Notice);
|
||||
}
|
||||
|
||||
internal static void VersionTableCreateError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Failed to create version table.",
|
||||
Severity.Error);
|
||||
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine("Failed to create version table.", Severity.Error);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void VersionTableFetchError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Failed to fetch version number from database.",
|
||||
Severity.Error);
|
||||
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine("Failed to fetch version number from database.", Severity.Error);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void VersionTableInsertError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Failed to insert into version table.",
|
||||
Severity.Error);
|
||||
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine("Failed to insert into version table.", Severity.Error);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
internal static void VersionTableParamError(this LogBase log)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Internal error: Version cannot be null.",
|
||||
Severity.Error);
|
||||
log.WriteLine("Internal error: Version cannot be null.", Severity.Error);
|
||||
}
|
||||
|
||||
internal static void VersionTableUpdateError(this LogBase log, Exception e)
|
||||
{
|
||||
log.WriteLine(
|
||||
"Failed to update version table.",
|
||||
Severity.Error);
|
||||
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
log.WriteLine("Failed to update version table.", Severity.Error);
|
||||
log.WriteLine(e);
|
||||
}
|
||||
|
||||
private static string GetDbDataParameterValue(IDataParameter p)
|
||||
|
||||
Reference in New Issue
Block a user