c# – 如何在Azure for Net Core 2 App中启用应用程序日志?

我正在尝试在azure中启用应用程序日志.
我在azure的appService中运行了一个虚拟Net Core 2应用程序.

基本上我的目标是在日志流和应用程序日志文件中查看跟踪消息,但我没有找到正确的方法来执行此操作.

我发现阅读其他帖子的挑战之一是他们假设有一个Web配置.

Home Controller


  

Configuration In Azure


  

Startup.cs

解决方法:

你可以从这个blog得到答案.以下是博客的片段.

Setting up logging in an ASP.NET Core app doesn’t require much code. ASP.NET Core new project templates already setup some basic logging providers with this code in the Startup.Configure method:

loggerFactory.AddConsole(Configuration.GetSection("Logging")); 
loggerFactory.AddDebug();

enter image description here

相关文章

Microsoft云包括了Azure、PowerPlatform、Microsoft365、Git...
《WindowsAzurePlatform系列文章目录》 我们在使用AzureAPI...
微软免费使用一年的Azure虚拟机,默认提供了一个64G的磁盘,...
上篇请访问这里做一个能对标阿里云的前端APM工具(上)样本多...
一年一度的MicrosoftBuild终于来了,带来了非常非常多的新技...