Skip to content

Comments

#404: allow logging via SLF4J#1710

Draft
hohwille wants to merge 68 commits intodevonfw:mainfrom
hohwille:jan-vcapgemini-enhance/404-logging-concept
Draft

#404: allow logging via SLF4J#1710
hohwille wants to merge 68 commits intodevonfw:mainfrom
hohwille:jan-vcapgemini-enhance/404-logging-concept

Conversation

@hohwille
Copy link
Member

@hohwille hohwille commented Feb 19, 2026

This PR fixes #404

Implemented changes:

  • Keep static instance of IdeLoggerImpl and expose via static IdeLogger.get() method.
  • Added Markers class to mimic custom IDEasy log-levels in SLF4J via according Marker instances.
  • Implemented SLF4JServiceProvider, ILoggerFactory, and Logger from SLF4J for IDEasy.
  • In Slf4jLoggerAdapter create java.util.logging.Logger for external loggers and use IdeLogger for internal ones and route log messages accordingly.
  • Changed IdeSystemImpl to use static SLF4J logger instead of injecting IdeLogger into constructor.
  • Via the tests I verified the new concept works via IdeSystemImpl.

We still need to verify that 3rd party code now does not log into our regular console output in production usage. I would currently guess that this will happen and consider it a bug that needs to be fixed before merge.
Solved. However, I have a problem that ProcessBuilder is automatically logging a new RuntimeException due to a bug in the JDK (java.util.logging does not handle log-level threshold correct). I am trying to trace this down but it seems to be deeply hidden in the JDK logging system and since I activate java.util.logging but ProcessBuilder logs via java.util.logging and not via SLF4J I cannot hook in between.

FYI: With this feature we could now even implement that IdeLoggerImpl can delegate to java.util.logging.Logger if some special global option is activated and we could also instruct java.util.logging to additionally write a log file to preserve log information for later lookup.
Already implemented - I used a new variable that is active by default and can be disabled by the user.


Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled
    with internal

Kian and others added 30 commits October 2, 2024 16:17
# Conflicts:
#	cli/src/main/java/com/devonfw/tools/ide/cli/Ideasy.java
renamed TestLogger to IdeLoggerAdapter
added missing param to javadoc
renamed TestProvider to TestProviderImpl
renamed TestLoggerFactory to TestLoggerFactoryImpl
added first implementations for IdeLoggerAdapter methods
replaced IdeSubLoggerSlf4j with IdeSubLoggerOut
added null checks to IdeLoggerAdapter debug methods
added rest of null checks
@hohwille hohwille added this to the release:2026.03.001 milestone Feb 19, 2026
@hohwille hohwille self-assigned this Feb 19, 2026
@hohwille hohwille added enhancement New feature or request logging IDEasy specific logging (levels, messages, etc.) internal Nothing to be added to CHANGELOG, only internal story labels Feb 19, 2026
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Feb 19, 2026
@coveralls
Copy link
Collaborator

coveralls commented Feb 19, 2026

Pull Request Test Coverage Report for Build 22264313095

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 709 unchanged lines in 32 files lost coverage.
  • Overall coverage increased (+0.2%) to 70.645%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/commandlet/CreateCommandlet.java 1 93.33%
com/devonfw/tools/ide/log/IdeSubLoggerOut.java 1 85.29%
com/devonfw/tools/ide/os/MacOsHelper.java 1 84.42%
com/devonfw/tools/ide/commandlet/HelpCommandlet.java 2 94.29%
com/devonfw/tools/ide/log/IdeLoggerImpl.java 2 89.06%
com/devonfw/tools/ide/tool/node/Node.java 2 81.25%
com/devonfw/tools/ide/variable/IdeVariables.java 2 93.88%
com/devonfw/tools/ide/context/IdeStartContextImpl.java 3 90.24%
com/devonfw/tools/ide/commandlet/AbstractVersionOrEditionGetCommandlet.java 4 87.3%
com/devonfw/tools/ide/commandlet/ContextCommandlet.java 4 85.96%
Totals Coverage Status
Change from base Build 22187698026: 0.2%
Covered Lines: 10696
Relevant Lines: 14534

💛 - Coveralls

@hohwille hohwille moved this from 🆕 New to Team Review in IDEasy board Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request internal Nothing to be added to CHANGELOG, only internal story logging IDEasy specific logging (levels, messages, etc.)

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

enhance logging concept

4 participants