OrmLite disabling SQL query output in Debug mode

Does by default OrmLite logs all Sql queries to the Console at the Debug level?

I have a console app (not a ss service) using OrmLite and all the queries are logged at the Debug level. I’m using Serilog.

Here is my appsettings file:

{
    "Serilog": {
        "MinimumLevel": {
            "Default": "Debug",
            "Override": {
                "Microsoft": "Warning",
                "System": "Warning",
                "Microsoft.AspNetCore": "Warning"
            }
        }
    }
}

The config builder etc.:

IConfigurationBuilder builder = new ConfigurationBuilder()
                .SetBasePath(Directory.GetCurrentDirectory())
                .AddJsonAppSettingsBasedOnAspNetCoreEnvironment()
                .AddEnvironmentVariables();

IConfiguration configuration = builder.Build();

var logger = new LoggerConfiguration()
    .ReadFrom.Configuration(configuration)
    .WriteTo.Console(_opts.ConsoleSinkMinimumLevel)
    .WriteTo.File(logFilePath, _opts.FileSinkMinimumLevel, rollingInterval: RollingInterval.Day)
    .CreateLogger();

LogManager.LogFactory = new SerilogFactory(logger);                    

Log = LogManager.GetLogger(typeof(Program));

Is there a way to switch this off and on with a flag?

Thanks.

Since you are using the ServiceStack LogManager, it will follow what you have configured as the default , and OrmLite commands do output by default at the Debug level.

Have you tried using the Override of ServiceStack.Ormlite at a different log level? Chances are it is going through the following Log instance which uses the ServiceStack.OrmLite.OrmLiteReadCommandExtensionsAsync type.

If you create a project on GitHub reproducing your logging setup with an OrmLite call, that will help to be able to test alternate options.

I’ll try making a demo project over the weekend.

Sorry for the belated reply.