log4net - why would the same MyLog.Debug line not work at one point of startup, but work at another
Posted
by Greg
on Stack Overflow
See other posts from Stack Overflow
or by Greg
Published on 2010-03-11T03:44:02Z
Indexed on
2010/03/12
4:57 UTC
Read the original article
Hit count: 280
log4net
Hi,
During startup of my WinForms application I'm noting that there are a couple of points (before the MainForm renders) that do a "MyDataSet.GetInstance()". For the first one the MyLog.Debug line comes through in the VS2008 output window, but for a later one it does work and come through.
What could explain this? What settings could I check at debug time to see why an output line for a MyLog.Debug line doesn't come out in the output window?
namespace IntranetSync
{
public class MyDataSet
{
private static readonly ILog MyLog = LogManager.GetLogger(typeof(MyDataSet));
public static MyDataSet GetInstance()
{
MyLog.Debug("MyDataSet GetInstance() =====================================");
if (myDataSet == null)
{
myDataSet = new MyDataSet();
}
return myDataSet;
}
.
.
.
PS. What I have been doing re log4net repository initialization is putting the following line as a private variables in the classes I use logging - is this OK?
static class Program
{
private static readonly ILog MyLog = LogManager.GetLogger(typeof(MainForm));
.
.
.
public class Coordinator
{
private static readonly ILog MyLog = LogManager.GetLogger(typeof(MainForm));
.
.
.
public class MyDataSet
{
private static readonly ILog MyLog = LogManager.GetLogger(typeof(MyDataSet));
.
.
.
© Stack Overflow or respective owner