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: RollingFileAppender thread safety
Prev Next
You are not authorized to post a reply.

Author Messages
just_a_w

03/02/2006 6:00 PM  

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

Ramesh Vijayaraghavan

03/02/2006 6:55 PM  

I also have the same question. Thanks for bringing this up. It was my
understanding that log4net was threadsafe. Please clarify.

Thanks,
Ramesh

Nicko Cadell

03/02/2006 7:56 PM  

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

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > RollingFileAppender thread safety



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