On Fri 16 Jan 2009, fREW Schmidt wrote:
> I would like to configure apache such that the errors for a specific
> virtual host get logged in their own file.  I tried something like
> this:
>
> <VirtualHost *:8080>
>    ErrorLog "C:/location/of/acd/logs/error.log"
>    <Perl>
>       use lib 'C:/location/of/acd';
>       $ENV{MODE} = 'development';
>    </Perl>
>     ScriptAlias / "C:/locattion/of/acd"
>    <Location  />
>       SetHandler perl-script
>       PerlHandler ACD::Dispatch
>        Order allow,deny
>        Allow from all
>    </Location>
> </VirtualHost>
>
> But it seems to be ignoring my ErrorLog directive and still puts the
> logs in the regular place. What am I doing wrong?

Are you wondering why all your warn() output is directed to only one log 
file? If yes, then try the logging functions in Apache2::Log instead.

I don't know about windows but on a UNIX-like system the default 
ErrorLog is opened on file descriptor 2 and that happens to be STDERR. 
That's why all the perlish warn()ings go to that file.

You will notice that the methods in Apache2::Log all require a request 
or server object. This is necessary to decide into which error log the 
message should be written. Since the perl warn() lacks that information 
it cannot log to a specific file.

You can override the warn() by either supplying a $SIG{__WARN__} handler 
or by implementing *CORE::GLOBAL::warn=sub {...}. That function can 
then check if Apache2::RequestUtil->request or 
Apache2::ServerUtil->server returns something useful and the use that 
object with Apache2::Log.

If your Apache error messages all go to the same file then your 
configuration is wrong. If you use named virtual hosts you have perhaps 
forgotten the ServerName directive (as Adam pointed out) or your 
requests lacks the Host-header. I think Apache complains in that case 
at startup. Turn on LogLevel debug. For IP/port based vhost you don't 
need either.

Torsten

-- 
Need professional mod_perl support?
Just hire me: torsten.foert...@gmx.net

Reply via email to