Hi -- 

I am a new user of MP2.  Pardon my basic questions.

Here's my situation:

My Apache generates 4 sets of logs.

Three of them are generated by Apache directly:
access, error, and a custom log tracking access for
certain file types.

The fourth is made by a MP2 handler dealing with
redirects.  Here's the snippet of relevant code.

sub mylog {
    my (@fields) = @_;
    my $entry = join ( "|", @fields );
    open my $fh, ">>" . &MYLOG or die "can't open " .
&MYLOG . ": $!";
    flock $fh, LOCK_EX;
    print $fh $entry . "\n";
    close $fh;
}

Currently I'm rolling my logs "manually" -- 
a process renames the four sets of logs, waits, then
restarts the server.

I am considering using piped logs
  http://httpd.apache.org/docs-2.0/logs.html#piped
with rotatelogs
 
http://httpd.apache.org/docs-2.0/programs/rotatelogs.html
instead to avoid the restart.

I understand how to instruct Apache to log via a pipe
to rotatelogs.  

My questions relate to the mylog() function:

Can I / should I direct output to a pipe?  
Would this do anything unpleasant to MP2 or AP2?

If doing this is OK, 
do I just open the pipe like a file?

<untested code>
open my $fh, "|bin/rotatelogs
/var/logs/%y_%m_%d_%H_%M_%S 14400" or die "can't open
pipe to rotatelogs: $!";
</untested code>

I'd remove the FLOCK, yes?

If I do this, should I close the pipe after use, as I
do now in mylog() with close $fh?

Are there any speed or stability concerns logging
through a rotatelog, vs. to a file?

Thanks very much for your advice and insights....

-TO





__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to