I have an extremely simple web api created with .NET Core 5 which is set to host in a linux Docker container. All I want to do is have my console output go into the Docker logs, like it has in the past versions of .NET Core.
Here is my Main method in Program.cs
var LOG_EVENT_LEVEL = Environment.GetEnvironmentVariable("LOG_EVENT_LEVEL");
var logEventLevel = LOG_EVENT_LEVEL != null
? Enum.Parse<LogEventLevel>(LOG_EVENT_LEVEL)
: LogEventLevel.Information;
Log.Logger = new LoggerConfiguration()
.WriteTo.Console(logEventLevel)
.CreateLogger();
Log.Information("START");
I would think that the output "START" should be shown in my Docker logs, but it isn't. I see them in the debug window of VS as expected. Has something changed in .NET Core 5?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…