如何查看在Azure平台上部署的Azure工作角色上的跟踪日志 [英] How to see trace logs on Azure worker role deployed on Azure platform

查看:96
本文介绍了如何查看在Azure平台上部署的Azure工作角色上的跟踪日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Azure云服务模板创建了一个辅助角色,并添加了一些跟踪日志.

我可以在Visual Studio的输出窗口中看到跟踪日志.

然后,我在Azure门户上进行了部署,并能够看到Worker角色正在运行的状态.

现在,我找不到在Azure门户上看到相同跟踪的任何选项.

是否可以查看门户上的跟踪日志?

解决方案

如果您使用的是Trace,则可以让Azure移动跟踪日志自动为您提供Azure诊断存储帐户.您只需要在自己的计算机中配置诊断程序 角色(Web或辅助角色)以传输日志.

要在您的代码中添加跟踪语句:

  1. 打开应用程序的源文件.例如,用于工作角色或Web角色的.cs文件.
  2. 在要捕获有关状态信息的位置添加Trace语句应用.您可以使用多种方法来格式化Trace语句的输出. 有关更多信息,请参见如何:将跟踪语句添加到应用程序代码中.
  3. 保存源文件.

有关详细信息,请参见以下链接:

--------------- -------------------------------------------------- ------------------------------

如果此答案有帮助,请单击标记为答案"或向上" -投票".要提供有关您的论坛体验的其他反馈,请单击 在这里 >

I created a worker role using Azure cloud service template and just added some trace logs.

I could see the trace logs on output window of Visual studio.

Then I deployed on Azure portal and was able to see the status of the Worker role running.

Now, I am not finding any option to see the same traces on Azure portal.

Is there any option to view the trace logs on portal?

解决方案

If you're using Trace, you can have Azure move the trace logs for you automatically to Azure diagnostics storage account. You'll just need to configure Diagnostics in your Role (Web or Worker Roles) to transfer Logs.

To add trace statement to your code:

  1. Open a source file for your application. For example, the .cs file for the worker role or web role.
  2. Add the following using statement if it has not already been added: using System.Diagnostics;
  3. Add Trace statements where you want to capture information about the state of your application. You can use a variety of methods to format the output of the Trace statement. For more information, see How to: Add Trace Statements to Application Code.
  4. Save the source file.

For more details, you may refer the below links:

https://docs.microsoft.com/en-us/azure/cloud-services/cloud-services-dotnet-diagnostics-trace-flow

https://docs.microsoft.com/en-us/azure/vs-azure-tools-diagnostics-for-cloud-services-and-virtual-machines#turn-on-diagnostics-in-cloud-service-projects-before-you-deploy-them

-----------------------------------------------------------------------------------------------

If this answer was helpful, click "Mark as Answer" or "Up-Vote". To provide additional feedback on your forum experience, click here


这篇关于如何查看在Azure平台上部署的Azure工作角色上的跟踪日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