<div dir="ltr"><div>Hi PM,</div><div><br></div>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:<div><br></div><div><br></div><div>  Constant subroutine redefined<br></div><div>  PV = SV</div><div>  REFCNT</div><div>  FLAGS</div><div>  ...</div><div><br></div><div>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.</div><div><br></div><div>So eventually I came up with this...  any other solutions?</div><div><br></div><div>regards,</div><div>Mathew</div><div><br></div><div><br></div><div><br></div><div>In apache2.conf :</div><div><br></div><div>   ErrorLog "||/usr/local/bin/<a href="http://apache_log_filter.pl">apache_log_filter.pl</a> ${APACHE_LOG_DIR}/error.log"</div><div><br></div><div>In /usr/local/bin/<a href="http://apache_log_filter.pl">apache_log_filter.pl</a> :</div><div><br></div><div>#!/usr/bin/perl</div><div><div>use strict;</div><div>use warnings FATAL => 'all';</div><div>use utf8;</div><div><br></div><div>my $logfile = $ARGV[0] or die "Missing logfile name";</div><div>open(LOG,">>",$logfile) or die "Failed opening: $logfile";</div><div>select((select(LOG), $|=1)[0]);</div><div>my $last = '';</div><div>my $catch_at;</div><div>while(<STDIN>) {</div><div>  $last = $_ unless /^ at .* line \d+/;</div><div>  if (/^Prototype mismatch/) {</div><div>    $catch_at = 1;</div><div>    next;</div><div>  }</div><div>  next if /^Constant subroutine/;</div><div>  next if /^SV = /;</div><div>  next if /^  REFCNT /;</div><div>  next if /^  FLAGS /;</div><div>  next if /^  PV /;</div><div>  next if /^PV\(0x.*\) at 0x/;</div><div>  if (/^ at .* line \d+/) {</div><div>    if ($catch_at) {</div><div>      $catch_at = 0;</div><div>      next;</div><div>    }</div><div>    print LOG $last;</div><div>    print LOG $_;</div><div>    next;</div><div>  }</div><div>  print LOG $_;</div><div>}</div></div><div><br></div></div>