You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tyler Bird <bi...@epromo.com> on 2007/04/26 21:10:01 UTC

Logging With Mod Perl 2.0

But I was wondering isn't there anything I can do to mod_perl that will 
allow a plain warn to send it to my virtualhosts log and not my servers
log.

without using the $r->warn() syntax



warn("hey") really goes t the virtual hosts log and I don't have to put $r->warn()

Tyler


Re: Logging With Mod Perl 2.0

Posted by Carl Johnstone <mo...@fadetoblack.me.uk>.
Tyler Bird wrote:
> But I was wondering isn't there anything I can do to mod_perl that 
> will allow a plain warn to send it to my virtualhosts log and not my 
> servers
> log.
>
> without using the $r->warn() syntax
>
>
>
> warn("hey") really goes t the virtual hosts log and I don't have to 
> put $r->warn()
>

warn() is just sending the message to perl's STDERR which is attached to 
the main apache error log.

to get apache to send output to different places you need to call the 
relevant functions in apache's API - mod_perl provides a perl version of 
that API.

So for mp1 that's Apache::Log, and Apache2::Log for mp2. I can't see 
there being any options outside what those modules already provide.

Carl





Re: Logging With Mod Perl 2.0

Posted by Torsten Foertsch <to...@gmx.net>.
On Thursday 26 April 2007 21:10, Tyler Bird wrote:
> But I was wondering isn't there anything I can do to mod_perl that will
> allow a plain warn to send it to my virtualhosts log and not my servers
> log.
>
> without using the $r->warn() syntax

The problem is you need a $r object for that. In MP1 there was a global one. 
In MP2 there is not.

Your problem can possibly be solved by using PerlOptions +GlobalRequest plus 
modifying the warn function by either setting $SIG{__WARN__} or 
*CORE::GLOBAL::warn=sub{...}

*CORE::GLOBAL::warn=sub {
  (Apache2::RequestUtil->request || Apache2::ServerUtil->server)->warn(@_);
}

Torsten