Re: Apache Error Log Format

[prev] [thread] [next] [Date index for 2005/06/01]

From: Arshavir Grigorian
Subject: Re: Apache Error Log Format
Date: 17:48 on 01 Jun 2005
Daniel B. Hemmerich wrote:
> Thanks for the good idea... it is a direction worth investigating 
> further. Until someone offers a potentially better solution, I will play 
> around with this and hopefully in the next few days report back on my 
> results!
> 
> Thanks again,
> Daniel
> 
> Jonathan Vanasco wrote:
> 
>>
>> I really have no idea, but no one has chimed up on this, so I'll try 
>> to help (and maybe someone here can clear up my misconceptions)
>>
>> MP writes to STDERR, BUT things can get weird because of the way 
>> apache2 handles error messages --
>>
>> I could have this wrong, but mp errors and perl errors seem to go to 
>> the main apache error log ( on my system that's 
>> /usr/local/apache2/logs/error_log ).
>>
>> When i specify a separate errorlog for a vhost, STDERR is directed there
>>
>> I  don't know how to accomplish what you want , but I think I can help 
>> point you in a direction:
>>
>> When I saw this post, i remembered how the default OSX apache2/mp had 
>> a specific compile time option that didn't 'print' to apache -- i 
>> think one had to call $r->print() instead of print, because of how 
>> STDOUT was directed.
>>     The 'fix' was either to recompile apache, or set up a perl handler 
>> to tie STDOUT to Apache
>>
>> I'm found a post about this on google (not sure if its the 'right' 
>> one, i came across this 2 years ago):
>>     http://www.macosxhints.com/article.php?story=20031129120521712
>>         PerlHeaderParserHandler "sub { tie *STDOUT, 'Apache' unless 
>> tied *STDOUT; }"
>>
>> Based on that, i *think* that you could probably write a handler that 
>> intercepts STDERR, rewrites it to your specifications, and 
>> ties/redirects it somewhere
>>
>> But , two things worry me about this:
>>   a_ i'm not quite sure of the mechanics of the multiple log files 
>> that apache can generate, and which one(s) would have what you want -- 
>> or how to intercept them
>>   b_ i'm quite sure that there is a better way, that probably uses 
>> more of the apache configuration powers of mod_perl, and not a crazy 
>> hack like this
>>
>> Again, I dont have much of an idea on this -- but no one else chimed 
>> up and that tie to STDOUT really popped out in my memories when I read 
>> this post.
>>
>>
>>
>> On May 31, 2005, at 8:36 AM, Daniel B. Hemmerich wrote:
>>
>>> Hello all...
>>>
>>> When a misconfiguration occurs, we receive a new line in the apache 
>>> error logs that is not in the standard error log format (I assume 
>>> since MP is writing to STDERR). Short of changing all of our scripts 
>>> to properly log, is there a quicker method to accomplish the 
>>> following change:
>>>
>>> Change this:
>>>
>>> Can't locate /www/path/goes/here//config.pl in @INC (@INC contains: 
>>> /usr/local/lib/perl5/5.8.4/i686-linux /usr/local/lib/perl5/5.8.4 
>>> /usr/local/lib/perl5/site_perl/5.8.4/i686-linux 
>>> /usr/local/lib/perl5/site_perl/5.8.4 /usr/local/lib/perl5/site_perl 
>>> .) at /www/example.com/cgi-bin/example.cgi line 64.
>>>
>>> To this:
>>>
>>> [Thu May 19 08:47:41 2005] [error] [MODULENAME Can't locate 
>>> /www/path/goes/here//config.pl in @INC (@INC contains: 
>>> /usr/local/lib/perl5/5.8.4/i686-linux /usr/local/lib/perl5/5.8.4 
>>> /usr/local/lib/perl5/site_perl/5.8.4/i686-linux 
>>> /usr/local/lib/perl5/site_perl/5.8.4 /usr/local/lib/perl5/site_perl 
>>> .) at /www/example.com/cgi-bin/example.cgi line 64.
>>>
>>> Thanks in advance!
>>
>>
>>

Maybe it has to do with this:

http://perl.apache.org/docs/2.0/user/install/install.html#Apache

-DAP_UNSAFE_ERROR_LOG_UNESCAPED



        -- 
        Arshavir Grigorian
Systems Administrator/Engineer

Apache Error Log Format
Daniel B. Hemmerich 12:36 on 31 May 2005

Re: Apache Error Log Format
Jonathan Vanasco 20:51 on 31 May 2005

Re: Apache Error Log Format
Daniel B. Hemmerich 21:19 on 31 May 2005

Re: Apache Error Log Format
Arshavir Grigorian 17:48 on 01 Jun 2005

Re: Apache Error Log Format
Daniel B. Hemmerich 20:52 on 01 Jun 2005

Re: Apache Error Log Format
Stas Bekman 11:44 on 04 Jun 2005

Generated at 20:12 on 05 Jun 2005 by mariachi v0.52