perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Gormley < >
Subject Re: [mp2] STDERR on a per-vhost basis?
Date Wed, 11 Mar 2009 18:47:36 GMT

> Under mod_perl 2, stderr for all virtual hosts seems to be opened to the 
> global Apache 2 error log (/var/log/apache2/error.log or similar).  How 
> do I get stderr output to go to the ErrorLog that is defined for each 
> virtual host?

I was going to say that this is detailed here:

but then I realised that this refers to redirecting warn() and warnings
to the virtual server error log, and that STDERR still goes to the main
error log.

You can reopen STDERR to the log file of your choice, as per:

  open (*STDERR,'>',$log_file_path) or die $!

The question is when :)

´╗┐Doing it in a PerlOpenLogsHandler is too soon, as this is only called
once, and not on a per-virtualhost basis.

By the time you're in a PerlRequestHandler, you don't (or shouldn't)
have permission to access the standard logs/ directory.

That said, I think it's your only real option, and I'd localise STDERR
before redirecting it, otherwise it'll probably affect other virtual
hosts which don't redirect.



View raw message