> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] 
> Sent: 16 February 2005 16:38
> To: [email protected]
> Subject: Default initialization of log4net
> 
> 
> Hi, 
> 
> recently i realized that there was some logging output via 
> log4net in my app before any initialization by one of the 
> configurators happened. This logging calls lead to no output 
> on any of the logging sinks at all and I started wondering 
> how log4net handles these calls internally. 

You should ensure that log4net is configured before you start to output
log messages. Any messages logged before log4net is configured will be
lost.

If you are configuring log4net programmatically then you should ensure
that the call to DOMConfigurator.Configure is made early during the
application startup sequence.

Alternatively you can configure log4net by specifying attributes on your
assembly. Log4net will look for these assembly attributes if it has not
been configured.

For details on the configuration attributes see
http://logging.apache.org/log4net/release/manual/configuration.html#HC-2
1657019
and see the examples in the log4net download at 
log4net-1.2.0-beta8\examples\net\1.0\Tutorials\ConsoleApp\cs

 
> In addition, I do not get any compiler warnings using log4net 
> whereas the log4j documentation explicitly mentions them if 
> no configuration happened and a logging call happens. 

The "no appenders" warning is only generated at runtime if log4net
internal debugging is enabled. To enable internal debugging see
http://logging.apache.org/log4net/release/manual/faq.html#internalDebug

Nicko


> 
> Any ideas? 
> 
> Regards,
> Alex
> 

Reply via email to