Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
1.1.7
-
None
-
Windows + JDK 1.7.0_49
Description
Hi,
As i know, The debug check is done twice, once in the conditional test - then again in the debug() method. While doing this operation twice is probably trivial to the overall performance of the app. It is inefficient - and a poor use of CPU cycles. Slf4j provided “parameterized logging” which prevents string concatenation, and does the debug check only once.
I have done performance testing with using classic log back with slf4j API. I set LOG LEVEL is ERROR.
private static final Logger LOG = LoggerFactory.getLogger(MyClass.class);
Case 1:
if(LOG.isDebugEnabled()) { LOG.debug("any message from {}", myName); }
Case :2 without isDebugEnabled Check
LOG.debug("any message from {}", myName);
In Case 2, I found that classic logback takes time in checking DEBUG Enable.