Event Logs
The system is using libraries from SeriLog to perform server-side logging within services.
Event logging is initialized as:
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Is(level)
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Information)
.MinimumLevel.Override("System", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.Console()
.WriteTo.File(
new RenderedCompactJsonFormatter(),
@$"{System.IO.Path.GetTempPath()}/KmdDVITemp/logs/{logName}_Log.txt",
fileSizeLimitBytes: 1_000_000,
rollOnFileSizeLimit: true,
shared: true,
flushToDiskInterval: TimeSpan.FromSeconds(1)
)
.WriteTo.EventLog("KMD "+logName, manageEventSource: true)
level is defined by the presence of an environment variable ‘LOG_LEVEL’. Default is INFORMATION.
‘LOG_LEVEL’ environment variable can be set to:
LOG_LEVEL | Description |
---|---|
‘Verbose’ | Anything and everything you might want to know about a running block of code. |
‘Debug’ | Internal system events that aren’t necessarily observable from the outside. |
‘Information’ | The lifeblood of operational intelligence - things happen. |
‘Warning’ | Service is degraded or endangered. |
‘Error’ | Functionality is unavailable, invariants are broken or data is lost. |
‘Fatal’ | System stopped. |
logName is one of ‘Plass_Id_Data_Api’ or ‘Plass_Id_Identity’
Events are written to three different sinks:
-
Console
Event data appears in the Windows Console through Standard Output. It will typically not be easily visible in production environments, details. -
File
Event data are written to{System.IO.Path.GetTempPath()}/KmdDVITemp/logs/{logName}_Log.txt
.
The GetTempPath() result is typically related to the user executing the service, in case of the standard APP_POOL user, the logs are typically found at C:/Windows/Temp/KmdDVITemp/logs
The log file is split every 1MB, starting a new log file adding the next number to the end of file name. You must keep the logs folder tidy yourself, details -
Windows EventLog
Event data are written to the Windows Event Logging subsystem and can be found at:
Details