SeanM has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I humbly bow to your excellencies and salute your collective knowledge of all things Perl. I've got a problem here with mod_perl and specifically Apache2::Log.

Perl Apache2::Log documentation (http://perl.apache.org/docs/2.0/api/Apache2/Log.html), there is a way to stop Apache from prefixing one's nicely formatted log messages. Despite all my tries, I cannot get the claimed solution to work.

===START Apache2::Log API documentation snippet===
Apache2::Const::LOG_STARTUP
is useful for startup message where no timestamps, logging level is wanted. For example:
use Apache2::Const -compile => qw(:log);
use APR::Const -compile => qw(SUCCESS);
$s->log_serror(Apache2::Log::LOG_MARK,
Apache2::Const::LOG_INFO,
APR::Const::SUCCESS,
"This log message comes with a header");

will print:

Wed May 14 16:47:09 2003 info This log message comes with a header

whereas, when Apache2::Const::LOG_STARTUP is binary ORed as in:

use Apache2::Const -compile => qw(:log);
use APR::Const -compile => qw(SUCCESS);
$s->log_serror(Apache2::Log::LOG_MARK,

Apache2::Const::LOG_INFO|Apache2::Const::LOG_STARTUP,
APR::Const::SUCCESS,
"This log message comes with no header");

then the logging will be:

This log message comes with no header
===END Apache2::Log API documentation snippet===

I've tried so many things but I still fail in getting rid of "Wed May 14 16:47:09 2003 info" in this example. My code looks just like the example. Please help. I think this documentation is incorrect or out of date. Thanks!

  • Comment on Apache2::Log, please don't headerize my log messages

Replies are listed 'Best First'.
Re: Apache2::Log, please don't headerize my log messages
by SeanM (Initiate) on Jan 16, 2012 at 19:27 UTC
    Looks like I solved this one myself. It wasn't a problem with documentation. It was a problem with my Apache LogLevel. It was set to a higher value than that of the example's. Thanks anyway :)