Skip to content

Debug logs from NServiceBus and application code not showing up #30

@timbussmann

Description

@timbussmann

The default log level for Azure Functions is set to Information. When lowering this level in the hosts.json to Debug, e.g.

{
    "version": "2.0",
    "logging": {
      "logLevel": {
        "default": "Debug"
      }
    }
}

debug log statements from NServiceBus, but also from user code that is using the logger retrieved via executionContext.GetLogger does not show up.

There is a corresponding issue in Microsoft's azure functions worker repo: Azure/azure-functions-dotnet-worker#573 (marked as duplicate of Azure/azure-functions-dotnet-worker#1125). This doesn't seem to be a NServiceBus related problem as this repro-sample doesn't use NSB at all.


The workaround to get the debug log statements working is to configure the logger on the host builder configuration in addition to the hosts.json:

var host = new HostBuilder()
    .ConfigureFunctionsWorkerDefaults()
    .ConfigureLogging(l =>
    {
        l.SetMinimumLevel(LogLevel.Debug);
    })
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions