Skip to content

Debug logs not appearing without explicity setting minimum level #17

@Reeceeboii

Description

@Reeceeboii

I am having a strange issue where LogEventLevel.Debug logs (or those written directly via Log.Debug()) do not show in the Debug console, unless .MinimumLevel.Debug() is applied to the global logger, despite the fact that the extension's default restrictedToMinimumLevel parameter is defaulted to LevelAlias.Minimum so the sink itself should be actioning debug level logs.

Configuring logger:

Logging.cs

[Conditional("DEBUG")]
public static void ConfigureDebugLogging()
{
    Log.Logger = new LoggerConfiguration()
        .WriteTo.Debug()
        .CreateLogger();
}

App.xaml.cs

Logging.ConfigureDebugLogging();

Log.Debug("Logging has started");
Log.Information("Logging has started");

Debug console:
image

Confusingly, this starts to work if I apply a .MinimumLevel.Debug() chain to the logger initialisation:

[Conditional("DEBUG")]
public static void ConfigureDebugLogging()
{
    Log.Logger = new LoggerConfiguration()
        .WriteTo.Debug()
        .MinimumLevel.Debug()
        .CreateLogger();
}

image

...but not if this is applied to the sink itself (which I would assume to be redundant as the sink defaults to this anyway):

[Conditional("DEBUG")]
public static void ConfigureDebugLogging()
{
    Log.Logger = new LoggerConfiguration()
        .WriteTo.Debug(restrictedToMinimumLevel: LogEventLevel.Debug)
        .CreateLogger();
}

image

Running version 3.0.0 of this package inside a .NET 8.0 WPF Solution.

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