logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schall <mike.sch...@gmail.com>
Subject Re: asynchronous logging
Date Tue, 30 Jul 2013 16:11:39 GMT
You could try the BufferingForwardingAppender.  We use this while writing
to a file (we usually buffer up 512 events) and I believe we use
LogicalThreadContext for certain things we want logged.  You can setup an
evaluator so that the buffer is flushed at certain times other than size.
 We do so if the threshold is WARN or higher so it will be flushed on error
before the process dies.  I think the way it works is the message is
created when logged, but then added to a memory queue and sent to whatever
appenders you want when flushed.  Also, make sure you set lossy to false or
else messages will be thrown away rather than flushing the buffer when it
reaches the bufferSize.

    <appender name="BufferingForwardingAppender"
type="log4net.Appender.BufferingForwardingAppender" >
        <bufferSize value="512" />
        <lossy value="false" />
        <evaluator type="log4net.Core.LevelEvaluator">
            <threshold value="WARN"/>
        <appender-ref ref="RollingFile" />

Hope this helps


On Tue, Jul 30, 2013 at 10:31 AM, Farrington, Linda

>  We are trying to log asynchronously using an asynchronousadonetappender
> inherited from adonetappender.   Logging standard properties seems to work
> fine, but custom properties do not.  I understand that this is because the
> asynchronous appender is logging the messages on another thread and we're
> storing the custom properties in the logicalthreadcontext (tried
> threadcontext = as well to no avail).  My question is this:  If I cannot
> use the threadcontext when running asynchronously, how should I pass custom
> properties into log4net.  Has anyone else done this?  Can anyone provide
> any suggestions?****
> ** **
> Thanks in advance,****
> ** **
> Linda****
> ** **
> ** **
> ** **

View raw message