[Haskell-cafe] Network.FastCGI does not emit stderr outputs to
lighttpd's error.log?
Don Stewart
dons at galois.com
Thu Jul 31 13:37:44 EDT 2008
agentzh:
> On Thu, Jul 31, 2008 at 1:56 AM, Don Stewart <dons at galois.com> wrote:
> >
> > We've had no problems with this and apache at least. Is lighttpd
> > doing something funny with error logging?
>
> It seems that Apache is doing something funny :) According to my
> teammate chaoslawful, apache redirects stderr to its error log files
> (if any) but the fastcgi spec actually says everything should go
> through the socket. And lighttpd seems to be following the spec
> exactly :)
>
> chaoslawful++ finally come up with the following patch for lighttpd
> 1.4.19 to make lighttpd behave in the same way as apache. Devel.Debug
> is now finally working for me for my Haskell fastcgi hacking :))
>
> --- lighttpd-1.4.19/src/log.c 2007-08-22 01:40:03.000000000 +0800
> +++ lighttpd-1.4.19-patched/src/log.c 2008-07-31 15:13:10.000000000 +0800
> @@ -83,9 +83,14 @@
> /* move stderr to /dev/null */
> if (close_stderr &&
> -1 != (fd = open("/dev/null", O_WRONLY))) {
> - close(STDERR_FILENO);
> + // XXX: modified by chaoslawful, don't close stderr
> when log into file
> + close(STDERR_FILENO);
> + if (srv->errorlog_mode == ERRORLOG_FILE &&
> srv->errorlog_fd >=0 ) {
> + dup2(srv->errorlog_fd,STDERR_FILENO);
> + } else {
> dup2(fd, STDERR_FILENO);
> - close(fd);
> + }
> + close(fd);
> }
> return 0;
> }
>
> Best,
> -agentzh
Interesting result, thanks for looking into this.
More information about the Haskell-Cafe
mailing list