By default, log4net is a synchronous logging mechanism, and I was wondering if there was a way to have asynchronous logging with log4net?
By default, log4net is a synchronous logging mechanism, and I was wondering if there
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you go to the log4net website, you can find some examples, at least one of which is an asynchronous Appender.
http://logging.apache.org/log4net/release/example-apps.html
Note that I have not used any of these examples, so I cannot vouch for them one way or the other.
Here is a link to the actual asynchronous appender from the log4net Examples area in their code repository:
http://svn.apache.org/viewvc/logging/log4net/trunk/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/AsyncAppender.cs?view=markup
I looked at it briefly, and it apparently acts as a wrapper around one or more “conventional” Appenders. On each logging request (containing one or more LoggingEvent objects), a ThreadPool thread is used to forward the LoggingEvents to the list of wrapped Appenders.