You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Kevin Williams <ke...@bantamtech.com> on 2005/04/01 01:41:12 UTC

ADONetAppender losing logs

Hello all,

We have log4net in a production system using the RollingFileAppender for 
all messages, ADONetAppender for INFO and above, and SMTPAppender for 
ERROR and above for unhandled exceptions.

We're logging web service calls with timing metrics at the INFO level, 
so we expect to see logs for that in the database (Oracle).

We're seeing the correct information in the log file and over e-mail, 
but the database is flaky at best. Sometimes it will work, sometimes it 
just won't log anything. Setting <log4net debug="true"> doesn't seem to 
have had any effect. I even added a FileAppender with no threshold on 
it, just to make sure the debug info would be logged.

Has anyone else ever had this problem? I'm surprised we don't have any 
exceptions being thrown - the logs just vanish in cyberspace. Sorry if 
this is a stupid question or has been beaten to death.

Kevin

----------
Scanned for viruses by ClamAV

Re: ADONetAppender losing logs

Posted by Kevin Williams <ke...@bantamtech.com>.
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

Re: ADONetAppender losing logs

Posted by Sam Smoot <ss...@gmail.com>.
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!