I agree with Jacopo. String concatenation is a relatively expensive operation because strings are immutable and this is exactly why the log4j library provides the checking methods. I would also note that you need these checking functions the most when the call is most utilized (verbose or debug).
On Dec 11, 2017 11:55 AM, "Jacopo Cappellato" < jacopo.cappell...@hotwaxsystems.com> wrote: On Mon, Dec 11, 2017 at 9:31 AM, Jacques Le Roux < jacques.le.r...@les7arts.com> wrote: > [...] > Also for OFBIZ-9872 the Jira lacks a description to possibly understand > why theses changes (notably why you rightly removed the "if > (Debug.verboseOn())" test because it's done at the bottom level with "if > (isOn(level)) {" > There is actually a valid reason for maintaining the pattern: if (Debug.verboseOn()) { Debug.logVerbose(string + concatenation + here); } In fact string concatenation (in any of its forms) adds some overhead (computational, memory, garbage collection); since the string concatenation is done before calling Debug.logVerbose (or similar methods), but it is only useful if that log level is on (otherwise the call to logVerbose will not produce any output) then it is wise to perform the verboseOn() check before: if the call returns a false then at runtime the sting concatenation will not be executed at all. Jacopo