Oct 15, 2010 at 7:57 PM

If you wanted to export your own custom logger, how would you hook in to override the default logger?  I can see in the applicationServices.StartService that the defaultLogger is being set.  Without changing the source code (ie using dll's only), how can you hook into the framework so that your custom logger will be imported and overrides the default logger?

Oct 15, 2010 at 8:02 PM

Simply export it in the main DLL you create. See the example with region management - this exports a custom logger that is also a view model and binds the activity to a list box. The service has a default that only lives long enough to satisfy imports, then if you've exported something yours will take over.

Oct 15, 2010 at 8:09 PM

Ok so as long as you declare a class that implements ILogger and exports it as part of the main silverlight application, that logger will be used and will be used for xaps that get downloaded dynamcially as well?

Oct 15, 2010 at 8:17 PM


Oct 15, 2010 at 8:24 PM

Ok, so the framework will now use the custom logger but how would my own apps invoke the logger instance that got imported in the StartService method so that anywhere in my app I would send a message/exception to the logger?

Oct 15, 2010 at 8:29 PM

I just have to import it in whatever viewmodel that I want to have log something correct?  Hopefully not to many questions, this framework looks really good so far and want to keep getting into more real world apps to see how thinks will all hook up.

Oct 15, 2010 at 8:31 PM

You simply import ILogger wherever you want to reference it.

Oct 15, 2010 at 8:32 PM

Basically, if you export one, we leave it, so anywhere you import will get it.

If you don't export one, we make one, then configure the container to explicitly be aware of it, so again, anywhere you import it will grab the one we provide.

So - you export one? Great, all other imports will be yours. Don't export it? No problem, we'll pass one along for you.

Oct 15, 2010 at 8:33 PM

This is very nice.  Also, any viewmodels that inherit from the framework viewmodel, the logger is already imported and available as part of the baseViewModel :)