我在哪里可以找到Azure App Service的docker容器日志

问题描述 投票:1回答:1

我有一个运行.net core 2 app的Docker容器。

使用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>();

appsettings.json文件

{
  "Logging": {
    "LogLevel": {
      "Default": "Information"
    }
  },
}

记录似乎没问题,直接运行Kestrel时,我可以看到终端中的日志。同样的事情,当集装箱化时:命令docker logs显示我想要的东西。

在Azure Web App中作为容器运行时,生产中会出现问题。我找不到任何一致的docker日志。

我试图通过FTP或通过url https://[mysite].scm.azurewebsites.net/api/logs/docker访问日志文件,日志文件几乎是空的,例如,https://[mysite].scm.azurewebsites.net/api/vfs/LogFiles/2018_09_09_RD0003FF74F63E_docker.log,只有容器起始行存在enter image description here

此外,我在通常的门户界面中也有相同的行。

问题是:docker日志会自动输出到Azure Web App中的docker.log文件中吗?有什么东西我错过了吗?

c# azure docker azure-web-app-service azure-web-app-for-containers
1个回答
0
投票

您是否在容器设置中检查了日志?我按照this指南将容器部署到Azure Web应用程序。

Container Logs

© www.soinside.com 2019 - 2024. All rights reserved.