How to set NHibernate.Logging.Serilog without appSettings?

Viewed 29

The system is using the NHibernate.Logging.Serilog to log NHibernate.

It seems the only way to configure NHibernate.Logging.Serilog is the appSettings and serilog-settings-appsettings.

Is there a way to configure it by code without using appSettings?

Thanks in advance

1 Answers

serilog can be configured in code see here

example

Log.Logger = new LoggerConfiguration()
    .MinimumLevel.Information()
    .WriteTo.Console()
    .WriteTo.File("log.txt",
        rollingInterval: RollingInterval.Day,
        rollOnFileSizeLimit: true)
    .CreateLogger();

this should be called at the beginning before using NHibernate.

Related