You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi.
Im using Redis sync to transfer app logs to elastic.
When using your wonderful nuget there is a chance when a fatal exception has happened and the process crashed (like OutOfMemory) but the log entry has not been processed yet since it was queued and it was additional logs to process before that.
My idea is to send fatal and error messages via regular Redis sync and less important messages via Async. The order is not important since the target organizes the logs by log datetime field.
So I prepared something like this:
bool IsLogEventCritical(LogEvent logEvent) => logEvent.Level < LogEventLevel.Information;
loggerConfiguration
// route non critical logs directly to queue before redis
.WriteTo
.Async(configureAsync =>
configureAsync.Conditional(x => !IsLogEventCritical(x),
loggerRedisAsyncConfiguration => loggerRedisAsyncConfiguration.Redis(redisConnectionConfig)))
// route critical logs directly to redis
.WriteTo
.Conditional(IsLogEventCritical,
loggerRedisConfiguration => loggerRedisConfiguration.Redis(redisConnectionConfig));
Is this a good practice to ensure that critical logs are delivered in case of application crash or not rejected from queue because of queue limit is reached?
The text was updated successfully, but these errors were encountered:
Hi.
Im using Redis sync to transfer app logs to elastic.
When using your wonderful nuget there is a chance when a fatal exception has happened and the process crashed (like OutOfMemory) but the log entry has not been processed yet since it was queued and it was additional logs to process before that.
My idea is to send fatal and error messages via regular Redis sync and less important messages via Async. The order is not important since the target organizes the logs by log datetime field.
So I prepared something like this:
Is this a good practice to ensure that critical logs are delivered in case of application crash or not rejected from queue because of queue limit is reached?
The text was updated successfully, but these errors were encountered: