You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Niranjan Rao <nh...@gmail.com> on 2021/09/30 21:55:37 UTC
Is there a way to log time format in miliseconds
Greetings,
On log4j2.
I have tried obvious searches and it was immediately clear to me. I'm
looking for a way to get the time stamp similar to value returned by
System.currentTimeMillis().
Also want to ensure I can log both human readable and (more) machine
readable formats based on format string. We have some other log files
which can't use log4j and just log Sytem.currentTimeMilis as the time
stamp and it gets very interesting to match timestamps.
Regards,
Niranjan
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Is there a way to log time format in miliseconds
Posted by Carter Kozak <ck...@ckozak.net>.
You should be able to use include the following in your pattern: %d{UNIX_MILLIS}
From the docs: https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout
Best,
-ck
On Thu, Sep 30, 2021, at 17:55, Niranjan Rao wrote:
> Greetings,
>
> On log4j2.
>
> I have tried obvious searches and it was immediately clear to me. I'm
> looking for a way to get the time stamp similar to value returned by
> System.currentTimeMillis().
>
> Also want to ensure I can log both human readable and (more) machine
> readable formats based on format string. We have some other log files
> which can't use log4j and just log Sytem.currentTimeMilis as the time
> stamp and it gets very interesting to match timestamps.
>
> Regards,
>
> Niranjan
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org