I am using SeriLog(with Loki sink), and I also have an Exception handler lambda
-like in here, which catches all exceptions happened during code execution and logs them with appropriate labels.
But, Serilog itself, automatically catches all unhandled exceptions and logs them before me. As a result, an exception is being logged twice.
How can I disable Serilog's automatic logging? This is my current Serilog Config:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureLogging((logging) =>
{
var log = new LoggerConfiguration()
.MinimumLevel.Debug()
.Enrich.FromLogContext()
.WriteTo.Console()
.CreateLogger();
logging.AddSerilog(log);
});