Score:0

How to get mimedefang's md_syslog to log?

cv flag

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?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.