Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: How Logger works in Prism 4.0 with MEF

$
0
0
Hi Vipul,

By default, Prism provides two loggers, one for Desktop applications and one for Silverlight , as it can seen in the following method of the Bootstrapper class:
protected virtual ILoggerFacade CreateLogger()
{
#if SILVERLIGHT
    return new EmptyLogger();
#else
    return new TextLogger();
#endif
}
The TextLogger used for Desktop writes a log message to a TextWriter , which by default is the Output console. In other words, the default logger behavior in a Desktop application is to print the messages to the console.
The EmptyLogger used for Silverlight is an empty logger with no implementation inside. In other words, this logger works as a place holder; hence, in Silverlight , the default logger does nothing at all.

The StockTrader RI provides a custom logger in its Desktop version that logs the messages through the Enterprise Library logger, but the Silverlight version uses the default logger; hence, it logs nothing .

Of course, this behavior can be changed in your application by overriding the CreateLogger method and returning the logger you wish to use instead of the default one.

I hope this helps you,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>