From: Kevin G. <ke...@go...> - 2003-10-29 07:10:36
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 |>it causes problems somewhere else, it's more consistent to just return |>undef. Fixed and checked in ... | | But now it fails with the message : | | DBD::Pg::st execute failed: ERROR: pg_atoi: zero-length string at | /usr/local/lib/perl5/site_perl/5.8.0/Log/Log4perl/Appender/DBI.pm line 96. Alex, sorry for the delay. I'm not reproducing your problem. The following code runs fine, the two MDC columns end up with '' and 0 respectively. Does it work for you? Can you send sample code that produces your error? - ------------------------------------------------ use Log::Log4perl; use warnings; use strict; use DBI; my $pguser = 'postgres'; my $pwd = 'xxx'; my $dbh = DBI->connect('DBI:Pg:dbname=testdb',$pguser, $pwd, { RaiseError => 1, PrintError => 1 }); $dbh->do('DROP TABLE log4perltest'); my $stmt = <<EOL; ~ CREATE TABLE log4perltest ( ~ message char(128), ~ mdc_char char(16), ~ mdc_int int, ~ last_field char(1) ~ ) EOL $dbh->do($stmt); #creating a log statement where bind values 1,3,5 and 6 are #calculated from conversion specifiers and 2,4,7,8 are #calculated at runtime and fed to the $logger->whatever(...) #statement my $config = <<EOT; #log4j.category = WARN, DBAppndr, console log4j.category = WARN, DBAppndr log4j.appender.DBAppndr = Log::Log4perl::Appender::DBI log4j.appender.DBAppndr.datasource = DBI:Pg:dbname=testdb log4j.appender.DBAppndr.username = $pguser log4j.appender.DBAppndr.password = $pwd log4j.appender.DBAppndr.sql = \\ ~ insert into log4perltest \\ ~ (message, mdc_char, mdc_int,last_field) \\ ~ values (?,?,?,?) log4j.appender.DBAppndr.params.2 = %X{fubar} log4j.appender.DBAppndr.params.3 = %X{fubar} log4j.appender.DBAppndr.params.4 = x log4j.appender.DBAppndr.warp_message=0 #noop layout to pass it through log4j.appender.DBAppndr.layout = Log::Log4perl::Layout::NoopLayout EOT Log::Log4perl::init(\$config); #Log::Log4perl::MDC->put('fubar', 'xxx'); my $logger = Log::Log4perl->get_logger(); $logger->warn('warning message'); #xxx - -- - -- Happy Trails. . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510)525-5217 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org iD8DBQE/n2dy4g4/Tl71vUkRAtD3AJ9gYfx0NOJ5ZiJnzcMiyRWPi/zhLACdHglr mm3LaTcInZ8iNMxFhSt3qV0= =+EgU -----END PGP SIGNATURE----- |