I have several vhosts served by Apache 2.2.22 on a Debian Wheezy server. Some vhosts are Catalyst apps; all vhosts run with mod_fastcgi
and mod_suexec
. Each virtual host is configured to use a different ErrorLog
.
When code in the Catalyst apps writes to stderr (e.g. warn
is called), the message ends up in the main Apache error log instead of the one specified in the <VirtualHost>
block. It's not prefixed by a timestamp or any other information.
However, if I call this trivial fastcgi
script
#!/usr/bin/perl
use FCGI;
my $request = FCGI::Request();
while($request->Accept() >= 0) {
print("Content-type: text/html\r\n\r\n");
warn 'Hello!';
}
the Hello!
does end up in the right place, correctly prefixed:
[Thu Jul 10 14:40:18 2014] [error] [client x.x.x.x] FastCGI: server "/data/vhost/wibble/docs/test.cgi" stderr: Hello! at test.cgi line 9., referer: http://my.test.site/
How can I get the Catalyst sites to write their stderr to the correct log?
The only related question I can find is this one -- similar problem but different module (mod_perl
), and sadly no answers. I also found this Apache bug report, which describes the same problem with mod_cgid
.
Edit: If I put
open STDERR, ">>../../applogs/app.log" or die "can't open applog: $!";
before the Catalyst loop, this redirects stderr to my log file, but obviously no datestamps or other prefixes are added. What I want is for stderr to be treated the same as for a bare FCGI script.