[Mimedefang] MD, logging, and a little bit about the multiplexor
David F. Skoll
dfs at roaringpenguin.com
Mon Sep 30 21:00:01 EDT 2002
On Mon, 30 Sep 2002, Clayton, Nik [IT] wrote:
> Instead of using the Syslog module for logging, MD should use something
> with a bit more flexibility -- e.g., Log::Channel
Looks interesting.
> However, if you want to log information from within an MD filter, you're
> then left with whatever MD supplied for the logging identity, log options,
> and facility in the openlog() call.
You can change the facility in syslog, like this:
syslog('local7|info', "blah blah blah...");
> * There's no guarantee that future versions of MD will call openlog()
> with the same parameters.
I hereby give such a guarantee. :-)
> * There's no way to log within your filter with a different identity,
> options, or facility, without first calling closelog(), then
> openlog() with new options, then closelog() again, then openlog()
> with the old options. This is tricky:
Identity and options are fixed, but you can change facility.
> use Log::Channel;
> use Log::Dispatch::Syslog;
I'll look into this. I'm hesitant to add yet more Perl module dependencies,
though. Also, John Kirkland has contributed code to log messages in
a standardized format, suitable for scripts he has to generate graphs.
That may help alleviate the problem.
I think my preferred solution will be to make Log::Channel a run-time
detectable option (much like SpamAssassin) so if you have it, great, but
if you don't, you can still use MIMEDefang.
> in the previous example) it would be great if there was a filter_init()
> (or some such) that was guaranteed to be called exactly once, and at a
> defined point in the MD start up process.
Easily done; put this in your filter:
sub filter_init {
# whatever
}
# Right before the end
filter_init();
1;
The filter file is read with "do" exactly once; you can do initialization
by calling Perl code from outside any subroutine definition.
Regards,
David.
More information about the MIMEDefang
mailing list