如何在没有 Cloud Explorer 的情况下从 Azure 应用服务获取事件日志文件?

How to get event log files from Azure app service without Cloud Explorer?

我有一个 Azure 应用服务。在 Visual Studio 2019 年,我可以这样做以从中获取事件日志:

  1. 打开 Cloud Explorer window(查看 -> Cloud Explorer)。
  2. 使用我的 Azure 凭据登录。
  3. 展开订阅,然后是资源组,然后是应用服务。
  4. 展开文件夹日志文件
  5. 双击eventlog.xml下载。

在 Visual Studio 2022 年没有 Cloud Explorer。他们建议我们改用 Azure 存储资源管理器。我无法在存储资源管理器中找到事件日志文件。

有谁知道如何在没有 Visual Studio 2019 的情况下从 GUI 或命令行获取它?

我在这篇 Microsoft 文章中找到了答案:https://docs.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-6.0#troubleshoot-on-azure-app-service

To access the Application Event Log, use the Diagnose and solve problems blade in the Azure portal:

  1. In the Azure portal, open the app in App Services.
  2. Select Diagnose and solve problems.
  3. Select the Diagnostic Tools heading.
  4. Under Support Tools, select the Application Events button.
  5. Examine the latest error provided by the IIS AspNetCoreModule or IIS AspNetCoreModule V2 entry in the Source column.

An alternative to using the Diagnose and solve problems blade is to examine the Application Event Log file directly using Kudu:

  1. Open Advanced Tools in the Development Tools area. Select the Go→ button. The Kudu console opens in a new browser tab or window.
  2. Using the navigation bar at the top of the page, open Debug console and select CMD.
  3. Open the LogFiles folder.
  4. Select the pencil icon next to the eventlog.xml file.
  5. Examine the log. Scroll to the bottom of the log to see the most recent events.