Shally,

I think this might be an issue with the fact that you stop logging for long 
periods of time. MySQL will kill unused connections after a set period of time. 
Some firewalls also kill idle connections after a period of time. Log4net 
should probably handle this, but for now you need a workaround. I am not sure 
what the fix is, but you could try any of the following;


*         add pooling=false to your connection string.

*         Try pooling=true (I know that this is the opposite of the above, I 
just think that using a connection pool will behave differently than not, so 
you should try both)

*         Set a timer in your application to log a ping type message to the 
database to keep the connection alive.

For more information, see,

http://www.opensubscriber.com/message/dot...@lists.mysql.com/2463293.html

There is also several MySQL bugs that sound like they may be related to your 
problem. Their workaround is to use pooling=false.

http://bugs.mysql.com/bug.php?id=6634

Also, is there more information in the internal logs so that we can pinpoint 
the location of the exception and hopefully provide a fix?

Good luck,

Rob

From: shally chong [mailto:shally.ch...@gmail.com]
Sent: Thursday, July 29, 2010 9:13 PM
To: Log4NET User
Subject: Re: ADONetAppender not logging

Hi Rob,

I notice that and I've included it in my configuration files.
I'm able to trap the mysql connection error with the internal logging file.
Exception: "an established connection was aborted by the software in your host 
machine" was thrown.

Regards,
Shally
On Thu, Jul 29, 2010 at 8:10 PM, Rob Prouse 
<r...@prouse.org<mailto:r...@prouse.org>> wrote:
Shally,

Looking at the code for AdoNetAppender, it will not log if the connection is 
lost and the reconnect fails. It will however output problems to its internal 
logging. I think your best option right now is to enable log4net's internal 
logging and see if it can help diagnose the problem.

See the section entitled "How do I enable log4net internal debugging?" near the 
bottom of the FAQ.

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

Rob Prouse

From: shally chong 
[mailto:shally.ch...@gmail.com<mailto:shally.ch...@gmail.com>]
Sent: Wednesday, July 28, 2010 11:44 PM

To: Log4NET User
Subject: Re: ADONetAppender not logging

Hi Rob,

Yes, this happened after server rebooted.
There is no windows update or other software updates, where DC only performing 
san storage (which requires server reboot).
Server guy has checked on the server side and did not find any different on the 
server after rebooted.
Previously I suspect the symantec/ live update caused the appender not working. 
But later on, the symantec and all it's related component is disabled, and 
still the appender not able to capture log after data loading process resume.

Regards,
Shally
On Thu, Jul 29, 2010 at 11:06 AM, Rob Prouse 
<r...@prouse.org<mailto:r...@prouse.org>> wrote:
Shally,

You say that this started happening after the server rebooted, correct?

Why was the server rebooted? Were there any Windows updates or other software 
updates that required the reboot? Since it was working before the reboot, we 
need to figure out what changed on the server to cause the failure. There may 
be a bug in the AdoNetAppender, but whatever changed on the server probably 
caused the bug to appear, so knowing what changed will help us track down the 
problem.

My first thoughts are an update to the .NET runtime, or to the MySQL server.

Rob Prouse

From: shally chong 
[mailto:shally.ch...@gmail.com<mailto:shally.ch...@gmail.com>]
Sent: Wednesday, July 28, 2010 9:29 PM
To: Log4NET User
Subject: Re: ADONetAppender not logging

Hi Rob,

Yes, I included the ReconnectOnError clause in my configuration and the log is 
obtained.
Any idea why the connection issue happened after the server reboot?

All these while, I did not face such problem.

Thanks,
Shally
On Wed, Jul 28, 2010 at 9:29 PM, Rob Prouse 
<rob.pro...@ivara.com<mailto:rob.pro...@ivara.com>> wrote:
Shally,

In your configuration for the AdoNetAppender, do you have ReconnectOnError set 
to true? It defaults to false and is not in the example configuration.

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

If not, add the following line to the appender and see if it helps.

<reconnectOnError value="true">

Hope this works for you,

Rob Prouse

From: shally chong 
[mailto:shally.ch...@gmail.com<mailto:shally.ch...@gmail.com>]
Sent: Wednesday, July 28, 2010 1:52 AM

To: log4net-user@logging.apache.org<mailto:log4net-user@logging.apache.org>
Subject: Fwd: ADONetAppender not logging


Hi,

I encountered a problem with ADONetAppender in production server after the DC 
perform restart for that server.
I have a .net c# window application where it will do some data loading into 
mysql server. After the data loading completed or any exception thrown during 
the data loading process, log4net will capture the error and store into mysql 
table as well. There will be no file loading from 2am - 6am, where during this 
time, there will be no log captured into mysql. Initially, after the file 
loaded into server at 6am, the log4net will start capturing log again. All 
these while, the log4net is able to capture log after the data loading process 
resume. But after the server being restarted, there is no more log captured 
into mysql after data loading process resume. And I have to manually restart 
the window services (the window application running as window services) daily 
to obtain the log again.
I've tried to modify the log4net to capture log into flat file, and it's 
working fine (all logs are captured after data loading process resume).

Please take note that the data loading process is working fine and data are 
inserted into mysql server correctly. The only not working is ADONetAppender is 
not capturing any logs after data loading process resume.

Please advise.

Thanks,
Shally

Reply via email to