I'm trying to debug a mimedefang filter I've written, and I can't seem to get md_syslog to actually log anything. This is with mimedefang 2.85 on Amazon Linux 2. Somehow logging seems to be working because I'm seeing stuff like this
Jan 9 18:00:41 ip-10-0-200-150 mimedefang.pl[26660]: C51DA80055: MDLOG,C51DA80055,mail_in,,,<frommail>,<tomail>,Test
Jan 9 18:00:41 ip-10-0-200-150 mimedefang.pl[26660]: C51DA80055: filter: append_text_boilerplate=1
Jan 9 18:00:41 ip-10-0-200-150 mimedefang[6514]: C51DA80055: Filter time is 7ms
Also, my filter is kind of working, because it's actually doing the append_[html|text] stuff, but some other things aren't working, and my logging to figure that out isn't working. Here's an elided/simplified version of my filter:
sub filter_end {
...
if ($addrs =~ m/$sender/) {
...
if (open(my $fh, '<:encoding(UTF-8)', $text_file)) {
while (my $row = <$fh>) {
$txt_disclaimer .= $row;
}
append_text_boilerplate($entity, $txt_disclaimer, 0); # this works
} else {
warn "Could not open file '$text_file' $!";
}
if (open(my $fh, '<:encoding(UTF-8)', $html_file)) {
while (my $row = <$fh>) {
$html_disclaimer .= $row;
}
...
md_syslog('info', "Appended boilerplate"); # this doesn't show up
if (open(my $lfh, '>>', $log_file)) {
my $log_line = $dest . ',' . $hash . ',' . localtime() . "\n";
print $lfh $log_line;
warn "I think I logged something";
md_syslog('info', "Logged email addr"); # this doesn't show up
close($lfh);
} else {
warn "Could not open log file '$log_file' $!";
md_syslog('warning', "Could not open log file"); # this doesn't show up
}
append_html_boilerplate($entity, $html_disclaimer, 0); # this works
} else {
warn "Could not open file '$html_file' $!";
}
}
...
}
I would expect some of those md_syslog calls to log ... something, but I'm not seeing anything in any log files. Any ideas?
0 Answers