这是我在GCP中所熟悉的。我能够将Spring Boot REST API部署到GAE(Google App Engine),并在Cloud Logging中查看所有启动和运行日志。
看起来非常好,并且干净利落地记录了日志:
[当我尝试使用Azure完成相同的任务,并将相同的Spring Boot REST API部署到Azure“ App Service”时,我不知道是否存在类似的东西。
在Deployment Center中,我将其配置为通过以下默认yaml脚本通过Github Actions推送我的代码:
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy JAR app to Azure Web App
on:
push:
branches:
- develop
jobs:
build-and-deploy:
runs-on: windows-latest
steps:
- uses: actions/checkout@master
- name: Set up Java version
uses: actions/setup-java@v1
with:
java-version: '11'
- name: Build with Maven
run: mvn clean install
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v1
with:
app-name: '**********'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_12ee0e892d9c498898a01f1268a3dbd4 }}
package: '${{ github.workspace }}/target/*.jar'
可能需要注意的是,本文档最初说是要部署“ WAR”应用程序,但我只是将其查找的文件从.war
更改为.jar
。我实际上没有在App Service中看到任何选项可以将其配置为期望使用SBA(春季启动应用程序),但Google不需要我告诉它如何运行该应用程序,那么为什么要使用Azure?
不管怎样,我试图查找这些日志的主要原因是因为我无法访问已公开的可在localhost上使用的api端点。我收到消息说The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
,这是尝试(我手动呈现原始html输出)时得到的(监视->日志流)应用程序日志:
Azure是否有任何类型的云日志记录可以帮助我了解为什么我的香草春季应用仅生产404?
如果您在App Service中部署Java Web App,则选项很少:
这是我们针对Windows Azure应用服务上Java Web Apps的快速入门:
https://docs.microsoft.com/en-us/azure/app-service/app-service-web-get-started-java
这是我们针对Linux上Azure应用服务上的Java Web Apps的快速入门:
https://docs.microsoft.com/en-us/azure/app-service/containers/quickstart-java
用于启用诊断日志:
https://docs.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs
此外,我们正在与Azure Monitor集成:
如果这仍然不适合您,请放心。欢迎与Azure一起打开支持案例,我们将为您提供帮助。这是首选选项,因为我们需要调查站点名称。
创建Azure支持请求:
与Google Cloud Logging等效的Azure是Azure Monitor Log,它结合了Log Analytics和Application Insights。
了解如何查询日志here
还可以在Azure上使用Azure门户上的日志流来查看实时日志https://microsoft.github.io/AzureTipsAndTricks/blog/tip30.html