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 Rama Ramakrishnan <ra...@ess-home.com> on 2006/06/22 02:09:12 UTC

Log4net Stops Logging

We have log4net using SQL Server as Appender for logging.  We ran load
tests using LoadRunner that logs using log4net through Business objects.
Two tests were done.  Results were these....

 

1.	In the first test logging stopped after 11 hours into the test
though the test continued for 24 hours.
2.	In the second test, we raised the size of the Logging database
to 5 GB to remove the database growth as the issue for log4net failure.
But, logging stopped 10 minutes into the test.  

 

Will this setting for the Appender in the Config file resolve the issue
if an Error from SQL Server led to a shutdown of the log4net.  

<param name="reconnectonerror" value="true" />

 

We did not have this parameter added in our config file in both tests.

 

Can someone answer these questions ?

 

1)       What are the possible causes for the log4net to shutdown and
stop logging for good during a load test or in a running application ?
What are the resolutions ?

2)       How does log4net log messages ?  Does each "Log" method call
from the application make a connection to the database and then write
the data ?  Or that the log messages are stored into a buffer and then
log4net does a bulk insert periodically ?  Is there a configuration
parameter related to buffering ?  

 

 

 

Rama Ramakrishnan 
Program Manager 
ESS - Providers of Software Suite(tm) for Environmental, Health & Safety
Management
Tel:(480) 346-5547, Cell: (480) 544-3645 
www.ess-home.com <http://www.ess-home.com/>  |
rama.ramakrishnan@ess-home.com <ma...@ess-home.com>  

 


Re: Log4net Stops Logging

Posted by Ron Grabowski <ro...@yahoo.com>.
It sounds like the first error was caused by a misconfigured database.

Here's the documentation for ReconnectOnError property:

http://tinyurl.com/qx7ks
http://logging.apache.org/log4net/release/sdk/log4net.Appender.AdoNetAppender.ReconnectOnError.html

Classes that extend AppenderSkeleton, i.e. AdoNetAppender, communicate
errors through their IErrorHandler. The default implementation is
OnlyOnceErrorHandler which records the error a single time to log4net's
internal logger. Perhaps you could run your tests again to see why the
AdoNetAppender stopped logging. Hint:

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

The AdoNetAppender checks for a non-null IDbConnection having its
ConnectionState property set to ConnectionState.Open before it will
attempt to log.

The AdoNetAppender buffers messages according to its BufferSize
property:

http://tinyurl.com/ce4rt
http://logging.apache.org/log4net/release/sdk/log4net.Appender.BufferingAppenderSkeleton.BufferSize.html

The buffer is flushed when it becomes full and/or when log4net is
shutting down. The current implementation doesn't have an internal
timer to auto-flush stale messages. The only way to flush stale
messages is to write some sort of timer at the application level.
Perhaps the BufferingAppenderSkeleton should support timed flushed?

The AdoNetAppender opens a connection to the database durings its
initialize and maintains that connection to the database. The
connection is not opened/closed after each log message.

--- Rama Ramakrishnan <ra...@ess-home.com> wrote:

> We have log4net using SQL Server as Appender for logging.  We ran
> load
> tests using LoadRunner that logs using log4net through Business
> objects.
> Two tests were done.  Results were these....
> 
>  
> 
> 1.	In the first test logging stopped after 11 hours into the test
> though the test continued for 24 hours.
> 2.	In the second test, we raised the size of the Logging database
> to 5 GB to remove the database growth as the issue for log4net
> failure.
> But, logging stopped 10 minutes into the test.  
> 
>  
> 
> Will this setting for the Appender in the Config file resolve the
> issue
> if an Error from SQL Server led to a shutdown of the log4net.  
> 
> <param name="reconnectonerror" value="true" />
> 
>  
> 
> We did not have this parameter added in our config file in both
> tests.
> 
>  
> 
> Can someone answer these questions ?
> 
>  
> 
> 1)       What are the possible causes for the log4net to shutdown and
> stop logging for good during a load test or in a running application
> ?
> What are the resolutions ?
> 
> 2)       How does log4net log messages ?  Does each "Log" method call
> from the application make a connection to the database and then write
> the data ?  Or that the log messages are stored into a buffer and
> then
> log4net does a bulk insert periodically ?  Is there a configuration
> parameter related to buffering ?