logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: epoch time format for logging
Date Tue, 01 Oct 2013 03:33:39 GMT
Hello Ed,

This is what Log4j 2 can do now WRT to time stamp formatting:
https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout

When you say epoch time, do you mean simply that you would like to use the
result of java.lang.System.currentTimeMillis() ?

Gary


On Mon, Sep 30, 2013 at 8:30 PM, Edward Peschko <horos11@gmail.com> wrote:

> All,
>
> For reasons of simplicity && consistency, I would like to have my logs
> have epoch time (plus milliseconds) as their format. I figure:
>
> 1. this should be the most efficient way to get a timestamp
> 2. it is completely clear - unlike local time, or partial times (eg.
> HH:MM:SS) there is no question of exactly when the event occurred.
> 3. it is concise - only taking 10 (or 14 with ms timestamp) characters.
> 4. it is exceedingly easy to do date arithmetic with it
> 5. it can searched as a number hence finding ranges in which events
> occured in very large files is a simple, binary search.
>
> Anyways, looking through the docs for log4j, I didn't see any docs on
> how to do this. Is it possible, and if not currently possible, how
> easy would it be to add it?
>
> Again, I'd like to standardize all my logs on this, so any info on how
> to do it is appreciated..
>
> Thanks much,
>
> Ed
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message