My .NET Core 3 implementation of Quartz.Net is logging the following message approximately twice per minute and I would like to remove it without affecting my applications other logs:
"Batch acquisition of 0 triggers"
2020-06-22 17:42:24.745 +01:00 - [MyApplication] - [Debug] - [Quartz.Core.QuartzSchedulerThread] Batch acquisition of 0 triggers
2020-06-22 17:42:53.689 +01:00 - [MyApplication] - [Debug] - [Quartz.Core.QuartzSchedulerThread] Batch acquisition of 0 triggers
Where [MyApplication]
is populated by the Source
property and [Quartz.Core.QuartzSchedulerThread]
comes from the SourceContext
.
Quartz.net logs this automatically and I seem to have no control over deciding to log it or not. My logs are filling up too quickly.
My Appsettings.json file is as follows:
"Serilog": {
"IncludeScopes": false,
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "C:/Logs/my-app.log",
"buffered": "true",
"flushToDiskInterval": "00:00:10",
"rollingInterval": "Infinite",
"rollOnFileSizeLimit": "true",
"fileSizeLimitBytes": 10485760,
"retainedFileCountLimit": 90,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} - {Source} - [{Level}] - [{SourceContext}] {Message}{NewLine}{Exception}"
}
},
{
"Name": "Async",
"Args": {
"restrictedToMinimumLevel": "Information",
"configure": [
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} - {Source} - [{Level}] - {Message}{NewLine}{Exception}"
}
}
]
}
}
]
}
My Program.cs main
initially configures the logger like this:
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.Enrich.FromLogContext()
// set Source property, which we use in output formatting, to the name of the application
.Enrich.WithProperty("Source", value: "MyApplication")
.CreateLogger();
And later in my Startup.cs, when my services & settings have been registered Serilog is reconfigured as follows:
public void Configure(IApplicationLifetime applicationLifetime)
{
SerilogLogger.Reconfigure(
applicationName: "MyApplication",
toFixedFile: !string.IsNullOrEmpty(_loggerSettings.LogFilePathFixed),
fileName: _loggerSettings.LogFilePathFixed,
fileSizeBytes: configuredLogFileSize * 1024 * 1024,
minimalLevel: "Debug",
outputTemplate: _loggerSettings.LogFormat);
}
Where the Reconfigure
extension method comes from a 3rd party dll built in another development department.
I have tried to add the following after the invocation of Reconfigure
:
SerilogLogger.RefineConfiguration(x => x.MinimumLevel.Override("Quartz", LogEventLevel.Warning));
But it doesn't work because the actual source is MyApplication
, and if I use "MyApplication" instead of "Quartz" I suppress all debug and information logs for the entire application.
Any ideas? With code examples please.
--
You received this message because you are subscribed to the Google Groups "Quartz.NET" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quartznet+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quartznet/7dab90ab-f434-4773-ac08-790d37f0b50do%40googlegroups.com.
SerilogLogger.RefineConfiguration(x => x.MinimumLevel.Override("Quartz", LogEventLevel.Warning));
To unsubscribe from this group and stop receiving emails from it, send an email to quar...@googlegroups.com.
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"System": "Warning",
"Quartz": "Warning"
}
},
To unsubscribe from this group and stop receiving emails from it, send an email to quartznet+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quartznet/6ab0ae72-5b72-4713-925b-b2273d022d78o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quartznet/6ab0ae72-5b72-4713-925b-b2273d022d78o%40googlegroups.com.