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.
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.
After some more googling, seems like this is a known issue:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=481184