How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

huangapple go评论55阅读模式
英文:

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

问题

我有一个托管的Blazor Web应用和Web作业。从Visual Studio发布时,它部署如预期。然而,从DevOps发布流水线部署时,尽管任务显然成功,但网站没有处于可工作状态,意味着:
静态文件可用(即Blazor Wasm),但对API的调用失败,返回405错误(或类似错误)。看起来网站的WebApp部分没有启动。

所以我的问题是....
"我在哪里可以找到描述任何启动错误的日志文件?"

我尝试过什么?

  • 我尝试配置DevOps流水线使用备用方法(WebApp、Zip Package等)。wwwroot文件夹在每种情况下都包含所有文件,如预期。
  • 我下载了Kudu dump。有许多文件或文件夹。我不确定我在看什么。尽管如此,我找不到明显的错误,也找不到"startup.log"或类似的文件。

在下载Kudu dump后,我在哪里可以找到描述启动期间任何错误的日志文件?

英文:

I have a hosted blazor webapp and webjob. It deploys as expected when publishing from visual studio. However, when deploying from an DevOps release pipeline, although the task is apparently successful, the site is not left in a workable state, meaning:
Static files are available (ie the blazor wasm) but calls to the API fail with 405 (or similar). It appears that the WebApp part of the site is not starting.

So my question is....
"Where can I find a log file that describes any startup errors?"

What have I tried?

  • I have tried configuring the DevOps pipeline to use alternate methods (WebApp, Zip Package etc). The wwwroot folder contains all the files as expected in each scenario.
  • I have downloaded the Kudu dump. There are lots of files or folders. I'm not sure what I'm looking at. Nonetheless I cannot find any obvious errors, though neither can I find "startup.log" or similar

After downloading a Kudo dump, where can I find the log file that describes any errors during startup?

答案1

得分: 1

以下是翻译好的内容:

> 我在哪里可以找到描述任何启动错误的日志文件?

您可以在 Web 应用程序的“日志流”部分找到启动错误。

启用应用程序日志记录

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

在日志流中,检查启动日志

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

  • 另一种方法是在“开发工具” => “高级工具” => “Kudu” => “Go” 下检查,然后从“工具”中下载“诊断转储”。

打开转储并访问 => 日志文件 => Http => 原始日志并检查日志。

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

我的部署文件

  • 您可以在“工具”中的“Zip 推送部署”选项中检查部署日志,还可以检查您的文件。

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

我创建了一个带有 webjobBlazor 应用程序,然后通过发布和 YAML 流水线部署到 Azure 应用服务

在您的发布流水线中,您可以在这里找到日志

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

  • 另一种方法是使用 YAML 流水线构建和部署 Azure Web 应用程序,在此期间您可以正确检查所有文件并在部署时将其发布为工件。
  • 通过这种方式,您可以检查所有文件是否已正确部署和发布,包括您的 WebjobBlazor 应用程序
  • 我使用了我的 yaml 流水线中的构建,并在发布流水线中将其用作工件。

我的 YAML 流水线脚本:-

trigger:
  branches:
    include:
      - main

jobs:
- job: Build
  displayName: '构建和发布'
  pool:
    vmImage: 'ubuntu-latest'
  steps:
  - task: UseDotNet@2
    displayName: '安装 .NET Core SDK'
    inputs:
      version: '6.x'

  - task: DotNetCoreCLI@2
    displayName: '还原依赖项'
    inputs:
      command: '还原'
      projects: '**/*.csproj'

  - task: DotNetCoreCLI@2
    displayName: '构建项目'
    inputs:
      command: '构建'
      projects: '**/*.csproj'
      arguments: '--configuration Release'

  - task: DotNetCoreCLI@2
    displayName: '发布项目'
    inputs:
      command: '发布'
      projects: '**/*.csproj'
      publishWebProjects: true
      arguments: '--configuration Release --output $(Build.ArtifactStagingDirectory)'
      zipAfterPublish: true

  - task: PublishPipelineArtifact@1
    displayName: '发布工件'
    inputs:
      targetPath: '$(Build.ArtifactStagingDirectory)'
      artifactName: 'publishedApp'
      publishLocation: 'pipeline'

