[MINOR] Clean up of isDebugEnabled() usages#2435
[MINOR] Clean up of isDebugEnabled() usages#2435e-strauss wants to merge 5 commits intoapache:mainfrom
Conversation
| if(LOG.isDebugEnabled()) | ||
| LOG.debug("Begin Function "+fkey); | ||
|
|
||
| LOG.debug("Begin Function " + fkey); |
There was a problem hiding this comment.
The main difference here, is that the LOG.isDebugEnabled() is very cheap, while the string concatenation can be very expensive. Unfortunately to call the LOG.debug java has to resolve the string variable input, and that is the main time used, especially if Logging is disabled.
I do not know if there is a way to avoid the string concatenation, or somehow getting it delayed to after the logging is analysed to be off.
There was a problem hiding this comment.
I see your point, but isnt it in practice in micro-level noise for these simple concats? i think we might over-engineer here
Why are we sticking to apache commons logging? with the newer SLF4J we would could do stuff like this:
LOG.debug("Begin Function {}", fkey);also SLF4J might already be used inside apachae commons logging, since it's already in the pom
There was a problem hiding this comment.
This would be cool, but we should not change the logging framework, so we just need to verify.
940746b to
423df5c
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2435 +/- ##
============================================
- Coverage 71.55% 71.52% -0.03%
- Complexity 47461 47849 +388
============================================
Files 1539 1555 +16
Lines 182631 184607 +1976
Branches 35919 36176 +257
============================================
+ Hits 130677 132036 +1359
- Misses 41944 42384 +440
- Partials 10010 10187 +177 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
423df5c to
7ad7181
Compare
cd23f73 to
d61285d
Compare
This PR is a followup to #2432 .
We have 131 Usages of LOG.isDebugEnabled()
This PR adds a new utils for Parameterized Logging
This helps with readability and simplifies code coverage