RoleManager.WriteToLog in Azure Development Fabric

不想你离开。 提交于 2019-12-11 17:04:23

问题


I'm just taking my first steps with Azure and the first thing I see in the development fabric is a bunch of console style logging windows. So I figure that's going to be handy and decide to figure out how to write stuff there and stumble upon this:

Microsoft.ServiceHosting.ServiceRuntime.RoleManager.WriteToLog("Information", "Message);

Cool, except I don't see anything in the log. Saw a post somewhere that after first install you need to reboot before this will work, so I tried that but still nothing.

I've checked with a break point that the code is executing and I've checked the logging level in the dev fabric.

Is this supposed to work, or am I completely off base?


Just to add some more information about what I'm doing:

  • Started with VS08's new project wizard for Cloud Service
  • In the wizard added a single ASP.NET Web Role project
  • In the Page_Load method in Default.aspx.cs I added the WriteToLog line shown above
  • Ran the project and in the dev fabric UI, drilled down the tree to web role instance "0"
  • Nothing in the displayed log except some role instance start up messages followed by a bunch of health status messages.
  • Tried reloading the page a few times, the breakpoint in Page_Load gets hit but nothing in the log.
  • Logging Level is set to information, and the other events are level information so I don't think it's a logging level issue.

回答1:


Logging level is the common gotcha, but there's also a delay before logs start showing up in the dev fabric, so make sure that this message is getting logged at least 10 seconds after the application starts.




回答2:


After some more googling, seems like this is a known issue:

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=481184



来源:https://stackoverflow.com/questions/1360767/rolemanager-writetolog-in-azure-development-fabric

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!