microsoft.practices.composite.logging.textlogger

Topics: Prism v2 - WPF 4
Jun 2, 2010 at 8:27 AM

I am confused about how to use this. I see in the documentation that I the code such as the following could be used:

  Logger.Write(message, category.ToString(), (int)priority); 

or

logger.Log("Creating Unity container", Category.Debug, Priority.Low);

But what's not clear to me is where does the logger write to? In the applications such as the quickstarts then I can't see where any output destination is set.

Thanks in advance

Developer
Jun 14, 2010 at 5:58 PM

Hi Richard,

Prism logs through a logger that implements ILoggerFacade. When the UnityBootstrapper creates a TextLogger (which is an implementation of ILoggerFacade), it provides no parameters to its constructor by default, so the TextLogger will log into the console output. You can access the console output in VS2010 by clicking View –> Output. You can find the TextLogger.cs file inside the Logging folder in the Composite.Desktop project.

If you would like to specify a TextLogger that writes to another place (i.e. a TextWriter), you could override the LoggerFacade property in your application’s Bootstrapper to return an instance of your custom logger. You can find more information about this in this article.

I hope you find this helpful.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi