The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.
| Author |
Messages |
|
Richard Collette
 |
| 08/02/2006 11:45 PM |
|
I thought at one point I had read somewhere, perhaps in the Log4J docs, that when the logging file was not present, it would use a default logging configuration going to the standard output or console.
I have a command line program and when the app.config file for it is not present, I don't see any console logging.
Advice?
Thanks,
Rich
|
|
|
|
|
Ron Grabowski
 |
| 08/03/2006 12:49 AM |
|
Apparently that's not the default behavior for log4net. You could do something like this to ensure a log4net writes to the Console:
XmlConfigurator.Configure();
if (LogManager.GetRepository().GetAppenders().Length == 0) { ConsoleAppender consoleAppender = new ConsoleAppender(); consoleAppender.Layout = new SimpleLayout(); BasicConfigurator.Configure(consoleAppender); }
|
|
|
|
|
Richard Collette
 |
| 08/03/2006 3:13 PM |
|
Ron,
Thanks a bunch. Sorry to even make you have to answer that. I recall reading about programmatic configuration. The repository lookup didn't click in my head though.
I add the code to my custom LogManager as a static method called
AddDefaultAppender() and it works great.
Also thanks for the reply on the Async logger. I've read the docs several times over the course of several months and my recollection just doesn't seem to be serving me well as I am finally using log4net in a project.
Thanks again,
Rich
|
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|