You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@issues.apache.org on 2010/06/08 17:55:59 UTC

[Bug 6418] Cannot Log to stderr without timestamps

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6418

--- Comment #3 from Mark Martinec <Ma...@ijs.si> 2010-06-08 11:55:53 EDT ---
Created an attachment (id=4771)
 --> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4771)
Proposed patch adds spamd option --log-timestamp-fmt

The attached patch makes it possible to turn off timestamps in the 'stderr'
and 'file' loggers, or to provide a nondefault POSIX strftime(3) format
for timestamps in the log.

The --syslog option is already heavily overloaded with stderr and file
semantics (which should be un-convoluted some day), which is why I
chose to provide a separate option to control timestamps in the log.
As a side effect, it is now also possible to specify a non-default
strftime(3) format, or to turn timestamps off, or just keep a default.

Considering that each of the provided loggers (syslog, stderr, file)
currently has its own idea on timestamps, the proposed change retains
ability of each logger to retain its default timestamp format, or to
receive an explicit format through option 'timestamp_fmt' during
creation (new()) of each logger object.

The spamd is modified to pass the 'timestamp_fmt' option when creating
or replacing a logger. Below is the added documentation bit on spamd.

There is no change to spamassassin (which cannot change the timestamp
format), and no change required for third party callers of the SpamAssassin
library (which may choose to change the format or leave it to its default).


--log-timestamp-fmt=fmt   strftime(3) format for timestamps, may be
                           empty to disable timestamps, or 'default'

The --log-timestamp-fmt option can provide a POSIX strftime(3) format for
timestamps included in each logged message. Each logger (stderr, file,
syslog) has its own default value for a timestamp format, which applies when
--log-timestamp-fmt option is not given, or with --log-timestamp-fmt=default .
Timestamps can be turned off by specifying an empty string with this
option, e.g. --log-timestamp-fmt='' or just --log-timestamp-fmt= .
Typical use: --log-timestamp-fmt='%a %b %e %H:%M:%S %Y' (provides
localized weekday and month names in the ctime(3) style),
or '%a, %e %b %Y %H:%M:%S %z (%Z)' for a RFC 2822 format,
or maybe '%Y-%m-%d %H:%M:%S%z' for an ISO 8601 (EN 28601) format,
or just '%Y%m%dT%H%M%S' .

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.