G
Gerald Aden
I am using log4net 1.1 and am having a really hard time getting it to work
with a C# Windows service.
Here is the code I put in the Main:
StreamWriter writer = new StreamWriter("c:\\tmp\\log4net.log");
writer.AutoFlush = true;
Console.SetOut(writer);
log4net.helpers.LogLog.SetInternalDebugging(true);
log4net.Config.DOMConfigurator.ConfigureAndWatch(new
System.IO.FileInfo("log4net.config"));
_logger = LogManager.GetLogger(typeof(Service));
_logger.Debug("Running service.");
I don't get the log4net debug output or the logged message.
If I put the very same code into a console application I see both the
log4net debug output and the logged message. Has anyone used log4net in a
Windows service? Are there any special considerations?
Thanks for you time.
Gerald
with a C# Windows service.
Here is the code I put in the Main:
StreamWriter writer = new StreamWriter("c:\\tmp\\log4net.log");
writer.AutoFlush = true;
Console.SetOut(writer);
log4net.helpers.LogLog.SetInternalDebugging(true);
log4net.Config.DOMConfigurator.ConfigureAndWatch(new
System.IO.FileInfo("log4net.config"));
_logger = LogManager.GetLogger(typeof(Service));
_logger.Debug("Running service.");
I don't get the log4net debug output or the logged message.
If I put the very same code into a console application I see both the
log4net debug output and the logged message. Has anyone used log4net in a
Windows service? Are there any special considerations?
Thanks for you time.
Gerald