I am able to get the Serilog into console, but after publishing into Azure Functions, the logs message using Serilog.log.information()
etc does not appear.
I tried writing to a file using file.sink
.WriteTo.File(
@"D:\home\LogFiles\Application\myapp.txt",
fileSizeLimitBytes: 1_000_000,
rollOnFileSizeLimit: true,
shared: true,
flushToDiskInterval: TimeSpan.FromSeconds(1))
Below is the configuration I have in the startup.cs
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Console()
.CreateLogger();
builder.Services.AddSingleton<ILoggerProvider>(sp => new SerilogLoggerProvider(Log.Logger, true));
builder.Services.AddLogging(lb => lb.AddSerilog(Log.Logger, true));