You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by W G Stoddard <wg...@us.ibm.com> on 1998/06/29 22:05:32 UTC

Question about ScriptLog and CGI output to stderr...

I've been looking at PRs 2408 and 2429 and have a few questions about CGI error
logging and the ScriptLog directive.

Information (written to stdout or stderr) is recorded in the ScriptLog only
when the script exists with error status, otherwise this information is
discarded...  True?  Should this same information also be written to the
errorlog file?  What should happen to information written to stderr when
ScriptLog is not defined?  Is it acceptable to allow unformatted CGI error data
to be written to the Apache error log?

Just want to make sure I understand how this should work before jumping into
the PRs.


Thanks,
Bill Stoddard
wgstodda@us.ibm.com

Re: Question about ScriptLog and CGI output to stderr...

Posted by Dan Jacobowitz <dr...@false.org>.
[Whew, it wasn't just me, been seeing that for a while]

On Mon, Jun 29, 1998 at 04:05:32PM -0400, W G Stoddard wrote:
> I've been looking at PRs 2408 and 2429 and have a few questions about CGI error
> logging and the ScriptLog directive.
> 
> Information (written to stdout or stderr) is recorded in the ScriptLog only
> when the script exists with error status, otherwise this information is
> discarded...  True?  Should this same information also be written to the
> errorlog file?  What should happen to information written to stderr when
> ScriptLog is not defined?  Is it acceptable to allow unformatted CGI error data
> to be written to the Apache error log?

My take on it is this:

If ScriptLog is defined, then script errors should only be written
there, and should be written regardless of the script's error status -
or perhaps a variable ScriptLogWarnings On?

If ScriptLog is not defined then script errors should go to the error
log, but if it is practical to do so they should have a timestamp and
[warning] if the script exits with success, and [error] otherwise.

Dan Jacobowitz

Re: Question about ScriptLog and CGI output to stderr...

Posted by Alexei Kosut <ak...@leland.Stanford.EDU>.
On Tue, 30 Jun 1998, Brian Behlendorf wrote:

> At 01:20 PM 6/29/98 -0700, Alexei Kosut wrote:
> >On Mon, 29 Jun 1998, W G Stoddard wrote:
> >
> >> Information (written to stdout or stderr) is recorded in the ScriptLog only
> >> when the script exists with error status, otherwise this information is
> >> discarded...  True? 
> >
> >Yes.
> 
> I would propose that stderr also get logged here on successes....

Probably could be done. Except that currently the ScriptLog format is
(IIRC) machine-parsable, so that might screw up some things.

It should be noted in all this though, that ScriptLog was never designed,
and should not be used, on a production (live) server. It's inefficient
and (as Dean points out), doesn't quite work right. And involves rewriting
OSes to get right.

*shrug*

[...]

> >> Is it acceptable to allow unformatted CGI error data to be written to
> >> the Apache error log? 
> >
> >Yes.
> 
> Conceptually, I would disagree; it should be encapsulated into the rest of
> the error log format somehow, so that error log parsing scripts can
> reasonably deal with it.

Well, sure, ideally. I thought the question was as to how it's suposed to
work now.

-- Alexei Kosut <ak...@stanford.edu> <http://www.stanford.edu/~akosut/>
   Stanford University, Class of 2001 * Apache <http://www.apache.org> *



Re: Question about ScriptLog and CGI output to stderr...

Posted by Dean Gaudet <dg...@arctic.org>.

On Tue, 30 Jun 1998, Marc Slemko wrote:

> It is also well worth considering not using stdio for the error log, or
> anything else, since some systems (like Solaris) will only fix their stdio
> when hell freezes over.

This is fixed in apache-nspr already (stdio is never used).

Dean


Re: Question about ScriptLog and CGI output to stderr...

Posted by Marc Slemko <ma...@znep.com>.
Right.  This is something that should be fixed for 2.0 by adding a layer
in there, but this has nothing to do with ScriptLog.  Conceptually, it is
simple to do this and I don't think the performance is too big a concern.

Note that programs that are designed to make their stderr messages "look
nice" (eg. including timestamp, etc.) in the current system will look
silly if Apache inserts that as well, but that is just too bad.

It is also well worth considering not using stdio for the error log, or
anything else, since some systems (like Solaris) will only fix their stdio
when hell freezes over.

On Tue, 30 Jun 1998, Dean Gaudet wrote:

> 
> 
> On Tue, 30 Jun 1998, Brian Behlendorf wrote:
> 
> > Conceptually, I would disagree; it should be encapsulated into the rest of
> > the error log format somehow, so that error log parsing scripts can
> > reasonably deal with it.
> 
> Of course, this is a moot point, because the code already sends stderr to
> error_log unformatted... and I certainly wouldn't expect win32 to get this
> any more correct than unix.
> 
> Dean
> 
> 


Re: Question about ScriptLog and CGI output to stderr...

Posted by Dean Gaudet <dg...@arctic.org>.

On Tue, 30 Jun 1998, Brian Behlendorf wrote:

> Conceptually, I would disagree; it should be encapsulated into the rest of
> the error log format somehow, so that error log parsing scripts can
> reasonably deal with it.

Of course, this is a moot point, because the code already sends stderr to
error_log unformatted... and I certainly wouldn't expect win32 to get this
any more correct than unix.

Dean


Re: Question about ScriptLog and CGI output to stderr...

Posted by Brian Behlendorf <br...@hyperreal.org>.
At 01:20 PM 6/29/98 -0700, Alexei Kosut wrote:
>On Mon, 29 Jun 1998, W G Stoddard wrote:
>
>> Information (written to stdout or stderr) is recorded in the ScriptLog only
>> when the script exists with error status, otherwise this information is
>> discarded...  True? 
>
>Yes.

I would propose that stderr also get logged here on successes....

>> What should happen to information written to stderr when ScriptLog is
>> not defined? 
>
>It goes into the error log (whether or not there has been an error)
>
>> Is it acceptable to allow unformatted CGI error data to be written to
>> the Apache error log? 
>
>Yes.

Conceptually, I would disagree; it should be encapsulated into the rest of
the error log format somehow, so that error log parsing scripts can
reasonably deal with it.

	Brian


--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
pure chewing satisfaction                                  brian@apache.org
                                                        brian@hyperreal.org

Re: Question about ScriptLog and CGI output to stderr...

Posted by Alexei Kosut <ak...@leland.Stanford.EDU>.
On Mon, 29 Jun 1998, W G Stoddard wrote:

> I've been looking at PRs 2408 and 2429 and have a few questions about CGI error
> logging and the ScriptLog directive.

I haven't actually used ScriptLog recently, but I wrote it, so I'll try
and answer. Someone who has more experience with what it actually does
might correct anything I say.

> Information (written to stdout or stderr) is recorded in the ScriptLog only
> when the script exists with error status, otherwise this information is
> discarded...  True? 

Yes.

> Should this same information also be written to the errorlog file? 

Not if ScriptLog is defined, no.

> What should happen to information written to stderr when ScriptLog is
> not defined? 

It goes into the error log (whether or not there has been an error)

> Is it acceptable to allow unformatted CGI error data to be written to
> the Apache error log? 

Yes.

-- Alexei Kosut <ak...@stanford.edu> <http://www.stanford.edu/~akosut/>
   Stanford University, Class of 2001 * Apache <http://www.apache.org> *



Re: Question about ScriptLog and CGI output to stderr...

Posted by Dean Gaudet <dg...@arctic.org>.
If someone is playing with ScriptLog, it's worthwhile noting a low
numbered PR... where I note that ScriptLog produces a deadlock:  if the
script writes too much to stderr, it'll block.  Meanwhile httpd is reading
from the script's stdout... and not touching the stderr. 

I don't really find it acceptable to allow unformatted CGI error data in
the error log... but that's just how it's always been. 

Ideally each line of error output would be prefixed before going into the
error log. 

Kind of a pain to solve in 1.3 though... at least that's how it's seemed
each time I've gone in to consider fixing it.  For apache-nspr it could be
done with an I/O layer. 

Dean

On Mon, 29 Jun 1998, W G Stoddard wrote:

> I've been looking at PRs 2408 and 2429 and have a few questions about CGI error
> logging and the ScriptLog directive.
> 
> Information (written to stdout or stderr) is recorded in the ScriptLog only
> when the script exists with error status, otherwise this information is
> discarded...  True?  Should this same information also be written to the
> errorlog file?  What should happen to information written to stderr when
> ScriptLog is not defined?  Is it acceptable to allow unformatted CGI error data
> to be written to the Apache error log?
> 
> Just want to make sure I understand how this should work before jumping into
> the PRs.
> 
> 
> Thanks,
> Bill Stoddard
> wgstodda@us.ibm.com
>