Thursday, 6 November 2008

Azure: Writing to Logs

So I've been messing around with logging of data when running web applications in the Fabric.

So it is fairly easy to write a message to the log

RoleManager.WriteToLog("Verbose", "I am verbose");

This fairly obviously writes a verbose message to the log.

Types of Logs

The WriteToLog method supports 5 types of logging.

  • Critical

  • Error

  • Warning

  • Information

  • Verbose

I think I would have preferred however if an enum was used rather than passing it through as a string.

If you pass an invalid log name, then it raise an exception

Default Level of Logging

The default level of logging for a service seems to be Information.  This means that all types of logging messages will be logged except Verbose.

If you want to switch your level of logging to include Verbose, then within the Development Fabric you can just set the level of logging via Tools -> Logging Level Menu

Screenshot of Logs in the Development Fabric


Critical Logs

It turns out that messages written to the critical logs will be notified to you via your preferred notification method.

At the moment my notification method is messenger + email.  I must try that out later

No comments: