On Aug17, 2011, at 20:25 , Greg Banks wrote: > On 18/08/11 07:26, Greg Banks wrote: >> >> On 18/08/2011, at 3:09, Michael Loftis <mlof...@wgops.com> wrote: >> >> Sure, but Dmitry does have a point that the error message appearing only in >> syslog is an unexpected behaviour for a commandline utility. >> >> This is a widespread issue in Cyrus, where lots of common code was clearly >> designed to live in a server, and it has made adding unit tests that little >> bit more challenging. For example the unit test framework now intercepts >> calls to the exit() libc routine and turns that into a longjmp() out to the >> test failure code. It also intercepts syslog() and pattern matches the >> message so that tests can pass or fail depending on the occurrence or not of >> log messages. >> >> There's also the opposite problem of error handling code which calls both >> syslog and fprintf(stderr), one after the other. That's just silly, >> especially given that many modern syslog implementations have a LOG_STDERR >> flag that will copy all syslog messages to stderr also. > > Incidentally, there is a bugzilla for this > > https://bugzilla.cyrusimap.org/show_bug.cgi?id=2924 > > with a very old patch from Florian Pflug. > > Dmitry, if you're able to contribute perhaps you could update that patch for > the 2.4 and master branches, and also remove some of the duplicated > syslog+stderr logging calls? I'm sure it would be much appreciated.
Here's an updated version of that patch rebased onto 2.4. I'm using this on a production machine and haven't had problems so far, so I'm reasonably confident that it works as designed. I've also attach this to the bugzilla entry. best regards, Florian Pflug
syslog_to_stderr.patch
Description: Binary data