logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominik Psenner (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4NET-344) Make AdoNetAppender not to stuck application process
Date Thu, 31 May 2012 11:00:23 GMT

    [ https://issues.apache.org/jira/browse/LOG4NET-344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13286475#comment-13286475

Dominik Psenner commented on LOG4NET-344:

Hi Tom, thanks for your work. Just a few comments:

1] The AdoNetAppender is an implementation of the BufferingAppenderSkeleton and thus I would
assume that it already caches log messages and processes them asynchronously?

If I'm wrong with assumption 1]:

2] Trace.WriteLine is generally not used by log4net, but rather it uses its own implementation
namely LogLog. It can be used as LogLog.Debug("message")

3] Using Thread.Sleep() to reduce idle cpu cycles has several impacts. One is that log messages
are (worst case) cached for about a second before being processed. Since an application can
log a lot during that time this increases the probability of outofmemory exceptions. Further
it reduces the responsiveness of the logging facility. This ensures also that crash log messages
of uncatched exceptions will not make it into the persistent log database before the application
is terminated.

4] Last but not least I believe that it makes much more sense to keep the current AdoNetAppender
and extend it by creating a subclass named AsyncAdoNetAppender that adds the async functionality.
This allows to swap between the normal and the asynch appender.

Regarding 3] I would rather implement it with a ThreadPool workerthread that is started on
demand. Further I would implemented it using two queues that are hotswapped whenever there
is a event in the outer queue but none in the inner queue.

> Make AdoNetAppender not to stuck application process
> ----------------------------------------------------
>                 Key: LOG4NET-344
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-344
>             Project: Log4net
>          Issue Type: Improvement
>          Components: Appenders
>    Affects Versions: 1.2.10
>         Environment: Windows series
>            Reporter: Tom Tang
>              Labels: patch
>             Fix For: 3.5
>         Attachments: AdoNetAppender.cs
>   Original Estimate: 24h
>  Remaining Estimate: 24h
> The original AdoNetAppender could stuck application during log insertion.
> Because it use the sync method call to do database insert, once the DB is unavailable
or table was locked.
> I change the implementation that has an inner queue inside to store the messages, and
the other independent thread will be going to cunsuming the queue messages and do DB insertion.
> This implementation will not have any impact on application performance and much stable.
> Trade off: Once the queue max buffer was full, the later coming log message would be
ignored and gone forever. But log4net is not designed for guarantee delivery in purpose, right?
So it's not big deal at all. :)  

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message