-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Console application fails after upgrading to Serilog 7 #394
Comments
Thank you for the bug report. This issue has already been brought to our attention in #389. It is already fixed by #391 which is merged in the In the meantime, the recommended workaround is to specify one assembly through the var options = new ConfigurationReaderOptions(typeof(ConsoleLoggerConfigurationExtensions).Assembly);
string logFormat = "[{Timestamp:yyyy-MM-dd hh:mm:ss tt}][{Level:u3}] {Message:lj}{NewLine}{Exception}";
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(appServices.Configuration, options)
.WriteTo.Console(LogEventLevel.Verbose, logFormat)
.WriteTo.File(LogFile, LogEventLevel.Verbose, logFormat)
.WriteTo.List(LogEvents)
.CreateLogger(); |
@0xced Thanks for the timely response. I will review your workaround and keep an eye out for the next update. I found my project also runs if I just don't produce a single file. |
Yes, releasing 7.0.1 with these two bug fixes is a good idea in my opinion. |
Serilog.Settings.Configuration 7.0.1, which fixes this issue, is now released on NuGet, enjoy! 🚀 |
@0xced Sorry, but I had another question about this. Actually, I had not installed Serilog.Settings.Configuration. I thought you were updating the main component. Would installing this package still fix this issue for me? |
Serilog.Settings.Configuration is a dependency of the Serilog.AspNetCore package, as you can see on its NuGet page: So yes, installing version 7.0.1 explicitly of |
@0xced Cool. Thanks again. I guess the NuGet manager in Visual Studio isn't smart enough to see I have that dependency. |
My console application has been working fine. Recently, I made some changes and redeployed it, and now it's throwing an exception.
None of my changes were related to Serilog or logging. However, I did refresh all the NuGet packages with updates, including updating Serilog.AspNetCore from 6.1.0 to 7.0.0.
While it's true I have the Produce single file option checked, this options was working and I'd prefer to keep using it.
Does anyone know what might have changed in Serilog version 7 that could cause this?
Here's my configuration:
I'm using .NET 7.0. And here's my configuration section.
The text was updated successfully, but these errors were encountered: