Reputation: 1564
I'm following the instructions here https://github.com/serilog/serilog-aspnetcore, but in the end no MVC events are getting logged, even though the minimum level was set to Verbose. Any ideas what am I doing wrong?
I'm using ASP.NET Core 2 with the following settings:
public static int Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.MinimumLevel.Override("Microsoft", LogEventLevel.Verbose)
.Enrich.FromLogContext()
.WriteTo.Console()
.CreateLogger();
// here goes the rest of init
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseSerilog()
.Build();
Upvotes: 0
Views: 297
Reputation: 2836
The configuration looks OK. I am using the same ... are you looking in the right place for the logs?
With this configuration the logs will be shown in the 'Output' window in Visual Studio while debugging. Keep in mind that you must switch the output window from 'Debug' to 'ASP.NET Core Web Server' mode.
NOTE: I am using the Literate but it should be the same.
If you still don't see any output, try to remove this line and check again. (I have blurry memory about the same issue which was gone after i removed the overrides)
.MinimumLevel.Override("Microsoft", LogEventLevel.Verbose)
Upvotes: 1