perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Field <>
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/ line 8.

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

   [Sat Apr  1 13:25:56 2006] [error] hello at 
   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 

   [Sat Apr  1 13:49:31 2006] [error] DBD::mysql::st execute failed:
   Unknown column 'foobar' in 'field list' at 
   line 170.\n at /home/zappos/ 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

PS - The searchable mailing list archive URL that goes out in the inital 
subscription email is no longer valid:
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 #1 SMP Wed Mar 23 21:52:37 UTC 2005 i686 i686 i386 

[jfield@dev1: .../JF]$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
     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 
     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
     use64bitint=undef use64bitall=undef uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
-DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE 
     optimize='-O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -Wall 
-fno-strict-aliasing -pipe'
     ccversion='', gccversion='3.3.5 20050117 (prerelease) (SUSE Linux)', 
     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', 
     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,
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E 
     cccdlflags='-fPIC', lddlflags='-shared'

Characteristics of this binary (from libperl):
   Built under linux
   Compiled at Mar 19 2005 17:34:48

View raw message