Is your feature request related to a problem? Please describe.
Working with a simple .NET 6 application like the following. I am not able to get a use of Serilog.ILogger in my code. Everything else work perfectly with Microsoft.Extensions.Logging.ILogger
using Serilog;
using Steelto.Extensions.Configuration.CloudFoundry;
using Steeltoe.Extensions.Logging.DynamicSerilog;
using Steeltoe.Management.Endpoint;
using Web.Application.Logging;
var builder = WebApplication.CreateBuilder(args);
builder.AddCloudFoundryConfiguration();
builder.AddDynamicSerilog(configurationLogger: (_, lg) =>
{
lg.Initialize();
});
builder.WebHost.AddAllActuators();
builder.Services.AddControllers();
builder.Services.AddSingleton(Log.Logger);
var app = builder.Build();
app.MapControllers();
app.Run();
In the above code Initialize() just configures the logger with its sinks.
If I don't add the line builder.Services.AddSingleton(Log.Logger);, Serilog.ILogger will be null. When I add it, it will resolved to SilentLogger;
I tried different way to get access to serilogLogger from the library before it turns to FrameworkLogger, no luck!
Is your feature request related to a problem? Please describe.
Working with a simple .NET 6 application like the following. I am not able to get a use of
Serilog.ILogger
in my code. Everything else work perfectly withMicrosoft.Extensions.Logging.ILogger
In the above code
Initialize()
just configures the logger with its sinks.If I don't add the line
builder.Services.AddSingleton(Log.Logger);
,Serilog.ILogger
will be null. When I add it, it will resolved toSilentLogger
;I tried different way to get access to serilogLogger from the library before it turns to FrameworkLogger, no luck!
Any suggestion?
Dan