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/04/19 17:21:13 UTC

[Bug 6418] New: Cannot Log to stderr without timestamps

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

           Summary: Cannot Log to stderr without timestamps
           Product: Spamassassin
           Version: 3.3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: spamc/spamd
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: kyle-spamassassin-bugzilla@memoryhole.net


Duplicate of ancient bug, which has now reappeared: 
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=3845

Now need simple patch to Logger/Stderr.pm

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

[Bug 6418] Cannot Log to stderr without timestamps

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6418

Kyle Wheeler <ky...@memoryhole.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kyle-spamassassin-bugzilla@
                   |                            |memoryhole.net

--- Comment #2 from Kyle Wheeler <ky...@memoryhole.net> 2010-04-19 13:42:15 EDT ---
A configuration switch makes perfect sense to me.

As far as locking pipes goes... I don't know how exactly that's relevant to
this issue, but I would imagine that it *tends* to be safe because it's usually
done with buffered I/O---which makes parallel flushes less likely. According to
http://www.unixguide.net/unix/programming/2.10.5.shtml, if each piece of data
written to the pipe by multiple parallel processes is less than PIPE_BUF
(usually 512 bytes) in size, then they will not be interleaved. At least,
that's on *nix; it may make sense to use a lock on Windows. On Unix it seems
like it may be sufficient to avoid log lines bigger than 512 bytes (of course,
a lock is both simple and safe).

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

[Bug 6418] Cannot Log to stderr without timestamps

Posted by bu...@issues.apache.org.
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.

[Bug 6418] [review] Cannot Log to stderr without timestamps

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6418

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kmcgrail@pccc.com
  Status Whiteboard|needs 2 votes               |needs 1 votes

--- Comment #7 from Kevin A. McGrail <km...@pccc.com> 2011-05-05 20:04:51 UTC ---
(In reply to comment #6)
> Seems to work nicely for what I need it to do; and seems to address everyone's
> needs. Excellent!

+1 KAM

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

[Bug 6418] [review] Cannot Log to stderr without timestamps

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6418

--- Comment #6 from Kyle Wheeler <ky...@memoryhole.net> 2010-06-08 12:43:40 EDT ---
Seems to work nicely for what I need it to do; and seems to address everyone's
needs. Excellent!

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

[Bug 6418] Cannot Log to stderr without timestamps

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6418

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |3.3.2

--- Comment #1 from Mark Martinec <Ma...@ijs.si> 2010-04-19 11:50:33 EDT ---
> Duplicate of ancient bug, which has now reappeared: 
> https://issues.apache.org/SpamAssassin/show_bug.cgi?id=3845
> 
> Now need simple patch to Logger/Stderr.pm

Seems there is a conflict of interests, timestamps on stderr were
intentionally added in 3.3.0 (Bug 6231), without realizing
they were once already removed. Seems to me like we need an option
to turn them on or off, perhaps the patch on Bug 3845 comment 8.

Btw, I have my doubts that logging to a single file or pipe
by multiple concurrent processes works reliably without locking.

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

[Bug 6418] [review] Cannot Log to stderr without timestamps

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6418

--- Comment #8 from Michael Parker <pa...@pobox.com> 2011-05-10 17:00:02 UTC ---
+1

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

[Bug 6418] Cannot Log to stderr without timestamps

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6418

--- Comment #5 from Mark Martinec <Ma...@ijs.si> 2010-06-08 12:03:45 EDT ---
I should also mention - in view of a comment #2 - that Logger::Stderr
now (with the patch) uses syswrite instead of printf, just like the
Logger::File does. One level of buffering less.

Kyle, could you please see if this suits your needs.

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

[Bug 6418] [review] Cannot Log to stderr without timestamps

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6418

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Cannot Log to stderr        |[review] Cannot Log to
                   |without timestamps          |stderr without timestamps
  Status Whiteboard|                            |needs 2 votes

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

[Bug 6418] Cannot Log to stderr without timestamps

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6418

--- Comment #4 from Mark Martinec <Ma...@ijs.si> 2010-06-08 11:58:27 EDT ---
trunk:
  Bug 6418: Cannot Log to stderr without timestamps;
  provide option --log-timestamp-fmt to spamd
Sending lib/Mail/SpamAssassin/Logger/File.pm
Sending lib/Mail/SpamAssassin/Logger/Stderr.pm
Sending lib/Mail/SpamAssassin/Logger/Syslog.pm
Sending spamd/spamd.raw
Committed revision 952706.

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

[Bug 6418] [review] Cannot Log to stderr without timestamps

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6418

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
  Status Whiteboard|needs 1 votes               |ready to commit

--- Comment #9 from Mark Martinec <Ma...@ijs.si> 2011-05-10 17:27:30 UTC ---
3.3:
  Bug 6418: Cannot Log to stderr without timestamps'
  Sending lib/Mail/SpamAssassin/Logger/File.pm
  Sending lib/Mail/SpamAssassin/Logger/Stderr.pm
  Sending lib/Mail/SpamAssassin/Logger/Syslog.pm
  Sending spamd/spamd.raw
Committed revision 1101555.

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