I am using IApplicationBuilder.UseSerilogRequestLogging() for request logging. I have configured File as sink. But it is not working. I can see every other log events but there is no Event logs that are generated by UseSerilogRequestLogging(). Even if I remove this method from the middleware pipeline, the logs are the same. I have tried to set minimum level of "Microsoft.AspNetCore" to LogEventLevel.Warning but in that case there are no logs.
I have installed Serilog, Serilog.AspNetCore nudget packages.
below is my programe.cs code
var builder = WebApplication.CreateBuilder(args);
var logger = new LoggerConfiguration()
.WriteTo.File("Logs.txt")
.CreateLogger();
builder.Host.UseSerilog(logger);
var app = builder.Build();
app.UseSerilogRequestLogging();
and here is my log file
I am trying for a long time but can't find any solution. Can anyone help?
I have tried to set minimum level of "Microsoft.AspNetCore" to LogEventLevel.Warning but in that case there are no logs.