In the man page you linked to I found
*%s *The number of seconds since the Epoch, 1970-01-01 00:00:00
+0000 (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%n
> [INFO] [1480614023.833]: message
Works for me :-)
Thank you so much!
Felix
On 12/01/2016 06:15 PM, Robert Middleton wrote:
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
<tschoen...@am-soft.de <mailto:tschoen...@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.schoen...@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
--
Dr. Felix Endres
Roboception GmbH
Kaflerstr. 2
81241 München
phone: +49 89 8895 079 - 15
eMail: felix.end...@roboception.de
web: http://www.roboception.de
Sitz der Gesellschaft: Roboception GmbH, Kaflerstr. 4, 81241 München
Registereintrag: Amtsgericht München HRB 217783
Geschäftsführer: Dr. Michael Suppa
USt. Ident. Nr.: DE299379772
Die in dieser E-Mail und den dazugehörigen Anhängen enthaltenen Informationen
sind nur für den Adressaten bestimmt und können vertrauliche und/oder rechtlich
geschützte Informationen enthalten. Jeglicher Zugriff auf diese E-Mail durch
andere Personen als den Adressaten ist untersagt. Sollten Sie diese Nachricht
irrtümlich erhalten haben, benachrichtigen Sie bitte den Absender und löschen
Sie diese Nachricht unverzüglich ohne sie zu kopieren oder zu verteilen oder
ihren Inhalt an andere Personen weiterzugeben.
The information contained in this e-mail and any attachments is intended for
the addressee only and may contain confidential and/or legally privileged
information. Access to this e-mail by anyone else is unauthorized. If you have
received this message by mistake please notify the sender, delete it
immediately and do not copy or distribute it or disclose its contents to anyone.