You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2004/08/19 09:03:37 UTC

[mp2] cleaning up Apache::Log

I'm working on finishing Apache::Log, besides several issues I've a test 
for (like $s->log_error logging into the main server error log instead of 
vhost), I want to cut the amount of the ways one can log. Among others we 
have:

      * Apache::warn
      * Apache->warn
      * Apache::Server->log_error
      * Apache::Server->warn
      * $r->log_error
      * $r->warn
      * $s->log_error
      * $s->warn

I think this should be reduced to:

      * $r->log_error
      * $r->warn
      * $s->log_error
      * $s->warn

And I'm still trying to figure out whether it's possible to make 'a plain 
warn()' log into the vhost log (die already logs into the vhost log). I 
haven't yet checked how it worked in mp1, I think it never did.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] cleaning up Apache::Log

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> ($r|$s)->log->(warn|crit|...) are all there. They are fine (well, not
> exactly all of them, but I'm working on that).

cool.  then I'm fine with your suggestion.

--Geoff


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] cleaning up Apache::Log

Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
>>I think this should be reduced to:
>>
>>     * $r->log_error
>>     * $r->warn
>>     * $s->log_error
>>     * $s->warn
> 
> 
> don't forget about $r->log->warn(), which is slightly different than
> $r->warn() in mp1, as well as $r->log->info(), etc which are frequently used
> in mp1.  I haven't checked if these methods exist already (via $r->log) or
> whether when you say warn() you're talking about all the other logging
> levels as well.

($r|$s)->log->(warn|crit|...) are all there. They are fine (well, not 
exactly all of them, but I'm working on that).

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] cleaning up Apache::Log

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> I think this should be reduced to:
> 
>      * $r->log_error
>      * $r->warn
>      * $s->log_error
>      * $s->warn

don't forget about $r->log->warn(), which is slightly different than
$r->warn() in mp1, as well as $r->log->info(), etc which are frequently used
in mp1.  I haven't checked if these methods exist already (via $r->log) or
whether when you say warn() you're talking about all the other logging
levels as well.

> 
> And I'm still trying to figure out whether it's possible to make 'a
> plain warn()' log into the vhost log (die already logs into the vhost
> log). I haven't yet checked how it worked in mp1, I think it never did.

I think you're right.

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] cleaning up Apache::Log

Posted by Stas Bekman <st...@stason.org>.
Vivek Khera wrote:
> 
> On Aug 19, 2004, at 3:03 AM, Stas Bekman wrote:
> 
>> And I'm still trying to figure out whether it's possible to make 'a 
>> plain warn()' log into the vhost log (die already logs into the vhost 
>> log). I haven't yet checked how it worked in mp1, I think it never did.
> 
> 
> A plain warn() in mp1 does end up in the error_log.  I use it for 
> debugging all the time.

It's not plain warn(), it's imported one with:

   use Apache 'warn';

Or did you mean something else, Vivek?

OK, I wrote a modperl1 test suite
http://apache.org/~stas/warn-test-mp1.tar.gz
and indeed all go the vhost's error_log.
(t/htdocs/error_log in the test suite)

The only problem is the internal warn which doesn't. e.g.:

   # internal warning
   my $x = "aaa" + 1;

ends up in the main error_log.

I tried to workaround that with:

   *CORE::GLOBAL::warn = \&Apache::warn;

but got a segfault:

#0  0x2f3a2e3a in ?? ()
#1  0x402720f1 in fputs () from /lib/tls/libc.so.6
#2  0x080dce41 in log_error_core (file=0x810e7d1 "Apache.c", line=2001,
     level=12, s=0x813425c, r=0x0, fmt=0x810f76b "%s",
     args=0xbfffeb44 "x¸ \b\230ëÿ¿Ûf\n\b@W\023\b\001") at http_log.c:452
#3  0x080dceb2 in ap_log_error (file=0x810e7d1 "Apache.c", line=2001,
     level=12, s=0x813425c, fmt=0x810f76b "%s") at http_log.c:469
#4  0x080a69dd in XS_Apache_log_error (my_perl=0x8135740, cv=0x81e60b4)
     at Apache.c:2001
#5  0x40135f65 in Perl_pp_entersub (my_perl=0x8135740) at pp_hot.c:2854
#6  0x4011193f in Perl_runops_debug (my_perl=0x8135740) at dump.c:1442
#7  0x400b7b6e in S_call_body (my_perl=0x8135740, myop=0xbfffeda0, is_eval=0)
     at perl.c:2285
#8  0x400b76aa in Perl_call_sv (my_perl=0x8135740, sv=0x81e3448, flags=4)
     at perl.c:2203
#9  0x0808b355 in perl_call_handler (sv=0x81e3448, r=0x8206d34, args=0x0)
     at mod_perl.c:1668
#10 0x0808a265 in perl_run_stacked_handlers (hook=0x810bfe7 "PerlHandler",
     r=0x8206d34, handlers=0x814d31c) at mod_perl.c:1381
#11 0x08087123 in perl_handler (r=0x8206d34) at mod_perl.c:904
#12 0x080d4c0f in ap_invoke_handler (r=0x8206d34) at http_config.c:518
#13 0x080e9802 in process_request_internal (r=0x8206d34) at 
http_request.c:1324
#14 0x080e9861 in ap_process_request (r=0x8206d34) at http_request.c:1340
#15 0x080e0975 in child_main (child_num_arg=0) at http_main.c:4653
#16 0x080e0bdd in make_child (s=0x812a04c, slot=0, now=1093136593)
     at http_main.c:4823
#17 0x080e0c83 in startup_children (number_to_start=1) at http_main.c:4850
#18 0x080e1329 in standalone_main (argc=9, argv=0xbffff174) at 
http_main.c:5169
#19 0x080e1b47 in main (argc=9, argv=0xbffff174) at http_main.c:5511

Let's see if we can get this sorted out at least in mp2.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] cleaning up Apache::Log

Posted by Stas Bekman <st...@stason.org>.
Vivek Khera wrote:
> 
> On Aug 19, 2004, at 3:03 AM, Stas Bekman wrote:
> 
>> And I'm still trying to figure out whether it's possible to make 'a 
>> plain warn()' log into the vhost log (die already logs into the vhost 
>> log). I haven't yet checked how it worked in mp1, I think it never did.
> 
> 
> A plain warn() in mp1 does end up in the error_log.  I use it for 
> debugging all the time.

You mean in the vhost's error_log, right?

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] cleaning up Apache::Log

Posted by Vivek Khera <kh...@kcilink.com>.
On Aug 19, 2004, at 3:03 AM, Stas Bekman wrote:

> And I'm still trying to figure out whether it's possible to make 'a 
> plain warn()' log into the vhost log (die already logs into the vhost 
> log). I haven't yet checked how it worked in mp1, I think it never 
> did.

A plain warn() in mp1 does end up in the error_log.  I use it for 
debugging all the time.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org