Re: Timing tasks

2017-05-05 Thread Mikael Ståldal
Removed duplicate Timer class. On Tue, May 2, 2017 at 1:58 PM, Mikael Ståldal wrote: > Why is this class duplicated? Can't we remove the one in log4j-core? > > On Tue, May 2, 2017 at 4:59 AM, Ralph Goers > wrote: > >> We have had this since I started log4j. It is in both core and api as >> Tim

Re: Timing tasks

2017-05-02 Thread Dominik Psenner
Maybe implement an AutoClosableTimer that implements the AutoClosable interface [1]? I often take use of the using(something){} directive in C# and find it quite readable. [1] https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html On 2 May 2017 1:59 p.m., "Mikael Ståldal" wrote:

Re: Timing tasks

2017-05-02 Thread Mikael Ståldal
As far as I can see, the Timer class is in test only? On Tue, May 2, 2017 at 1:58 PM, Mikael Ståldal wrote: > Why is this class duplicated? Can't we remove the one in log4j-core? > > On Tue, May 2, 2017 at 4:59 AM, Ralph Goers > wrote: > >> We have had this since I started log4j. It is in both

Re: Timing tasks

2017-05-02 Thread Mikael Ståldal
Why is this class duplicated? Can't we remove the one in log4j-core? On Tue, May 2, 2017 at 4:59 AM, Ralph Goers wrote: > We have had this since I started log4j. It is in both core and api as > Timer. > > You can do > > Timer timer = new Timer(“Step1”); > …. > …. > timer.start() > … > … > … > t

Re: Timing tasks

2017-05-01 Thread Ralph Goers
We have had this since I started log4j. It is in both core and api as Timer. You can do Timer timer = new Timer(“Step1”); …. …. timer.start() … … … timer.stop(); LOGGERr.debug(timer); I had a version of this at one time that automatically logged when stop was called. That could easily be done

Re: Timing tasks

2017-05-01 Thread Gary Gregory
As parallel thought, I was thinking about adding timings on traceExit calls by creating a new Flow message factory (since you do not want to pay the price of calling System.nanos unless you want to.) The nanos would be tracked in a new class, SimpleEntryTimestampMessage (instead of SimpleEntryMess

Re: Timing tasks

2017-05-01 Thread Matt Sicker
That use case reminds me a bit of Zipkin/Brave, though that's more so for tracing between services than for local timing. I'm kind of wondering what kind of log4j api you could make from this, though. On 1 May 2017 at 20:56, Gary Gregory wrote: > Hi All: > > I find myself writing a lot of method

Timing tasks

2017-05-01 Thread Gary Gregory
Hi All: I find myself writing a lot of methods like: LOGGER.debug("Doing things with {}", foo); final StopWatch watch = StopWatch.createStarted(); // Do this // Do that // And then some watch.stop(); LOGGER.debug("Did foo things in {}", watc