log4net - why would the same MyLog.Debug line not work at one point of startup, but work at another
- by Greg
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));
.
.
.