Search code examples
c#serilog

Read current Serilog's configuration


Is there a property / method in Serilog where I could (programmatically) check the current configuration? (sinks, minimum level)

e.g. if have this config:

Log.Logger = new LoggerConfiguration()
    .MinimumLevel.Debug()
    .WriteTo.File("log.txt")
    .WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Information)
    .CreateLogger();

How could I read this config later?

(In my case the config is dynamically created outside my application)


Solution

  • No, there's no reflective way to examine Serilog configuration.