Author: timbo
Date: Wed Mar 21 07:59:05 2007
New Revision: 9291
Modified:
dbi/trunk/lib/DBI/Gofer/Execute.pm
dbi/trunk/lib/DBI/Gofer/Transport/mod_perl.pm
Log:
Add mechanism to log errors/warnings on the server side.
Modified: dbi/trunk/lib/DBI/Gofer/Execute.pm
==============================================================================
--- dbi/trunk/lib/DBI/Gofer/Execute.pm (original)
+++ dbi/trunk/lib/DBI/Gofer/Execute.pm Wed Mar 21 07:59:05 2007
@@ -18,6 +18,8 @@
our $VERSION = sprintf("0.%06d", q$Revision$ =~ /(\d+)/o);
+our $local_log = $ENV{DBI_GOFER_TRACE} || $ENV{DBI_GOFER_LOCAL_LOG};
+
__PACKAGE__->mk_accessors(qw(
check_connect
default_connect_dsn
@@ -153,8 +155,8 @@
%$attr,
# force some attributes the way we'd like them
- PrintWarn => 0,
- PrintError => 0,
+ PrintWarn => $local_log,
+ PrintError => $local_log,
# the configured default attributes, if any
%{ $self->forced_connect_attributes },
@@ -166,6 +168,7 @@
# because that causes subtle issues if in the same process (ie
transport=null)
dbi_go_execute_unique => __PACKAGE__,
});
+ $dbh->{ShowErrorStatement} = 1 if $local_log;
#$dbh->trace(0);
return $dbh;
}
@@ -207,7 +210,7 @@
my ($self, $request) = @_;
# should never throw an exception
my @warnings;
- local $SIG{__WARN__} = sub { push @warnings, @_ };
+ local $SIG{__WARN__} = sub { push @warnings, @_; warn @_ if $local_log };
DBI->trace_msg("-----> execute_request\n");
my $response = eval {
Modified: dbi/trunk/lib/DBI/Gofer/Transport/mod_perl.pm
==============================================================================
--- dbi/trunk/lib/DBI/Gofer/Transport/mod_perl.pm (original)
+++ dbi/trunk/lib/DBI/Gofer/Transport/mod_perl.pm Wed Mar 21 07:59:05 2007
@@ -70,6 +70,7 @@
};
if ($@) {
chomp $@;
+ warn $@;
$r->custom_response(SERVER_ERROR, "$@ version $VERSION (DBI
$DBI::VERSION) on $hostname");
return SERVER_ERROR;
}