My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
ExceptionHandling  
Exception logging and worker restart
Updated Mar 16, 2011 by joannes.vermorel

The problem

At this date, there is no logging system (*) provided with Windows Azure. In addition, each uncaught exception triggers a worker restart at the VM level which takes about 2min.

(*) It's not entirely true, but the default logging system shipped is so crude that it is less than useful for practical situations.

The solution: Built-in logging

Lokad.Cloud comes with a built-in logger directly inspired by elmah. The logger is directly available as a CloudService property:

public abstract class CloudService
{
  public ILog Log 
  { 
    get { /* snipped */ } 
  }
}

The logger can be used to log info or errors. The logs can then be browsed from the Error Logs panel in the web administration console.

Technical note: we are considering adapting elmah in the future.

Exception logging and worker restart

Any uncaught exception thrown by the client app built on top of Lokad.Cloud gets automatically logged. After logging the exception, the worker is automatically restarted.

It must be noted that Lokad.Cloud runs the client app in a separate AppDomain. Thus, in case of uncaught exception, the client AppDomain is simply unloaded and reloaded. Bottom-line result: restarting the worker after a failure takes about 2s - compared 2min for a restart at the VM level.

It is possible for a CloudService to force a worker restart by throwing a TriggerRestartException (part of Lokad.Cloud).


Sign in to add a comment
Powered by Google Project Hosting