Separate Error log for each virtual host

Separate Error log for each virtual host

am 16.01.2009 16:40:23 von fREW Schmidt

--0016363ba66027c4e804609b6426
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

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:


ErrorLog "C:/location/of/acd/logs/error.log"

use lib 'C:/location/of/acd';
$ENV{MODE} = 'development';

ScriptAlias / "C:/locattion/of/acd"

SetHandler perl-script
PerlHandler ACD::Dispatch
Order allow,deny
Allow from all



But it seems to be ignoring my ErrorLog directive and still puts the logs in
the regular place. What am I doing wrong?
--

-fREW

--0016363ba66027c4e804609b6426
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I would like to configure apache such that the errors for a specific virtua=
l host get logged in their own file.  I tried something like this:
=

<VirtualHost *:8080>
   ErrorLog "C:/location/o=
f/acd/logs/error.log"

   <Perl>
      use lib 'C:=
/location/of/acd';
      $ENV{MODE} =3D =
9;development';
   </Perl>
    Scr=
iptAlias / "C:/locattion/of/acd"
   <Location&nbs=
p; />
      SetHandler perl-script

      PerlHandler ACD::Dispatch
  &nb=
sp;    Order allow,deny
     &nb=
sp; Allow from all
   </Location>
</VirtualHost>=
;

But it seems to be ignoring my ErrorLog directive an=
d still puts the logs in the regular place. What am I doing wrong?

--

-fREW


--0016363ba66027c4e804609b6426--

Re: Separate Error log for each virtual host

am 16.01.2009 16:59:46 von Adam Prime

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:
>
>
> ErrorLog "C:/location/of/acd/logs/error.log"
>
> use lib 'C:/location/of/acd';
> $ENV{MODE} = 'development';
>

> ScriptAlias / "C:/locattion/of/acd"
>
> SetHandler perl-script
> PerlHandler ACD::Dispatch
> Order allow,deny
> Allow from all
>

>

>
> But it seems to be ignoring my ErrorLog directive and still puts the
> logs in the regular place. What am I doing wrong?

Are there other virtual hosts too? That config would make that
particular vhost put it's error_log at
C:/location/of/acd/logs/error.log. Typically people just have a
different path in their ErrorLog directive for each vhost.

Adam

Re: Separate Error log for each virtual host

am 16.01.2009 17:02:03 von fREW Schmidt

On Fri, Jan 16, 2009 at 9:59 AM, Adam Prime wrote:
> 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:
>>
>>
>> ErrorLog "C:/location/of/acd/logs/error.log"
>>
>> use lib 'C:/location/of/acd';
>> $ENV{MODE} = 'development';
>>

>> ScriptAlias / "C:/locattion/of/acd"
>>
>> SetHandler perl-script
>> PerlHandler ACD::Dispatch
>> Order allow,deny
>> Allow from all
>>

>>

>>
>> But it seems to be ignoring my ErrorLog directive and still puts the logs
>> in the regular place. What am I doing wrong?
>
> Are there other virtual hosts too? That config would make that particular
> vhost put it's error_log at C:/location/of/acd/logs/error.log. Typically
> people just have a different path in their ErrorLog directive for each
> vhost.
>

Yeah, I have another virtualhost at *:80 with it's own ErrorLog
directive, but of course it still doesn't seem to honor that and puts
the errorlog in the default place anyway.


--

-fREW

Re: Separate Error log for each virtual host

am 16.01.2009 17:14:40 von Adam Prime

fREW Schmidt wrote:
>
> Yeah, I have another virtualhost at *:80 with it's own ErrorLog
> directive, but of course it still doesn't seem to honor that and puts
> the errorlog in the default place anyway.

This doesn't really have anything to do with mod_perl at all i think you
might want to try removing all the mod_perl stuff and getting your
logging working how you want, then add the mod_perl stuff back in.

It's kind of unusual to have an ErrorLog directive and not have an
AccessLog directive. It's also unusual to not have
ServerName/ServerAlias defined when you're using * in a VirtualHost
directive. It's also unusual (at least IMO) to not have a DocumentRoot
defined for the vhost.

Adam

Re: Separate Error log for each virtual host

am 16.01.2009 17:49:03 von fREW Schmidt

>> Yeah, I have another virtualhost at *:80 with it's own ErrorLog
>> directive, but of course it still doesn't seem to honor that and puts
>> the errorlog in the default place anyway.
>
> This doesn't really have anything to do with mod_perl at all i think you
> might want to try removing all the mod_perl stuff and getting your logging
> working how you want, then add the mod_perl stuff back in.
>
> It's kind of unusual to have an ErrorLog directive and not have an AccessLog
> directive. It's also unusual to not have ServerName/ServerAlias defined
> when you're using * in a VirtualHost directive. It's also unusual (at least
> IMO) to not have a DocumentRoot defined for the vhost.

I'll look at the AccessLog and ServerName/ServerAlias stuff. There IS
a document root for the other Virtual Host, and I will add one for
this one right now. Once I have dealt with those issues I'll post
again.

Thanks!
--

-fREW

Re: Separate Error log for each virtual host

am 16.01.2009 19:54:54 von torsten.foertsch

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. =A0I tried something like
> this:
>
>
> =A0 =A0ErrorLog "C:/location/of/acd/logs/error.log"
> =A0 =A0
> =A0 =A0 =A0 use lib 'C:/location/of/acd';
> =A0 =A0 =A0 $ENV{MODE} =3D 'development';
> =A0 =A0

> =A0 =A0 ScriptAlias / "C:/locattion/of/acd"
> =A0 =A0
> =A0 =A0 =A0 SetHandler perl-script
> =A0 =A0 =A0 PerlHandler ACD::Dispatch
> =A0 =A0 =A0 =A0Order allow,deny
> =A0 =A0 =A0 =A0Allow from all
> =A0 =A0

>

>
> 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=20
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=20
ErrorLog is opened on file descriptor 2 and that happens to be STDERR.=20
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=20
or server object. This is necessary to decide into which error log the=20
message should be written. Since the perl warn() lacks that information=20
it cannot log to a specific file.

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

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

Torsten

=2D-=20
Need professional mod_perl support?
Just hire me: torsten.foertsch@gmx.net

Re: Separate Error log for each virtual host

am 17.01.2009 17:58:26 von fREW Schmidt

I am not quite sure what I did differently, but the per server error
log is working now. Here's the config if anyone wants it:


ErrorLog "C:/path/to/acd/logs/error.log"

use lib 'C:/path/to/acd';
$ENV{MODE} = 'development';

ScriptAlias / "C:/path/to/acd"

SetHandler perl-script
PerlHandler ACD::Dispatch
Order allow,deny
Allow from all





--

-fREW