logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bejugam, Raghavendra \(GE Commercial Finance, NonGE\)" <raghavendra.beju...@ge.com>
Subject RE: Database Appender
Date Fri, 03 Feb 2006 16:12:02 GMT
Thanks Georg so the below code should work right?
 
override protected void SendBuffer(LoggingEvent[] events)

{

   if (m_reconnectOnError && (m_dbConnection == null ||

                   m_dbConnection.State != ConnectionState.Open))

   {

      LogLog.Debug("AdoNetAppender: Attempting to reconnect to database.

                  Current Connection State: " +

      ((m_dbConnection==null)?"<null>":m_dbConnection.State.ToString()) );

      InitializeDatabaseConnection();

      InitializeDatabaseCommand();

   }

 

Thanks & regards,

Raghu

-----Original Message-----
From: Georg Jansen [mailto:Georg.Jansen@FaktNet.com]
Sent: Friday, February 03, 2006 11:07 AM
To: 'Log4NET User'
Subject: RE: Database Appender



Raghu,

 

You set the parameter in the AdoNetAppender, like:

 

<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">       

   <reconnectonerror value="true" />

   +++ other AdoNetAppender parameters

      

 

But like I mentioned in my previous post, I couldn't see that it had any impact (at least
not from the tests I did), that's way I wrote the new version of the SendBuffer method.

 

Regards

Georg

 <http://www.l4ndash.com/> http://www.l4ndash.com Log4Net Dashboard / Log4Net Viewer


 

 

 

 

 


  _____  


From: Bejugam, Raghavendra (GE Commercial Finance, NonGE) [mailto:raghavendra.bejugam@ge.com]

Sent: 3. februar 2006 15:51
To: Log4NET User
Subject: RE: Database Appender

 

Any idea where to set this property 

ReconnectOnError to TRUE. If some one can provide me the sample syntax of config file it would
help.

Thanks,

Raghu

 

-----Original Message-----
From: Georg Jansen [mailto:Georg.Jansen@FaktNet.com]
Sent: Thursday, February 02, 2006 11:22 AM
To: 'Log4NET User'
Subject: RE: Database Appender

 

Simon,

 

I believe it was done some work on that in 1.2.9 (you are using an earlier version, right?)

 

I checked the source code for the AdoNetAppender, and in the SendBuffer it tries to do a reconnect
(if the parameter reconnectonerror is stated in the config).

 

override protected void SendBuffer(LoggingEvent[] events)

{

   if (m_reconnectOnError && (m_dbConnection == null ||

                   m_dbConnection.State != ConnectionState.Open))

   {

      LogLog.Debug("AdoNetAppender: Attempting to reconnect to database.

                  Current Connection State: " +

      ((m_dbConnection==null)?"<null>":m_dbConnection.State.ToString()) );

      InitializeDatabaseConnection();

      InitializeDatabaseCommand();

   }

 

 

Problem is that when I tested this (I restarted SQL server between two log statements), I
still gets an exception stating a "transport layer error".

 

I agree with you, Simon this is a problem with applications running for a long time for example
web applications. A simple solution would be to modify the adonetappender and try to do a
reconnect whenever the sql statement fails (I will give it a try).

 

 

Regards

Georg

http://www.l4ndash.com Log4Net Dashboard /  <http://www.l4ndash.com/> Log4Net Viewer


 

 

-----Original Message-----
From: Simon Wallis [mailto:mailing@wallis.ca] 
Sent: 2. februar 2006 16:31
To: Log4NET User
Subject: RE: Database Appender

 

Hi,

 

Has anyone come up with any creative ways to solve this problem of the database connection
hanging? The only thing I can think of is to have a process that "touches" the config file
on an hourly basis. Otherwise we have to remember to go around doing this manually on all
the servers whenever the database is rebooted or there's a temporary network failure.

 

I realize it would be a lot of work to add retry or failure semantics to the appender, but
whenever this is implemented, likely the most flexible approach would be to provide a number
of options via the config file.

 

Simon.

 

 

-----Original Message-----

Subject:    RE:  Database Appender

From:       "Nicko Cadell" <nicko () neoworks ! com>

Date:       2005-01-10 13:59:27

Message-ID: DDEB64C8619AC64DBC074208B046611C59C838 () kronos ! neoworks ! co ! uk

[Download message RAW]

 

Greg,

 

The AdoNetAppender does not reopen the connection if there is a failure.

The database connection is only opened during appender initialisation.

Error handling is a general issue for appenders but for the

AdoNetAppender there are a number of options. 

 

The current behaviour is for the appender to stop trying to write to the

database if the connection is closed. An alternative is for the appender

to try to reconnect to the database. The issues with reconnecting is

when to try and how many times. The appender could try to reconnect when

the buffered events are sent. If it fails to contact the server then the

connection will time out after some time. This is a synchronous call and

therefore any logging call in your application could randomly incur this

connection timeout penalty at any time. Is that acceptable behaviour for

the appender? If the appender cannot reconnect should it discard the

events that it cannot deliver? or should it store the events and

redeliver them when/if it does reconnect, if so how many event should it

store?

 

There are no easy solutions to these issues, and different behaviours

will be appropriate for different situations. The current AdoNetAppender

implementation does not attempt to support any retry or failure

semantics. This is one area where we will need to do some work in

future. If you have any suggestions we would be happy to discuss them. 

 

Nicko

 

> -----Original Message-----

> From: Ismay, Greg (CALBRIS) 

> [mailto:Greg.Ismay@comalco.riotinto.com.au] 

> Sent: 10 January 2005 04:15

> To: log4net-user@logging.apache.org

> Subject: Database Appender

> 

> 

> > howdy everyone...

> > 

> > im using the database ADONetAppender to log to a sql server 

> database and its all going peachy keen... for a while...

> > 

> > ive got the same app installed at 4 of our sites, with the 

> appender pointing back to a central database accessible over 

> the wan (i will probably end up using a local db at each 

> site, but a central db was my going in position, with a "lets 

> see how it goes before we decentralise" mentality). the wans 

> pretty fast and im only doing production logging (ie only 

> errors and fatals) this way.

> > 

> > basically, it works for a few days and sometimes up to a 

> week or so, before the logging just stops.

> > 

> > forcing the loggers to reinitialised (ie by "touch"ing the 

> log4net.config file) makes it all good again...

> > 

> > my question is this... are there any known problems with the db 

> > appender (or any appender) whereby a loss of connection (which can 

> > happen over the wan) over time could result in the above 

> state (eg... 

> > maybe running out of connections in the pool due to them gradually 

> > getting "stuck")

> > 

> > ill troll through the code in a few minutes, but just 

> thought id ask first.

> > 

> > thanks,

> > 

> > Greg Ismay

> > 

> > Specialist - Database Support (Automation Improvement) Comalco 

> > Aluminium Limited

> > 

> > Phone   :   +61 7 3867 1853

> > Fax    :   +61 7 3867 1855

> > Mobile  :   +61 4 1760 6429

> >

> 


Mime
View raw message