Some aspects of our MessageHandler libraries, among others the outbox, the transactional and the stream processing runtimes, run on background threads.
To enable logging from these background processes, you can register tracing sinks.
Logging to console
There is a built in sink, which logs to console. It can be enabled by calling RegisterBufferedConsoleTracingSink.
public static HandlerRuntimeConfiguration AddConsoleLogging(this HandlerRuntimeConfiguration runtimeConfiguration)
{
runtimeConfiguration.RegisterBufferedConsoleTracingSink(StructuredTraceSeverity.Warn);
return runtimeConfiguration;
}
Logging to Azure Application Insights
There is also an extension for logging to application insights, available in the MessageHandler.Runtime.Diagnostics.ApplicationInsights nuget package.
PM> Install-Package MessageHandler.Runtime.Diagnostics.ApplicationInsights
It can be enabled by calling RegisterApplicationInsightsTracingSink.
public static HandlerRuntimeConfiguration AddApplicationInsightsLogging(this HandlerRuntimeConfiguration runtimeConfiguration)
{
runtimeConfiguration.RegisterApplicationInsightsTracingSink(StructuredTraceSeverity.Warn);
return runtimeConfiguration;
}