Kevin,

Setting the BufferSize to any value less than or equal to 1 should have
the same effect; to log synchronously.

Previously you said "but the database is flaky at best. Sometimes it
will work, sometimes it just won't log anything" later you seem to
indicate that *nothing* at all is logged to the database. What are the
symptoms you are seeing?

If the appender is failing then any errors will be logged via internal
debug:

http://logging.apache.org/log4net/release/faq.html#internalDebug

It is typically best to use the appSettings to enable internal debug:

<appSettings>
  <add key="log4net.Internal.Debug" value="true"/>

You will need to use dbgview from http://www.sysinternals.com to view
the debug.

If the database appender works for a bit, but then dies completely then
it may be loosing its database connection. There is a ReconnectOnError
property on the AdoNetAppender in log4net 1.2.9. Setting this to true
will cause the appender to try to reconnect if the connection is lost.

Nicko

> -----Original Message-----
> From: Kevin Williams [mailto:[EMAIL PROTECTED] 
> Sent: 01 April 2005 19:16
> To: Log4NET User
> Subject: Re: ADONetAppender losing logs
> 
> No, we're using 1.2.0.30714 and no NDC.
> 
> I found the answer.
> 
> We had the bufferSize value set to 0. Once we changed it to 
> 1, it started working again.
> 
> The remarks for that are quite misleading, IMHO. Here's the doc:
> 
> <quote>
>   The BufferSize option takes a positive integer representing 
> the maximum number of logging events to collect in a cyclic 
> buffer. When the BufferSize is reached, oldest events are 
> deleted as new events are added to the buffer. By default the 
> size of the cyclic buffer is 512 events.
> 
> If the BufferSize is set to a value less than or equal to 1 
> then no buffering will occur. The logging event will be 
> delivered synchronously (depending on the Lossy and Evaluator 
> properties). Otherwise the event will be buffered.
> </quote>
> 
> There was no error thrown when we used zero. The actual 
> behavior seems to be if the value is < 1, *nothing* will be 
> logged, if 1, it will be synchronous, and > 1 it will be 
> buffered. The statement about "less than or equal to 1" threw us off.
> 
> That was a tough one! ;) Thanks for the help,
> 
> Kevin
> 
> 
> 
> Sam Smoot wrote:
> > Are you using 1.2.9 and NDC? If so you might want to check 
> my thread 
> > about Missing LoggingEvents in the RemotingAppender.
> > 
> > If not, then I'm not sure if I can help, but what I did (may or may 
> > not be recommended) is add a Console.WriteLine (though you should 
> > probably use a Trace.WriteLine with a 
> TextWriterTraceListener) in the 
> > affected Appender's SendBuffer() (if a BufferingAppender) or Append 
> > (if it inherits directly from AppenderSkeleton) to write out the 
> > loggingEvent.RenderedMessage. This way you know for sure that it's 
> > actually recieving the events. Not sure how that bit of info might 
> > help, but maybe it's something.
> > 
> > Good Luck!
> 
> ----------
> Scanned for viruses by ClamAV
> 

Reply via email to