From: Robert J. <yad...@sn...> - 2009-02-26 12:55:13
|
Mike Schilli m-at-perlmeister.com |log4perl_sourceforge| wrote: > On Tue, 24 Feb 2009, Robert Jacobson wrote: > >> Those are mostly the expected values from the Layout I specified >> (time, log level, script name, hostname, PID, ?????, message). > > That's peculiar ... what does your layout look like? > > It's hard to diagnose the problem without code that reproduces it, can > you post a stripped-down version of your appender? I attached the appender code (full version), a configuration file, and a test program in the first post I made. I could understand how you'd want a stripped-down version of the appender :) I wasn't sure what would happen if I stripped it down -- but it turns out that even with only two subs defined (new and post_init), the appender exhibits the problem of persistent DB connections. The stripped-down version of DBI_Buffer is attached, along with the test program and config. (again, modify the database config to match your database). For the error "called 7 bind variables when 6 are needed...", I added a little debug to DBI.pm (while still using my subclassed appender). With the "l4_depends_on" code in the stripped-down DBI_Buffer.pm i.e.: if ($self->{errorappender}) { # Pass back the appender to be synchronized as a dependency # to the configuration file parser push @{$p{l4p_depends_on}}, $self->{errorappender}; push @{$p{l4p_post_config_subs}}, sub { $self->post_init() }; } Then $p in DBI::calculate_bind_values shows the message as an array, e.g.: calculate_bind_values Dump p: $VAR1 = { 'log4p_level' => 'INFO', 'log4p_category' => 'ANS.component', 'level' => 1, 'name' => 'Database', 'message' => [ 'Starting ....' ] }; I thought the message array ref would get compressed to a scalar string value, but that doesn't seem to be the case. I tried messing with the warp_message values of the Logfile and Database appenders, but I still end up with 7 bind values no matter what warp_message setting I use. -- Rob |