Where can I find docker container logs for Azure App Service
Solution 1
Firstly you need to enable container logs
[App Service] -> Monitoring -> App Service logs
Then you can see container logs in [App Service] -> Monitoring -> Log stream
UPD
Also you can find logs in KUDU
Then "Current Docker Logs"
Solution 2
I've been cursing this for a good while, and eventually found something that works for me.
First I enabled filesystem logging as per @dima_horror's answer.
Next I ran a command-line az webapp log tail --name myApp --resource-group myRg
That now seems to give me useful output (it gave me nothing prior to enabling filesystem logging).
Solution 3
Have you checked the logs in container settings? I followed this guide to deploy a container to Azure web app.
Solution 4
To add to the answers, if you're having trouble with deploying the image in your App Service and need logs for that specifically, you can get the docker logs for the provisioning phase of your container under Deployment Center, e.g.:
Benoit Patra
Hello, I am CTO at iAdvize. I do have also a personal tech blog here.
Updated on July 09, 2022Comments
-
Benoit Patra almost 2 years
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 presentAlso 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?
-
Benoit Patra over 5 yearsYes as I wrote, I do have exactly the same lines, the
docker run
command and that's it. No other logs from the app itself. -
Mitch Stewart over 5 yearsDo you see anything if you get the logs via CLI (docs.microsoft.com/en-us/azure/container-instances/…)?
-
Benoit Patra over 5 yearsYou sure that
az container
commands are supposed to be used with Azure Web App? I cannot find the proper container, when I doaz container list
I do receive an empty array for answer. Looks like it is meant for Azure Container Instance -
Mitch Stewart over 5 yearsI came across this article (docs.microsoft.com/en-us/azure/app-service/containers/…) and thought back to your question.
-
Benoit Patra over 5 yearsActually, I just click off then on back and now I do have much more logs but I still cannot see the Application Logs I can only see Server logs
-
ashur almost 4 yearsThis is frustrating that you can't simply get logs in the portal -
Log stream
is mixing logs fromKudu
and app logs :/ -
David Carboni almost 4 yearsI've found a coping mechanism for this.
az webapp log tail ...
only provides a few lines of container output. Above those lines there's a URL which, providing you're authenticated with Azure, gives you more output. So: I first tail (to get the latest URL), then paste the link into my browser. It's a workaround (and a poor experience) but it's possible. I'd love to know if/when there's an easier way. -
Matthias Güntert about 3 years
az webapp log tail
does not seem to work for linux app plans. -
kiloton over 2 yearsis there any way to stream those to the Azure CLI as well?