httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Ames <grega...@raleigh.ibm.com>
Subject [PATCH] log stderr output from cgi's in 2.0
Date Thu, 18 May 2000 20:27:34 GMT
The stderr output from cgi's isn't being logged on Unix in 2.0.  After
we fork, we use dup2 to replace the stderr inherited from the parent
with a pipe.  Back in run_cgi_child in mod_cgi.c, we read from the
parent's end of the stderr pipe but don't do anything with the output.
This patch uses the same logic as Windows to log the stderr output.

I didn't follow how this worked in 1.3 .   It behaves as if the cgi
child's stderr was just inherited from the parent, but I do see similar
pipe creation and dup2 stuff which should replace the inherited file.
In any case, the raw stderr output appears in the 1.3 log without any
formatting.  With this patch, we get the formatting added by
ap_log_rerror (and some extra blank lines?!?) in addition to the raw
stderror output:

[Thu May 18 15:55:00 2000] [error] [client 127.0.0.1] Premature end of
script headers: /two/cgi-bin/junk-cgi
[Thu May 18 15:55:00 2000] [error] [client 127.0.0.1]
/two/cgi-bin/junk-cgi: junk: command not found

[Thu May 18 15:55:00 2000] [error] [client 127.0.0.1]
/two/cgi-bin/junk-cgi: morejunk: command not found

[Thu May 18 15:55:00 2000] [error] [client 127.0.0.1]
/two/cgi-bin/junk-cgi: yetmorejunk: command not found

Another approach would be to just let the cgi child inherit the parent's
stderr and not bother with the pipe.

Greg Ames

Mime
View raw message