Skip to content

Conversation

nickgaray
Copy link
Collaborator

Under Java 21 the StaticLogger is no longer available so the dependencies needed updating and the logic to create loggers had to change to resolve a registered logger implementation for Log4J other than default NOP logger (no operation)

return LoggerFactory.getLogger(module.getClass());

}

Copy link
Member

Choose a reason for hiding this comment

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

What error were you getting before this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J(W): Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J(W): Ignoring binding found at [jar:file:/E:/COMMON/osh-node/build/distributions/osh-node-2.0-beta2/lib/logback-classic-1.2.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J(W): Ignoring binding found at [jar:file:lib/logback-classic-1.2.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J(W): See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.

I was seeing this issue, unfortunately, this morning I cannot reproduce. However, updating the build.gradle file noted with this PR to use

  api 'ch.qos.logback:logback-classic:1.5.13'
  api 'com.fasterxml.woodstox:woodstox-core:6.4.0'

Does eliminate CVEs in builds, and I was running yesterday with these updates.

I think I can just sit on this and see if I can reproduce the issue,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hold on I just reproduced the build break...

Copy link
Collaborator Author

@nickgaray nickgaray Sep 25, 2025

Choose a reason for hiding this comment

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

Task :osh-core:sensorhub-core:compileJava FAILED
E:\CUBIC\osh-node\include\osh-core\sensorhub-core\src\main\java\org\sensorhub\utils\ModuleUtils.java:31: error: package org.slf4j.impl does not exist
import org.slf4j.impl.StaticLoggerBinder;

  • on master branch, after wiping all builds
  • using OpenLogic OpenJDK 21.0.8
  • building on Windows 11

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Using CoPilot to assess the issue

You're encountering this error because SLF4J version 2.x no longer uses the StaticLoggerBinder class. Instead, it relies on the Java ServiceLoader mechanism to discover logging implementations at runtime.

🔍 What's Happening
The org.slf4j.impl.StaticLoggerBinder class was part of SLF4J 1.x.

In SLF4J 2.x, this static binding mechanism was removed.

If you're using SLF4J 2.x but trying to import StaticLoggerBinder, you'll get the "package does not exist" error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am able to reproduce when building SensorHub Test, but it is odd because it is intermittently breaking while other times exhibiting the following "warning"

SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J(W): Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J(W): Ignoring binding found at [jar:file:/C:/Users/Nicolas%20Garay/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.13/e9f3458e7354fe4917081237c01fa4999f4e1b86/logback-classic-1.2.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J(W): See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants