From 9722bad470880d8cf163ec0325acbcc948ab64ae Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sun, 4 Dec 2005 23:40:55 +0000 Subject: [PATCH] fixed a bug in SQL::quote fixed the logging bug --- lib/WebGUI/ErrorHandler.pm | 9 ++++++--- lib/WebGUI/SQL.pm | 2 +- sbin/preload.perl | 7 +++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/WebGUI/ErrorHandler.pm b/lib/WebGUI/ErrorHandler.pm index d2967eaf9..aa59255ab 100644 --- a/lib/WebGUI/ErrorHandler.pm +++ b/lib/WebGUI/ErrorHandler.pm @@ -14,13 +14,14 @@ package WebGUI::ErrorHandler; =cut + +use strict; use FileHandle; use Log::Log4perl; -use strict; use WebGUI::Session; use Apache2::RequestUtil; -$Log::Log4perl::caller_depth = 1; +$Log::Log4perl::caller_depth++; =head1 NAME @@ -204,7 +205,9 @@ Returns a reference to the logger. =cut sub getLogger { - Log::Log4perl::init_once($WebGUI::Session::session{config}{webguiRoot}."/etc/log.conf"); + unless (Log::Log4perl->initialized()) { + Log::Log4perl->init( $WebGUI::Session::session{config}{webguiRoot}."/etc/log.conf" ); + } return Log::Log4perl->get_logger($WebGUI::Session::session{config}{configFile}); } diff --git a/lib/WebGUI/SQL.pm b/lib/WebGUI/SQL.pm index ef9da2a30..a284ee903 100644 --- a/lib/WebGUI/SQL.pm +++ b/lib/WebGUI/SQL.pm @@ -608,7 +608,7 @@ The database handler. Defaults to the WebGUI database handler. sub quote { my $value = shift; - return "''" unless $value; + return "''" unless defined $value; my $dbh = shift || _getDefaultDb(); return $dbh->quote($value); } diff --git a/sbin/preload.perl b/sbin/preload.perl index 1e3878a6d..001c2c6b3 100644 --- a/sbin/preload.perl +++ b/sbin/preload.perl @@ -11,6 +11,13 @@ use strict; print "\nStarting WebGUI ".$WebGUI::VERSION."\n"; +#---------------------------------------- +# Logger +#---------------------------------------- +use Log::Log4perl; +Log::Log4perl->init( $webguiRoot."/etc/log.conf" ); + + #---------------------------------------- # Database connectivity. #----------------------------------------