[logback-dev] Reason of taking timeStamp in the end of LoggingEvent constructor?
Truuba
truuba at gmail.com
Thu Sep 21 11:48:04 CEST 2017
Hi
I was wondering, and actually have been a bit confused, that the *timeStamp
*of a logging event is taken in the end of the *LoggingEvent *constructor.
Just without further thinking, I would place this to the beginning of the
constructor to be as near as possible to the actual event.
Now thinking a bit further, placing the *timeStamp *to the beginning seems
only getting more reasonable.
The constructor contains logic, which depends on the given parameters. This
logic will take some time, depending if the current event has a *throwable *or
not. This time will be implicitly added as offset to the original event.
If I create two logs within a very close time (few ms), one containing
a *throwable
*and one without, it might even happen, that the original order isn't
guaranteed anymore, as, due the offset of the constructor running time, the
first event finally might have a later time stamp than the second.
So what is the design reason of taking the *timeStamp *in the end? I don't
see a single benefit.
Of course I still might have understood something wrong.
regards
marco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-dev/attachments/20170921/9cef263e/attachment.html>
More information about the logback-dev
mailing list