【Azure 应用服务】当在Azure App Service的门户上 Log Stream 日志无输出,需要如何操作让其输出Application Logs呢?
问题描述
在Azure App Service的门户上 Log Stream 日志无输出,需要如何操作让其输出Application Logs呢?
如下图所示:
问题解答
请注意,上图中提示说:Application logs are switched off. You can turn them on using the App Service Logs Settings. 应用日志关闭,可以通过App Service Logs 页面来设置开启。
App Service ---> App Service Logs : 针对Application Logging 和 Web Server Logging 为On,最后点击页面上的Save按钮。
保存后,返回Log Stream页面,就可以实时查看App Service中的输出日志:
附录1:.NET API下的日志输出示例
using Microsoft.AspNetCore.Mvc; namespace myapi01.Controllers { [ApiController] [Route("[controller]")] public class AASController : ControllerBase { private readonly ILogger<AASController> _logger; public AASController(ILogger<AASController> logger) { _logger = logger; } [HttpGet] [Route("/log")] public string GetLog() { _logger.LogInformation("this is test massge informaiton level!!!!!!!"); _logger.LogWarning("this is test massge Warning level!!!!!!!"); _logger.LogError("this is test massge Error level!!!!!!!"); _logger.LogDebug("this is test massge debug level!!!!!!!"); _logger.LogCritical("this is test massge Critical level!!!!!!!"); _logger.LogTrace("this is test massge Trace level!!!!!!!"); return "Outpu logs - today 2023-04-18 03:56"; } [HttpGet] [Route("/exp")] public string Getexception() { throw new Exception("thsi is my custome exception today."); } } }
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2022-04-18 【Azure Fabric Service】怎样关闭 Azure Service Fabric?