How to Enable Trace/Debug level logging using .Net SDK 3.0.7?

Trying to get trace level logging from Couchbase SDK to debug an issue with .Net Core Web API. Passed the loggerfactory in the ClusterOptions and my appsettings.json has “Trace” enabled but the SDK only logs info logs SDK but not Trace/Debug logs.

My appsettings.json says:

{
“Logging”: {
“LogLevel”: {
“Default”: “Trace”,
“Microsoft”: “Trace”,
“Microsoft.Hosting.Lifetime”: “Trace”
}
},
“AllowedHosts”: “*”
}

My Cluster options:

await Cluster.ConnectAsync(new ClusterOptions
{
Logging = loggerFactory
}
.WithConnectionString(serverList)
.WithCredentials(CouchbaseUsername, CouchBasePassword));

It’s also possible for individual logging destinations to have a log threshold set, which can filter their output. Can you show your entire logging configuration, including the configuration for things like the Console logger (or whatever logger you’re using)?

It’s the console logger, that come out of the box with .Net core. and bootstrapped in Program.cs:

public static IHostBuilder CreateHostBuilder(string args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole();
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup();
});

I’ve replicated that basic configuration on my machine, and it is logging trace/debug logs for the Couchbase SDK. There must be some subtle difference we’re missing.

First, I would recommend using the Couchbase.Extenstions.DependencyInjection package for registering Couchbase with DI, rather than manually building it with ConnectAsync. This does several things, including wiring the SDK up to logging automatically.