[Melbourne-pm] mod_perl quirks

Mathew Robertson mathew.blair.robertson at gmail.com
Thu Jan 8 14:44:32 PST 2015


Hi PM,

During the mod-perl vs other frameworks discussion, I remembered one
particular annoyance of mod-perl...  all the mod-perl error-log messages
saying stuff like:


  Constant subroutine redefined
  PV = SV
  REFCNT
  FLAGS
  ...

I have scoured the web trying to determine what/where this comes from -
eventually identifying the problem as "yeah Mod-Perl does that... they are
only warnings so just ignore them". But alas that just fills up the Apache
errorlog.  And no amount of Apache error-level settings changed this
behaviour.

So eventually I came up with this...  any other solutions?

regards,
Mathew



In apache2.conf :

   ErrorLog "||/usr/local/bin/apache_log_filter.pl
${APACHE_LOG_DIR}/error.log"

In /usr/local/bin/apache_log_filter.pl :

#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use utf8;

my $logfile = $ARGV[0] or die "Missing logfile name";
open(LOG,">>",$logfile) or die "Failed opening: $logfile";
select((select(LOG), $|=1)[0]);
my $last = '';
my $catch_at;
while(<STDIN>) {
  $last = $_ unless /^ at .* line \d+/;
  if (/^Prototype mismatch/) {
    $catch_at = 1;
    next;
  }
  next if /^Constant subroutine/;
  next if /^SV = /;
  next if /^  REFCNT /;
  next if /^  FLAGS /;
  next if /^  PV /;
  next if /^PV\(0x.*\) at 0x/;
  if (/^ at .* line \d+/) {
    if ($catch_at) {
      $catch_at = 0;
      next;
    }
    print LOG $last;
    print LOG $_;
    next;
  }
  print LOG $_;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20150109/e3816350/attachment.html>


More information about the Melbourne-pm mailing list