mail/milter-regex always do syslog(LOG_DEBUG, ...) spamming /var/log/debug.log with each message passing through. It should be optional. How-To-Repeat: just use it
Responsible Changed From-To: freebsd-ports-bugs->dinoex Over to maintainer
I have disabled _all_ logging w/o -v switch. Pardon. Next one should be better - check, please: --- milter-regex.c.orig Mon Dec 11 15:42:26 2006 +++ milter-regex.c Mon Dec 11 15:52:23 2006 @@ -57,6 +57,7 @@ static const char *rule_file_name = "/etc/milter-regex.conf"; static int debug = 0; +static int verbose = 0; struct context { struct ruleset *rs; @@ -520,6 +521,9 @@ va_list ap; char msg[8192]; + if (LOG_PRI(priority) > LOG_INFO && !verbose) + return; + va_start(ap, fmt); if (context != NULL) snprintf(msg, sizeof(msg), "%s: ", context->host_addr); @@ -563,13 +567,16 @@ tzset(); openlog("milter-regex", LOG_PID | LOG_NDELAY, LOG_DAEMON); - while ((ch = getopt(argc, argv, "c:dp:u:")) != -1) { + while ((ch = getopt(argc, argv, "c:dvp:u:")) != -1) { switch (ch) { case 'c': rule_file_name = optarg; break; case 'd': - debug = 1; + debug = verbose = 1; + break; + case 'v': + verbose = 1; break; case 'p': oconn = optarg; --- milter-regex.8.orig Sat Mar 13 23:21:23 2004 +++ milter-regex.8 Mon Dec 11 15:58:25 2006 @@ -51,7 +51,9 @@ .Bl -tag -width "-c config" .It Fl d Don't detach from controlling terminal and produce verbose debug -output on stdout. +output on stdout. Implies -v. +.It Fl v +Do verbose LOG_DEBUG level logging. .It Fl c Ar config Use the specified configuration file instead of the default, /etc/milter-regex.conf.
State Changed From-To: open->feedback I contacted Daniel Hartmeier the author of this software. He wrote: > I kind of like having debug messages sent to syslog by default, even > though they should be dropped there in most cases. That way, you can > temporarily get debug messages from the running process by toggling > syslog.conf, and don't have to restart the process. > > Some bugs only occur after days of process lifetime, and telling the > user to restart the process with debug logging enabled means that it > will take several days longer to reach the next occurance of the bug, as > well has having to store debug messages over that entire period. a) I suggest to add some entries in your syslogd.conf. b) you rewwork the patch to keep the default behaivior c) you rework your patch, so it will be an option to this port.
I did it in b) way. PS: I understand that author may love debug logging, but is this most expected way for application? Does it violates POLA? I, personally, was quite "astonished" when found my /var was eaten by /var/log/debug.log --- milter-regex.8.orig Thu Dec 21 17:15:05 2006 +++ milter-regex.8 Thu Dec 21 17:22:46 2006 @@ -52,6 +52,8 @@ .It Fl d Don't detach from controlling terminal and produce verbose debug output on stdout. +.It Fl q +Don't send to syslog messages with priority higher than LOG_NOTICE. .It Fl c Ar config Use the specified configuration file instead of the default, /etc/milter-regex.conf. --- milter-regex.c.orig Thu Dec 21 17:13:26 2006 +++ milter-regex.c Thu Dec 21 17:23:28 2006 @@ -57,6 +57,7 @@ static const char *rule_file_name = "/etc/milter-regex.conf"; static int debug = 0; +static int quiet = 0; struct context { struct ruleset *rs; @@ -520,6 +521,9 @@ va_list ap; char msg[8192]; + if (LOG_PRI(priority) > LOG_INFO && quiet) + return; + va_start(ap, fmt); if (context != NULL) snprintf(msg, sizeof(msg), "%s: ", context->host_addr); @@ -563,13 +567,16 @@ tzset(); openlog("milter-regex", LOG_PID | LOG_NDELAY, LOG_DAEMON); - while ((ch = getopt(argc, argv, "c:dp:u:")) != -1) { + while ((ch = getopt(argc, argv, "c:dqp:u:")) != -1) { switch (ch) { case 'c': rule_file_name = optarg; break; case 'd': debug = 1; + break; + case 'q': + quiet = 1; break; case 'p': oconn = optarg;
Author still rejects? Even when patch doesn't change default behavior?
Pardon me for intruding, but I agree with the author. Any software can send whatever it wants to syslog. Nothing wrong with that. Syslog is configurable. Option B is the correct solution. Modify /etc/syslog.conf (or advise the user to do so, post-install), with something like this: !milter-regex daemon.debug /dev/null daemon.!=debug /var/log/maillog I prefer to save the debug messages in another file, so I use /etc/newsyslog.conf to manage its rotation. That also allows you to put a cap on its size.
dinoex 2007-02-17 09:09:43 UTC FreeBSD ports repository Modified files: mail/milter-regex Makefile Added files: mail/milter-regex/files patch-quiet Log: - add flag -quiet PR: 106602 Submitted by: Denis Eremenko Revision Changes Path 1.18 +1 -0 ports/mail/milter-regex/Makefile 1.1 +51 -0 ports/mail/milter-regex/files/patch-quiet (new) _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
State Changed From-To: feedback->closed committed, thanks.
> Modify /etc/syslog.conf > (or advise the user to do so, post-install), with something > like this: > !milter-regex > daemon.debug /dev/null > daemon.!=debug /var/log/maillog In this case many unnecessary syslog() calls and data transfers still exists. Overhead.