0

I get no log output at all on my release app. Even when logging with logger.LogError() there is nothing added to any log file. I'm currently using Serilog for the first time inside a MAUI 9.0.40 application with Serilog 4.2.0, Serilog.Extensions.Hosting 9.0.0, Serilog.Sinks.Debug 3.0.0 and Serilog.Sinks.File 6.0.0.

This is my current logger setup:

        services.AddSerilog(new LoggerConfiguration()
            .Enrich.FromLogContext()
            .WriteTo.Debug()
            .WriteTo.File(Path.Combine(FileSystem.Current.AppDataDirectory, "Logs", "log.txt"), 
                rollingInterval: RollingInterval.Day, 
                fileSizeLimitBytes: 10485760, 
                retainedFileCountLimit: 7)
            .CreateLogger());

Also logger.IsEnabled(LogLevel.Error) return false when build for Release but true when build for Debug?? I have no idea what I'm missing or did wrong so I assume it's just a bug? Anyone has a hint what I'm missing here?

1 Answer 1

0

I'm not sure what .WriteTo.Debug() means. But you likely need .MinimumLevel.Debug() instead.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.