简体   繁体   English

Azure云部署-日志监控

[英]Azure Cloud Deployment - Log Monitoring

I have deployed my azure cloud service, but some of my instances stays unhealthy and keep recycling. 我已经部署了Azure云服务,但是我的某些实例仍然运行不正常,并不断回收。 I see ' Recycling (Role has encountered an error and has stopped. Sites were deployed. ' in status column for unhealthy instances. 我在状态列中看到“ 回收(角色遇到错误并且已停止。站点已部署。 ”),用于运行状况不佳的实例。

I enabled diagnostics for the role that does not work fine from configuration pane, but I don't know where to find logs of instance. 我为无法在配置窗格中正常工作的角色启用了诊断功能,但是我不知道在哪里可以找到实例日志。 Would you please tell me where to find? 您能告诉我在哪里找到吗?

Thanks, 谢谢,

Since this is a very popular issue, I'd like to offer an in-depth explanation here, thus some of this stuff you may already know: 由于这是一个非常受欢迎的问题,因此我想在此提供深入的解释,因此您可能已经知道其中一些内容:

There are a few popular scenarios when instances recycle: 实例回收有几种流行的方案:

1) Your app is missing dependent DLLs that do not allow IIS to start the app. 1)您的应用程序丢失了不允许IIS启动应用程序的依赖DLL。

2) Your WorkerRole.cs or WebRole.cs contains an unhandled exception 2)您的WorkerRole.cs或WebRole.cs包含未处理的异常

3) Your startup script contains errors 3)您的启动脚本包含错误

In order to see properly debug this, you need to make sure that: 为了正确地看到此调试,您需要确保:

1) Azure Diagnostics is enabled (this can be done in Visual Studio via a checkbox) on Role's properties. 1)在角色的属性上启用了Azure诊断(可以在Visual Studio中通过复选框完成)。 A storage account is required to host the diagnostic data. 需要一个存储帐户来托管诊断数据。 It can be the one you publish your solution through. 它可以是您通过其发布解决方案的一种。

2) Your WebRole.cs and/or WorkerRole.cs files contain proper try/catch with logging to some external storage. 2)您的WebRole.cs和/或WorkerRole.cs文件包含正确的try / catch,并记录到某些外部存储。 Logging to Trace seems simplest since Azure Diagnostics supports transferring the data out to external storage. 由于Azure Diagnostics支持将数据传输到外部存储,因此登录到跟踪似乎最简单。

3) You have configured Azure Diagnostics to actually transfer the right data to a diagnostic storage account. 3)您已将Azure诊断配置为实际将正确的数据传输到诊断存储帐户。 Best way is to throw in a diagnostics.wadcfg file along with your solution that contains the needed configuration to transfer EventViewer, Infrastructure and Trace logs. 最好的办法就是在抛出diagnostics.wadcfg文件与您的解决方案,其中包含所需的配置转移事件查看器,基础设施和跟踪日志一起。

4) Lastly, you need to configure monitoring Trace logs in the app.config of the application so that the Trace infrastructure actually listens to your Trace calls. 4)最后,您需要在应用程序的app.config中配置监视跟踪日志,以便跟踪基础结构实际侦听您的跟踪调用。

This link contains more in-depth info on all of the information above. 链接包含上述所有信息的更深入信息。

Finally, after having done all of this you can actually inspect the data in the diagnostic storage account to see what is wrong. 最后,完成所有这些操作后,您实际上可以检查诊断存储帐户中的数据以查看问题所在。 There are tools to help: 有可以帮助的工具:

1) RedGate/Cerebrata's Management Studio @ http://www.cerebrata.com/products/azure-management-studio/introduction (commercial product) 1)RedGate / Cerebrata的管理工作室@ http://www.cerebrata.com/products/azure-management-studio/introduction (商业产品)

2) Built-in tools into Visual Studio to help you explore contents of any storage account. 2)Visual Studio中的内置工具可帮助您浏览任何存储帐户的内容。 (You have to hunt and query the necessary WAD tables and containers manually with it, but it is free) (您必须使用它手动搜索和查询必要的WAD表和容器,但这是免费的)

3) AzureWatch @ http://www.paraleap.com (commercial product, geared toward active monitoring but lets you inspect most of the logs on-demand, disclaimer: I'm affiliated with this product) 3)AzureWatch @ http://www.paraleap.com (商用产品,旨在进行主动监视,但可让您按需检查大多数日志,免责声明:我与该产品关联)

Hope this helps 希望这可以帮助

Try using Azure Explorer or the like to explore the content of your blob storage. 尝试使用Azure资源管理器或类似工具浏览Blob存储的内容。 If diagnostics is enables as you said, then Azure persist the configuration in an Azure blob named wad-control-container . 如果如您所说启用了诊断功能,则Azure将配置保存在名为wad-control-container的Azure blob wad-control-container

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM