From: Kevin G. <ke...@go...> - 2003-10-22 11:27:46
|
> 1) I'd like to have optional parameters to logging statements. The > documentation says that if it lacks a parameter, it will just be > replaced by the undef value. But I got a different behaviour. > > log4perl.appender.dbLog.sql=INSERT INTO log (category, level, customer, message, details) VALUES (?, ?, ?, ?, ?) > log4perl.appender.dbLog.params.1 = %c > log4perl.appender.dbLog.params.2 = %p > log4perl.appender.dbLog.params.3 = %X{customer} > > # execute called with 4 bind variables, 5 needed at > # /usr/local/lib/perl5/site_perl/5.8.0/Log/Log4perl/Appender/DBI.pm line 96. > > $logger->error( > "Some other thing wrong." > ); That's a plain old bug you found. The way it's coded now, missing parameters will be replaced by undef ONLY if they come before the highest declared parameter number in the config, i.e. if you changed the config file to look like this you should get what you want. log4perl.appender.dbLog.sql=INSERT INTO log (category, level, message, details, customer) VALUES (?, ?, ?, ?, ?) log4perl.appender.dbLog.params.1 = %c log4perl.appender.dbLog.params.2 = %p log4perl.appender.dbLog.params.5 = %X{customer} A bad assumption on my part in the code. Fixing it is going to take some thought, so try that workaround rather than waiting for me to patch. On another note, does the test t/034DBI.t pass with your version of the postgres dbd? I noticed it fails with mine, it looks like there was a bug in the dbd that was only fixed in March (http://gborg.postgresql.org/pipermail/dbdpg-general/2003-March/000038.html). -- Happy Trails. . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510)525-5217 |