logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Middleton <osfan6...@gmail.com>
Subject Re: Unix Timestamps
Date Thu, 01 Dec 2016 17:15:38 GMT
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.html

-Robert Middleton

On Thu, Dec 1, 2016 at 11:34 AM, Thorsten Schöning <tschoening@am-soft.de>
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 layout)? Optimally I would like a fractional
> > pattern showing microseconds.
>
> Is your question about the format or timezone handling? A format
> including fractionals is possible and the default already when only
> using "%d", but I'm pretty sure it's not supporting microseconds:
>
> > %d{yyyy-MM-dd HH:mm:ss,SSS}
> > 2016-12-01 17:20:43,764
>
> Have a look at the classes datepatternconverter, strftimedateconverter
> and simpledateformat, which is used depending on your configuration
> and might support timezone related stuff. At least there some "Z"
> mentioned in simpledatformat, resulting in a calculation of timezone
> offsets in "RFC822TimeZoneToken".
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
> AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
>
> Telefon...........05151-  9468- 55
> Fax...............05151-  9468- 88
> Mobil..............0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
>
>

Mime
View raw message