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
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
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
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
Thank you, I'll give it a go.
Gary
On Sun, Apr 30, 2017 at 2:51 PM, Ralph Goers
wrote:
> If it already is monitoring files, no. You can just add your FileWatcher.
> If it is not then you need to cause the monitoring interval to be set to a
> non-zero value.
>
> Ralph
>
> > On Apr 30, 2017, at 2