While trying to debug a problem when logging to a MySQL database with
Log4perl::Appender::DBI.  

The logic would just fail saying :

Uncaught exception from user code:
        Log4perl: DBI appender failed to reconnect to database after 3
attempts at ./CSV_gen_sync.pl line 385
 at /usr/lib/perl5/site_perl/5.8.8/Log/Log4perl/Appender/DBI.pm line 145

Log::Log4perl::Appender::DBI::query_execute('Log::Log4perl::Appender::DBI=HASH(0x9ea8bd4)',
 'DBI::st=HASH(0xa041400)', 'INFO', '2007/08/01 12:19:57', 'publish_files 
returned an exit_status of 0') called at 
/usr/lib/perl5/site_perl/5.8.8/Log/Log4perl/Appender/DBI.pm line 112

Log::Log4perl::Appender::DBI::log('Log::Log4perl::Appender::DBI=HASH(0x9ea8bd4)',
 'level', 1, 'name', 'DB', 'message', 'ARRAY(0xa03f93c)', 'log4p_category', 
'LogFile', ...) called at 
/usr/lib/perl5/site_perl/5.8.8/Log/Log4perl/Appender.pm line 189

Log::Log4perl::Appender::log('Log::Log4perl::Appender=HASH(0x9e96f20)',
'HASH(0xa03f9cc)', 'LogFile', 'INFO') called at (eval 52) line 41

Log::Log4perl::Logger::__ANON__('Log::Log4perl::Logger=HASH(0x9ad313c)',
'publish_files returned an exit_status of 0') called
at /usr/lib/perl5/site_perl/5.8.8/Log/Log4perl/Logger.pm line 771

Log::Log4perl::Logger::__ANON__('Log::Log4perl::Logger=HASH(0x9ad313c)',
'publish_files returned an exit_status of 0') called
at ./CSV_gen_sync.pl line 385
msoffen:msoffen:/usr0/html_files_www/smd/operations_reports/scripts 

I added an explicit print of the $DBI::errstr to the loop and got this: 
DBI::errstr: Duplicate entry 'INFO-2007/08/01 12:19:57' for key 1


It appears that it doesn't handle when a "real" DB error occurs and just
gives a generic failure to connect when it is actually connecting just
fine and having a problem storing the record.


Matt (aka SirGeek)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to