- job: Deploy
  displayName: '部署到 Azure Web 应用程序'
  dependsOn: Build
  pool:
    vmImage: 'ubuntu-latest'
  steps:
  - download: current
    artifact: 'publishedApp'

  - task: UseDotNet@2
    displayName: '安装 .NET Core SDK'
    inputs:
      version: '6.x'

  - task: AzureWebApp@1
    displayName: 'Azure Web 应用程序部署'
    inputs:
      azureSubscription: 'subscription'
      appType: 'webApp'
      appName: 'valleywebapp09'
      package: '$(Agent.BuildDirectory)/**/*.zip'
      deploymentMethod: 'auto'

在运行上述流水线时,请勾选启用诊断日志并运行。

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

英文:

> Where can I find a log file that describes any startup errors?

You can find startup errors in the Log Stream section of your Web app.

Enable Application logging

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

In Log Stream ,check the Start up logs

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

  • Another way is to check under
    Development Tools =>Advanced Tools => Kudu => Go , then download Diagnostic dump from the Tools.

Open the Dump and visit => Log Files => Http => Raw logs and check the logs.

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

My deployed files

  • You can check the deployment logs in Zip push Deploy option in Tools and also check your files.

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

I created one Blazor app with webjob and then deployed it to Azure app service via Release and YAML pipeline.

In your release pipeline you can find the logs here

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

  • An alternative is to Build and Deploy your Azure Web app with YAML pipeline, where you can check out all the files correctly and publish it as an artifact while deployment.
  • This way you can check if all the files are deployed and published correctly including your Webjob and Blazor app.
  • I used the build from my yaml pipeline and used it as an artifact in the release pipeline.

My YAML pipeline script:-

trigger:
  branches:
    include:
      - main

jobs:
- job: Build
  displayName: 'Build and Publish'
  pool:
    vmImage: 'ubuntu-latest'
  steps:
  - task: UseDotNet@2
    displayName: 'Install .NET Core SDK'
    inputs:
      version: '6.x'

  - task: DotNetCoreCLI@2
    displayName: 'Restore Dependencies'
    inputs:
      command: 'restore'
      projects: '**/*.csproj'

  - task: DotNetCoreCLI@2
    displayName: 'Build Project'
    inputs:
      command: 'build'
      projects: '**/*.csproj'
      arguments: '--configuration Release'

  - task: DotNetCoreCLI@2
    displayName: 'Publish Project'
    inputs:
      command: 'publish'
      projects: '**/*.csproj'
      publishWebProjects: true
      arguments: '--configuration Release --output $(Build.ArtifactStagingDirectory)'
      zipAfterPublish: true

  - task: PublishPipelineArtifact@1
    displayName: 'Publish Artifact'
    inputs:
      targetPath: '$(Build.ArtifactStagingDirectory)'
      artifactName: 'publishedApp'
      publishLocation: 'pipeline'

- job: Deploy
  displayName: 'Deploy to Azure Web App'
  dependsOn: Build
  pool:
    vmImage: 'ubuntu-latest'
  steps:
  - download: current
    artifact: 'publishedApp'

  - task: UseDotNet@2
    displayName: 'Install .NET Core SDK'
    inputs:
      version: '6.x'

  - task: AzureWebApp@1
    displayName: 'Azure Web App Deploy'
    inputs:
      azureSubscription: 'subscription'
      appType: 'webApp'
      appName: 'valleywebapp09'
      package: '$(Agent.BuildDirectory)/**/*.zip'
      deploymentMethod: 'auto'

While running the above pipeline checkmark enable diagnostic logging and run.

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

How do I interpret Kudu logs to understand why my azure website is not starting correctly from DevOps release pipeline

huangapple
  • 本文由 发表于 2023年6月26日 01:14:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76551593.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定