logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: Default logging when config not present?
Date Wed, 02 Aug 2006 22:49:45 GMT
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 <richard.collette@tritanka.com> wrote:

> 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
>    
> 


Mime
View raw message