You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know how to better explain it, I've tried a lot of things. Eventually I got it working by injecting Serilog.ILogger instead of the ILogger from microsoft, but I don't want to have to rewrite all my services and logging (Using ILogger.Info instead of ILogger.LogInformation for instance). This seems to be possible using ASP.NET core with builder.UseSerilog()? But that doesn't exist. In the end I had to do it manually:
var builder = Host.CreateApplicationBuilder(args);
var logger = new LoggerConfiguration()
.ReadFrom.Configuration(config)
.CreateLogger();
builder.Services.AddSingleton<Serilog.ILogger>(logger);
Nothing else I tried worked. There is a snippet of logging configuration with ClearProviders() and then adding Serilog as a provider. When I debugged my service I saw the ILogger then had just the Serilog provider instead of the default 4 ILogger providers (console, event log, etc.), but it didn't work. Is there a way to get this to work? Some sample or information int he readme would be helpful. It's frustrating because there is no error, it just doesn't show any output. I don't know then if I have my Serilog section in app settings correct, or what the problem is.
The text was updated successfully, but these errors were encountered:
I don't know how to better explain it, I've tried a lot of things. Eventually I got it working by injecting Serilog.ILogger instead of the ILogger from microsoft, but I don't want to have to rewrite all my services and logging (Using ILogger.Info instead of ILogger.LogInformation for instance). This seems to be possible using ASP.NET core with builder.UseSerilog()? But that doesn't exist. In the end I had to do it manually:
Nothing else I tried worked. There is a snippet of logging configuration with ClearProviders() and then adding Serilog as a provider. When I debugged my service I saw the ILogger then had just the Serilog provider instead of the default 4 ILogger providers (console, event log, etc.), but it didn't work. Is there a way to get this to work? Some sample or information int he readme would be helpful. It's frustrating because there is no error, it just doesn't show any output. I don't know then if I have my Serilog section in app settings correct, or what the problem is.
The text was updated successfully, but these errors were encountered: