I do have a Docker container running a .net core 2 app.
The logging is configured using this code in Program.cs
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
logging.AddConsole();
logging.AddDebug();
})
.UseStartup<Startup>();
and the appsettings.json
file
{
"Logging": {
"LogLevel": {
"Default": "Information"
}
},
}
Logging seems to be Ok, when running Kestrel directly, I can see the logs in the terminal. Same thing, when containerized: the command docker logs
shows what I want.
Troubles arise in production, when run in as a container in Azure Web App. I cannot find any consistent docker logs.
I made attempts to visit the Log file via FTP or via the url https://[mysite].scm.azurewebsites.net/api/logs/docker
the log files are almost empty for example,
https://[mysite].scm.azurewebsites.net/api/vfs/LogFiles/2018_09_09_RD0003FF74F63E_docker.log
,
only container starting lines are present
Also I do have the same lines in the usual portal interface.
The question is: do docker logs are automatically output in docker.log files in Azure Web App? Is there something that I am missing?