Closed catamounttechnology closed 7 months ago
Hi! I can't spot anything at first glance; does SelfLog.Enable()
produce anything useful?
No known issues using F# with Serilog that I'm aware of.
I tried SelfLog.Enable with a delegate, the delegate is never called
Thanks for the follow-up. Will need some investigation. It would also be useful to try reproducing this on another machine, since it's uncommon but not unheard of for tooling install problems to cause this kind of thing.
Unfortunately I don't have a second machine with the same configuration.
As a workaround I moved all my F# code in a library. The application starter is now written in C#, while the full business logic is in the F# library. With this, logging works. Feel free to close this issue, even if not solved.
Glad you were able to work around it. I'll close this, and reopen if anyone else reports something similar 👍
Description I have an F# asp.net 8 api. The application has been developed in a Windows 10 machine initially, and log was working as expected. Now I have a new machine with Windows 11 and in there nothing is logged to the console. So I made some simple tests and it looks like the issue is occurring only for F#
Reproduction code in https://github.com/catamounttechnology/WebApplication1 In visual studio 2022:
Log.Logger = new LoggerConfiguration().WriteTo.Console().CreateLogger();
try { Log.Information("Starting web application");
} catch (Exception ex) { Log.Fatal(ex, "Application terminated unexpectedly"); } finally { Log.CloseAndFlush(); }
namespace WebApplication3
nowarn "20"
open Microsoft.AspNetCore.Builder open Microsoft.Extensions.DependencyInjection open Microsoft.Extensions.Hosting open Serilog
module Program = []
let main args =
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts": "*" }
{ "DetailedErrors": true, "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } } }