Re: Trapping STDERR

Stanley Gambarin (
Fri, 20 Dec 1996 13:27:25 -0500

Message-Id: <>
To: Gregory Murphy <>
Subject: Re: Trapping STDERR 
In-Reply-To: Your message of "Tue, 17 Dec 1996 11:00:57 EST."
Date: Fri, 20 Dec 1996 13:27:25 -0500
From: Stanley Gambarin <>

> I see from fcgi_stdio.c that when FCGI_Accept() is called, it redirects 
> stderr to the HTTP server.  Where does stderr go before the first call
> to FCGI_Accept(), i.e. when the initialization portion of the fcgi 
> application is being processed?
> Ideally, I would like to trap all data sent to stderr in the same log 
> file so I can keep tabs on application performance, and this includes 
> knowing when and how applications are restarted.
> - Gregory Murphy
> Center for Electronic Texts in the Humanities
> Princeton University

	The information sent to stderr before the FCGI_Accept() call
is ignored, so if you would like to log any information before that
function call, you have to do it explicitly, by opening the log file
and then sending all the logging info into that file.  
	It is important to distinguish the FastCGI application from the 
web server.  It seems from your message that you might want to log 
any error messages from FastCGI application in the web server's error 
log files, but that is clearly impossible.  First of all, FastCGI app and
web server might be running on the different machines, secondly, FastCGI
app can not call any web server functions and finally, logging into the same
file as the web server would cause race conditions, resulting in the 
garbage output.
						Hope that helps. Stanley.


* Stanley Gambarin			Open Market Inc.		      *
* FastCGI (soon-to-be) Guru		245 First St. Cambridge MA 02142      *
*					(617) - 949 - 7487		      *
*					      *
* (school)    *
*		      *