Skip to content

feat(logging): add support for System.Logger and deprecate Logging #1648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025

Conversation

injectives
Copy link
Contributor

@injectives injectives commented May 13, 2025

BREAKING CHANGE: the default driver logging implementation has been changed from Logging#none() to Logging.systemLogging().

The logging abstraction has been deprecated in favour of the System.Logger. Specifically, this applies to the following::

  • org.neo4j.driver.Logging
  • org.neo4j.driver.Logger
  • org.neo4j.driver.Config.ConfigBuilder#withLogging(Logging)
  • org.neo4j.driver.Config#logging()

Once the logging abstraction is deleted, the driver is expected to use the System.Logger only.

@injectives injectives changed the title feat(logging): add support for System.Logger and deprecate Driver Log… feat(logging): add support for System.Logger and deprecate Logging May 13, 2025
@injectives injectives force-pushed the feature/logging branch 13 times, most recently from 18fb9e5 to 15c4c27 Compare May 19, 2025 09:07
BREAKING CHANGE: the default driver logging implementation has been changed from `Logging#none()` to `Logging.systemLogging()`.

The logging abstraction has been deprecated in favour of the `System.Logger`. Specifically, this applies to the following:
- `org.neo4j.driver.Logging`
- `org.neo4j.driver.Logger`
- `org.neo4j.driver.Config.ConfigBuilder#withLogging(Logging)`
- `org.neo4j.driver.Config#logging()`

Once the logging abstraction is deleted, the driver is expected to use the `System.Logger` only.
Copy link
Contributor

@michael-simons michael-simons left a comment

Choose a reason for hiding this comment

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

It works in my test, but while I said I really don't mind for the future JUL or System.logger, do you think it is wise to replace JUL with System.logger as part of the deprecation per default?
It would be good to offer the System.logger variant, but keep the JUL logger as default (since you didn't delete it (and if you would, I wouldn't have approved the PR))

Especially as we stated this including and mentioning even the level

  • Provide a logging implementation for the driver to use. Java logging framework {@link java.util.logging} with {@link Level#INFO} is used by default.
  • Callers are expected to either implement {@link Logging} interface or provide one of the existing implementations available from static factory
  • methods in the {@link Logging} interface.

I don't think it's too hard to construct a scenario in which people are relying on that, and they will see a bit of a surprise, without warning.

In the end, I leave it to your judgement.
Maybe I overthink the switch, but we have seen the oddest issues with changing the logging in the core product, and the issues created in some constellations with bridges, fascade etc being on the class path or not (both variants caused trouble).

@injectives
Copy link
Contributor Author

@michael-simons, thank you for having a look at this PR! 👍

do you think it is wise to replace JUL with System.logger as part of the deprecation per default?

The current default is actually no logging (Logging#none()). This has been the case since August 2021, basically since 4.4.0 release as part of the drivers unification process. Unfortunately, that part of documentation was not updated back then. This PR finally updates it.

So, we are not actually changing from JUL to System Logger, we are changing from no logging to System Logger.

@michael-simons michael-simons merged commit 88fc56e into neo4j:6.x May 27, 2025
20 checks passed
@injectives injectives deleted the feature/logging branch May 27, 2025 13:13
@Sineaggi
Copy link

@michael-simons FWIW the System.Logger defaults to JUL if JUL is available (i.e. the logger module hasn't been jlinked out) and that's the only logger available. Otherwise, in production systems most devs would use Logback/Log4j, both of which offer System.Logger implementations.

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.

3 participants