The official documentation mentions that performance is hit [1] with metrics.
[1] https://logging.apache.org/log4j/2.x/performance.html#asyncLoggingWithParams On Tue, Dec 11, 2018 at 7:19 PM Mathieu Lirzin <[email protected]> wrote: > > Hello Michael, > > Michael Brohl <[email protected]> writes: > > > Yes, right, but it's certainly less costly than the direct execution > > of Debug.logXxxx... And that's the point. You don't want to run these > > statments thousands of times within a minute (in production systems), > > which is the case in central functionality like the controller. > > According to Rémi Forax's numbers this assumption is *not* verified! [1] > > He gets exactly the same performance results (1.08× ns/op) with either > of the following options: > > 1) Debug.log("...") > 2) if (Debug.isEnabled()) { Debug.log("...") } > 3) Debug.log(() -> "...") > > > Who cares? Each improvement is a gain and if we only introduce these > > conditions in the hotspot functionality, it's an improvement. > > > > It's not only black and white... > > I think that any claim of performance gain/loss must be backed by an > actual measurement, and this has not been the case in this discussion. > > Personnally I care about the readability of the code and choosing the > option 2 is not helping in that regard. > > [1] https://youtu.be/z5UkoLaW6ME?t=213 > > -- > Mathieu Lirzin > GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37
