Log4Net in App object?
Posted
by David Veeneman
on Stack Overflow
See other posts from Stack Overflow
or by David Veeneman
Published on 2010-03-29T17:16:27Z
Indexed on
2010/03/29
17:23 UTC
Read the original article
Hit count: 405
I am getting started with Logging in a WPF desktop app, using Log4Net as the logging component. Here is my question: In a simple desktop app, is there any reason not to instantiate my logger as a property ov the App class (App.xaml.cs), like this?
public partial class App : Application
{
private static readonly ILog p_Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public ILog Logger
{
get { return p_Logger; }
}
#endregion
}
}
That would allow me to invoke the logger
© Stack Overflow or respective owner