Bug 14090 - mod_cgid always writes to main server error log
Summary: mod_cgid always writes to main server error log
Status: RESOLVED LATER
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_cgid (show other bugs)
Version: 2.0.43
Hardware: Other Linux
: P3 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
: 15926 22672 35708 38398 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-10-30 14:04 UTC by Sergey Polyakov
Modified: 2017-03-17 18:20 UTC (History)
5 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Polyakov 2002-10-30 14:04:44 UTC
I'm in the process of upgrading from Apache 1.3.27 to Apache 2.0.43 
with 'worker' scheme.  I've
noticed that if I specify a virtual host ErrorLog location, STDERR from my
Perl CGI programs is still directed to the default server error log file.
The key parts of my httpd.conf appear as follows:

ServerRoot "/opt/apache2"

ErrorLog logs/error_log

NameVirtualHost *

<VirtualHost *>
DocumentRoot /local/httpd/mmitest/htdocs
ServerName mmitest.mmi.frco.com
ServerAlias mmitest
ErrorLog /local/httpd/mmitest/logs/error_log
TransferLog /local/httpd/mmitest/logs/access_log
ScriptAlias /cgi-bin/ /local/httpd/mmitest/cgi-bin/
</VirtualHost>

If I access a cgi program on this virtual host that writes to STDERR, it
writes to the server default ErrorLog location
(/opt/apache2/logs/error_log), not the ErrorLog location specified in the
virtual host (/local/httpd/mmitest/logs/error_log).
Comment 1 Jeff Trawick 2003-02-12 19:09:28 UTC
Can you verify that you're using mod_cgid instead of mod_cgi?

It works for me with mod_cgi, fails as you describe for me with mod_cgid.

Thanks,

Jeff
Comment 2 Jeff Trawick 2003-10-10 13:10:34 UTC
*** Bug 22672 has been marked as a duplicate of this bug. ***
Comment 3 Neo 2003-11-17 07:53:08 UTC
Bug still exist in 2.4.08
Comment 4 Neo 2003-11-17 07:54:17 UTC
Typo earlier on 2.0.48
Comment 5 Paul Querna 2004-09-17 04:08:41 UTC
*** Bug 15926 has been marked as a duplicate of this bug. ***
Comment 6 Phil Dietz 2004-09-17 06:28:19 UTC
What ??

I dont know how my bug report got lumped into this one.

My report is about the contents of the ScriptLog....

If a cgi app emits to stderr....
aka 


puts stderr "hello world"


Mod_cgi's ScriptLog will catch that informations....
while mod_cgisd's ScriptLog will not!!!!

Please fix!
Comment 7 Paul Querna 2004-09-17 06:39:57 UTC
To fix, they would both involve a refactoring of how mod_cgid does its loging.
That is why I marked them as a duplicate.
Comment 8 Jeff Trawick 2005-07-12 21:44:23 UTC
*** Bug 35708 has been marked as a duplicate of this bug. ***
Comment 9 Ruediger Pluem 2006-02-28 21:15:33 UTC
*** Bug 38398 has been marked as a duplicate of this bug. ***
Comment 10 David H. Gutteridge 2006-03-01 19:42:22 UTC
Since comments #6 and #7 indicate general mod_cgid logging issues are being
recorded here, I have another one to add.  When writing to stderr and mod_cgi is
used, the error log includes the usual information specified for the output
format (e.g. time stamp, client IP address) before the output from the script,
but when doing the same through mod_cgid, it does not seem to include this
information, meaning the CGI stderr output is without a specific identifying
context.  (This is with 2.0.55 on NetBSD 3.0/i386, mod_cgi with the prefork MPM
and mod_cgid with the worker MPM.)

So with mod_cgi, we get (first row included for visual context):

[Tue Feb 28 05:34:28 2006] [error] [client 192.168.1.5] mod_mime_magic: can't
read `/usr/pkg/libexec/cgi-bin/errtest.cgi'
[Tue Feb 28 05:34:28 2006] [error] [client 192.168.1.5] This should be going to
the Apache error log.

And with mod_cgid, we get:

[Tue Feb 28 06:09:36 2006] [error] [client 192.168.1.5] mod_mime_magic: can't
read `/usr/pkg/libexec/cgi-bin/errtest.cgi'
This should be going to the Apache error log.

Comment 11 David H. Gutteridge 2006-03-06 21:31:31 UTC
(Addendum to comment #10:) I've looked at the code for mod_cgid and see that the
Apache developers are aware of this, mod_cgid apparently doesn't have the
requisite information available to it.
Comment 12 Artem Kuchin 2007-10-16 10:56:21 UTC
I have just tested it on 2.2.6 and this bug is still present. Why is it marked
as RESOLVED?


Comment 13 Franz-Josef Huecker 2015-05-10 08:03:36 UTC
(In reply to Artem Kuchin from comment #12)
> I have just tested it on 2.2.6 and this bug is still present. Why is it
> marked
> as RESOLVED?

I've just tested it with 2.4.7 and the bug is still present. 

But there are a simple way to fix it: disable mpm_event, enable cgi, enable mpm_event, and it works.
Comment 14 wick 2017-03-17 15:05:53 UTC
(In reply to Franz-Josef Huecker from comment #13)
> 
> I've just tested it with 2.4.7 and the bug is still present. 
> 
> But there are a simple way to fix it: disable mpm_event, enable cgi, enable
> mpm_event, and it works.

Sorry if this is a stupid question -- how exactly do you "disable mpm_event, enable cgi, enable mpm_event"?

I thought we could deal with the main error logging, but since the mod_cgid error logging does not including timestamps, on a very busy web server that hosts multiple domains, it's proven to be 99.9999% useless so far.
Comment 15 Eric Covener 2017-03-17 18:20:22 UTC
(In reply to wick from comment #14)
> (In reply to Franz-Josef Huecker from comment #13)
> > 
> > I've just tested it with 2.4.7 and the bug is still present. 
> > 
> > But there are a simple way to fix it: disable mpm_event, enable cgi, enable
> > mpm_event, and it works.
> 
> Sorry if this is a stupid question -- how exactly do you "disable mpm_event,
> enable cgi, enable mpm_event"?

I think this refers to some specific packaging loophole that would result in mod_cgi being used w/ event MPM,  instead of mod_cgid which is normally used with all threaded MPMs like event.