部署Spring应用至Azure时遭遇112404退出代码1错误求助
Azure Spring Apps部署错误112404:日志获取与排查步骤
获取应用日志的方法
1. 使用Azure CLI
- 实时追踪应用运行日志:
az spring app logs --resource-group myResourceGroup --service myService --name myApp --follow - 下载完整历史日志文件到本地:
az spring app logs --resource-group myResourceGroup --service myService --name myApp --download - 快速查看最近的日志快照:
az spring app logs --resource-group myResourceGroup --service myService --name myApp
2. 通过Azure门户查看
- 登录Azure门户,定位到你的Azure Spring Apps实例
myService - 在左侧导航栏的监控分类下选择日志
- 使用内置查询或自定义Kusto语句筛选目标应用日志,例如:
AppPlatformLogsforSpring | where AppName == "myApp" | order by TimeGenerated desc | take 100
112404错误的重点排查方向
结合你配置的Azure MySQL数据库连接,优先检查以下内容:
- 网络防火墙:确认Azure MySQL服务器的防火墙规则已允许Azure Spring Apps服务的IP范围访问3306端口,或者开启了“允许Azure服务访问”选项
- SSL配置:Azure MySQL默认强制SSL连接,你当前的
useSSL=false可能导致连接失败,建议修改连接字符串为:spring.datasource.url=jdbc:mysql://shape-shop-db.mysql.database.azure.com:3306/shapeshop?useSSL=true&requireSSL=true&allowPublicKeyRetrieval=true&serverTimezone=UTC&useLegacyDatetimeCode=false - 用户格式与权限:Azure MySQL的用户名必须包含
@服务器名称后缀(例如yourusername@shape-shop-db),同时确认该用户拥有shapeshop数据库的读写权限 - 启动堆栈日志:通过上述日志获取方法查看应用启动时的完整报错堆栈,这是定位具体连接失败原因的关键
内容的提问来源于stack exchange,提问作者Oliver Watkins
相关产品推荐
相关产品推荐

