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.
| 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. |
|
|
|
ActiveForums 3.7
|