From: Brett R. <bre...@ma...> - 2003-09-22 03:06:24
|
Log4perl/Appender/DBI.pm (exists in v0.37) PROBLEM: When a database appender is used and preparedStatement is set, Appender/DBI.pm incorrectly warns that bufferSize has been specified when it has not. Happens also if bufferSize is set to 1, 0 or <blank> (guesses at sensible values), but that is reasonable. ANALASYS: Incorrect logic for checking if bufferSize has been set: Pasted from about line 33. -------------- * $self->{BUFFERSIZE} = $p{bufferSize} || 1;_ if ($p{usePreparedStmt}) { $self->{sth} = $self->create_statement($p{sql}); ** $self->{usePreparedStmt} = 1; }else{ $self->{layout} = Log::Log4perl::Layout::PatternLayout->new( {ConversionPattern => {value => $p{sql}}}); } *** if ($self->{usePreparedStmt} && $self->{BUFFERSIZE}){ warn "Log4perl: you've defined both usePreparedStmt and bufferSize \n". "in your appender '$p{name}'--\n". "I'm going to ignore bufferSize and just use a prepared stmt\n"; } return $self; } ------------- The warning at line *** will always print if usePreparedStmt has been set, because, in the || at line *, $self->{BUFFERSIZE} gets defaulted to 1 if it is undefined, zero or otherwise false. PATCH: Change *** to read If ($self->{usePreparedStmt} && $p{bufferSize}) { Or possibly unset BUFFERSIZE after line **. I have gone with the first change though because it fixes the problem without making other assumptions (that unsetting it will not break countless bits of code elsewhere). Regards, Brett -- -- __________________________________________________________ Sign-up for your own personalized E-mail at Mail.com http://www.mail.com/?sr=signup CareerBuilder.com has over 400,000 jobs. Be smarter about your job search http://corp.mail.com/careers |