Unix Timestamps

2016-12-01 Thread Felix Endres
Hi, is it possible to print a unix timestamp, i.e. seconds since 1970 in the PatternLayout (or any other layout)? Optimally I would like a fractional pattern showing microseconds. Apparently log4j 2 has a "%d{UNIX}" pattern, but this just prints "UNIX" in log4cxx. I am using the ubuntu liblog

Re: Unix Timestamps

2016-12-01 Thread Thorsten Schöning
Guten Tag Felix Endres, am Donnerstag, 1. Dezember 2016 um 16:37 schrieben Sie: > is it possible to print a unix timestamp, i.e. seconds since 1970 in the > PatternLayout (or any other layout)? Optimally I would like a fractional > pattern showing microseconds. Is your question about the format o

Re: Unix Timestamps

2016-12-01 Thread Robert Middleton
If I'm understanding the code correctly, in your %d{} specifier, you can define a custom format using apr_strftime(). I'm assuming that this means you can use the standard strftime() specifiers, but the documentation for APR is somewhat lacking. http://man7.org/linux/man-pages/man3/strftime.3.htm

Re: Unix Timestamps

2016-12-01 Thread Felix Endres
In the man page you linked to I found *%s *The number of seconds since the Epoch, 1970-01-01 00:00:00 + (UTC). (TZ) (Calculated from/mktime(tm)/.) There is nothing under a second, so I combine it with %d{SSS}: log4j.appender.R.layout.ConversionPattern=[%p] [%d{%s}.%d{SSS}]: %m%

Re: Unix Timestamps

2016-12-01 Thread Felix Endres
Hello Thorsten Schöning, thank you for your quick answer. On 12/01/2016 05:34 PM, Thorsten Schöning wrote: Guten Tag Felix Endres, am Donnerstag, 1. Dezember 2016 um 16:37 schrieben Sie: is it possible to print a unix timestamp, i.e. seconds since 1970 in the PatternLayout (or any other layou