Subject: | Avoid running in POSIX::strftime issue on Windows |
Date: | Wed, 6 Jul 2011 09:55:24 +0000 |
To: | "bug-sys-syslog [...] rt.cpan.org" <bug-sys-syslog [...] rt.cpan.org> |
From: | Michael Ludwig <m.ludwig [...] epages.com> |
It very much looks like POSIX::strftime() on Windows doesn't digest the %e format element, which denotes the day of month (without a zero prepended for single-digit days):
perl5.14.1 -MPOSIX=strftime -lwe "print strftime q(%b %e %H:%M:%S), localtime"
:: output with %e: %b %e %H:%M:%S
So %e is similar to %d, which adds the leading zero for single-digit days, and has the benefit of being supported on Windows:
perl5.14.1 -MPOSIX=strftime -lwe "print strftime q(%b %d %H:%M:%S), localtime"
:: output with %d: Jul 06 11:45:54
Tested with ActiveState 5.10.1, 5.12.3 and 5.14.1, as well as with a home-compiled 5.12.3 on Windows.
This leaves entries like this in syslog (rsyslog on a Linux host):
Jul 5 19:39:16 192.168.56.1 %b %e %H:%M:%S syslog.pl[7336]: wichtige Durchsage
Not fatal, but not nice either. With %d instead of %e, there is no such artefact. So maybe Sys::Syslog could be fixed to include the more portal %d format element? Patch against version 0.29 attached.
Thanks,
Michael Ludwig
Message body is not shown because sender requested not to inline it.