Saturday, February 04, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

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.

Subject: Default logging when config not present?
Prev Next
You are not authorized to post a reply.

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.
Forums > Log4Net > Log4Net Mail archive > Default logging when config not present?



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement