]> git.ipfire.org Git - thirdparty/util-linux.git/commit
logger: fix invalid timestamp regression in local format
authorRainer Gerhards <rgerhards@adiscon.com>
Thu, 5 Mar 2015 14:20:50 +0000 (15:20 +0100)
committerRainer Gerhards <rgerhards@adiscon.com>
Thu, 5 Mar 2015 14:20:50 +0000 (15:20 +0100)
commit3070ca77ac3b3a99b5392f0d192b71ff872e7109
treeac17052f7023e60fd6c125fe881b66b7d0507fcf
parentb9dedd3d34cb6d340c7dc229b598d4580c704c8c
logger: fix invalid timestamp regression in local format

Since 1d57503378bdcd838365d625f6d2d0a09da9c29d logger no longer uses
the syslog(3) call. The way the local timestamp is generated did not
match the syslog(3) format. Most importantly, the month name is
formatted based on the user's local. For example:

$ ./logger --stderr  test with logger 2.26.39-eb651-dirty
<5>Mär  5 14:17:47 logger: test with logger 2.26.39-eb651-dirty

"Mär" like in German "März" for "March".

previously:
$ logger --stderr  test with logger 2.25.2
rger: test with logger 2.25.2

In the system log file, this results to the following:

Mar  5 14:17:47 host Mär  5 14:17:47 logger: test with logger 2.26.39-eb651-dirty
Mar  5 14:18:01 host rger: test with logger 2.25.2

This local naming is invalid as of RFC3164. One may argue that
the local log socket traditionally does not have RFC3164 format,
but the timestamp always was as defined in RFC3164 (and along
the lines of the ctime() call). Anything else would also be impractical,
as a syslog parser would otherwise need to know about all
potential locale-specific representations of month names.

This patch corrects the problem and also refactors the timestamp
handling a bit. The same timestamp is needed in local and rfc3164
processing, so there now is a new function to create that stamp.
misc-utils/logger.c