Skip to content

Comments

[MINOR] Clean up of isDebugEnabled() usages#2435

Draft
e-strauss wants to merge 5 commits intoapache:mainfrom
e-strauss:is-debug-clean-up
Draft

[MINOR] Clean up of isDebugEnabled() usages#2435
e-strauss wants to merge 5 commits intoapache:mainfrom
e-strauss:is-debug-clean-up

Conversation

@e-strauss
Copy link
Contributor

@e-strauss e-strauss commented Feb 18, 2026

This PR is a followup to #2432 .
We have 131 Usages of LOG.isDebugEnabled()

grep -rnF "LOG.isDebugEnabled" src/main/java/org/apache/sysds | wc -l
131

This PR adds a new utils for Parameterized Logging

LOG.debug("Begin Function {%15d}", fkey);
// instead of
if(LOG.isDebugEnabled){
    LOG.debug(String.format("Begin Function %15d", fkey))
}

This helps with readability and simplifies code coverage

if(LOG.isDebugEnabled())
LOG.debug("Begin Function "+fkey);

LOG.debug("Begin Function " + fkey);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

@e-strauss e-strauss Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be cool, but we should not change the logging framework, so we just need to verify.

@e-strauss e-strauss marked this pull request as draft February 18, 2026 12:26
@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

❌ Patch coverage is 90.76305% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.52%. Comparing base (3f7b17b) to head (506b17b).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...va/org/apache/sysds/utils/ParameterizedLogger.java 89.85% 3 Missing and 4 partials ⚠️
...a/org/apache/sysds/hops/codegen/SpoofCompiler.java 40.00% 4 Missing and 2 partials ⚠️
.../runtime/controlprogram/caching/CacheableData.java 42.85% 2 Missing and 2 partials ⚠️
...che/sysds/runtime/lineage/LineageRewriteReuse.java 81.25% 3 Missing ⚠️
...apache/sysds/hops/rewrite/RewriteInjectOOCTee.java 60.00% 2 Missing ⚠️
...s/runtime/instructions/fed/InitFEDInstruction.java 83.33% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants