logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: RollingFileAppender thread safety
Date Thu, 02 Mar 2006 18:56:35 GMT
log4net is thread safe as it says in the FAQ. 

How log4net implements this with regards to individual appenders is not
really important. The docs for the RollingFileAppender are correct, the
members of the type are not thread safe, but this is not relevant unless
you want to programmatically access the appender directly from you code.
During logging the appender's base class (AppenderSkeleton) ensures
serialisation of appending of logging events.

You do not need to add your own locking code around calls like:

log.Info("message");

or

LogManager.GetLogger("foo");

Cheers,
Nicko

> -----Original Message-----
> From: just_a_w [mailto:just_a_w@yahoo.com] 
> Sent: 02 March 2006 17:01
> To: log4net-user@logging.apache.org
> Subject: RollingFileAppender thread safety
> 
> I need to use the RollingFileAppender in a multi-threaded 
> application.  The documentation is a little confusing when it 
> comes to thread safety.  The general FAQ says log4net is 
> thread-safe, but the appender's documentation says it's not.
> 
> Does anyone have any suggestions on how to use the 
> RollingFileAppender in a multi-threaded application?  Do I 
> need to modify and try to compile the code myself?  Or should 
> I do something drastic, like synchronize access to the logger?
> 
> Thanks.
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection 
> around http://mail.yahoo.com 
> 

Mime
View raw message