RoleManager.WriteToLog in Azure Development Fabric

2019-08-27 22:59发布

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.

2条回答
仙女界的扛把子
2楼-- · 2019-08-27 23:40

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.

查看更多
Rolldiameter
3楼-- · 2019-08-27 23:43
登录 后发表回答