perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Field <...@binadopta.com>
Subject Apache error logging under mod_perl
Date Sat, 01 Apr 2006 22:09:21 GMT
Hi all,

I've noticed that under mod_perl any die() (or croak()) calls get rewritten 
with a timestamp, a loglevel flag, and escaped newlines before going to the 
error log.  For example, under CGI if I call die("hello") from a script called 
foo.cgi I get:

   hello at /home/zappos/zappos.com/serverroot/foo/foo.cgi line 8.

However, if I put the same exact script under mod_perl using Apache::Registry I 
get:

   [Sat Apr  1 13:25:56 2006] [error] hello at 
/usr/lib/perl5/site_perl/5.8.6/i586-linux-thread-multi/Apache/Registry.pm
   line 149\n

Has this always been the case?  For some reason I feel like this is a change, 
but I don't have any machines around with old mod_perl versions to try it out.

I am wondering if there is any way around this... or if it is due to some kind 
of configuration error on my part.  As it stands the error becomes pretty 
obfuscated.  And it causes problems if you use croak() from within a module, 
since it no longer respects the trailing newline you get confusing messages 
like:

   [Sat Apr  1 13:49:31 2006] [error] DBD::mysql::st execute failed:
   Unknown column 'foobar' in 'field list' at 
/usr/lib/perl5/site_perl/JF/Database.pm
   line 170.\n at /home/zappos/zappos.com/serverroot/noauth/foo.cgi line 10\n

I guess what I am wondering is if there is a way to prevent this rewriting?  I 
understand the benefit of the timestamp, but the change in newline (and tab) 
handling causes problems for formatting suscinct and clear error messages. 
I've tried using CORE::die() and it seems to have the same behavior.  I was 
able to get things back to normal with:

   $SIG{__DIE__} = sub { print STDERR @_; exit 1; };

At the top of my script.  I could put this in a startup file or something, but 
I am a bit wary of mucking with signal handlers (even perl internal ones) 
across the whole system.

Anyways, thanks for any input.  My system info is below.

Jonathan Field
zappos.com

PS - The searchable mailing list archive URL that goes out in the inital 
subscription email is no longer valid: http://mathforum.org/epigone/modperl
I tried some usenet searches but couldn't find anything.

---
System Info
---

Apache Startup:

[Sat Apr  1 14:03:40 2006] [notice] Apache/1.3.33 (Unix) mod_perl/1.29 
mod_ssl/2.8.24 OpenSSL/0.9.7e configured -- resuming normal operations


[jfield@dev1: .../JF]$ uname -a
Linux dev1 2.6.11.4-20a-smp #1 SMP Wed Mar 23 21:52:37 UTC 2005 i686 i686 i386 
GNU/Linux


[jfield@dev1: .../JF]$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
   Platform:
     osname=linux, osvers=2.6.9, archname=i586-linux-thread-multi
     uname='linux salieri 2.6.9 #1 smp fri jan 14 15:41:33 utc 2005 i686 athlon 
i386 gnulinux '
     config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl 
-Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Duseshrplib=true -Doptimize=-O2 
-march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -Wall -pipe'
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
     use64bitint=undef use64bitall=undef uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64',
     optimize='-O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -Wall 
-pipe',
     cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING 
-fno-strict-aliasing -pipe'
     ccversion='', gccversion='3.3.5 20050117 (prerelease) (SUSE Linux)', 
gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
     alignbytes=4, prototype=define
   Linker and Libraries:
     ld='cc', ldflags =''
     libpth=/lib /usr/lib /usr/local/lib
     libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
     libc=, so=so, useshrplib=true, libperl=libperl.so
     gnulibc_version='2.3.4'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E 
-Wl,-rpath,/usr/lib/perl5/5.8.6/i586-linux-thread-multi/CORE'
     cccdlflags='-fPIC', lddlflags='-shared'


Characteristics of this binary (from libperl):
   Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES 
PERL_IMPLICIT_CONTEXT
   Built under linux
   Compiled at Mar 19 2005 17:34:48
   @INC:
     /usr/lib/perl5/5.8.6/i586-linux-thread-multi
     /usr/lib/perl5/5.8.6
     /usr/lib/perl5/site_perl/5.8.6/i586-linux-thread-multi
     /usr/lib/perl5/site_perl/5.8.6
     /usr/lib/perl5/site_perl
     /usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi
     /usr/lib/perl5/vendor_perl/5.8.6
     /usr/lib/perl5/vendor_perl


Mime
View raw message