Menu

#6 Appender::DBI fails to give correct DBI Error message

open
nobody
None
5
2007-08-02
2007-08-02
No

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

It 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 handl that as a "real" DB error and just gives a generic failure to connect when it is actually connecting just fine and having a problem storing the record.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.