Skip to content
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

Remove use of standard streams - introduce logging framework? #802

Closed
gotson opened this issue Nov 3, 2022 · 6 comments
Closed

Remove use of standard streams - introduce logging framework? #802

gotson opened this issue Nov 3, 2022 · 6 comments
Labels
enhancement released Issue has been released review wanted This needs more eyes

Comments

@gotson
Copy link
Collaborator

gotson commented Nov 3, 2022

The existing code relies of System.err and e.printStackTrace() to output errors:

  • mostly in SQLiteJDBCLoader
  • there is some usage in OSInfo, but this can run as a command line so it should not be a problem
  • in some places in JDBC3DatabaseMetaData

In some places we also use DriverManager.println which seems to be the correct way to print JDBC connection related logs.

I would be enclined to remove the use of standard streams, and use a logging framework instead. Given we support Java 8, SLF4J is probably the best bet, though i noticed they finally released their 2.0 version, which kinda breaks existing apps.

Comments are welcome.

@gotson gotson added enhancement review wanted This needs more eyes labels Nov 3, 2022
@michael-o
Copy link
Contributor

You have basically two options: SLF4J 1.7.x or JUL (the API, not the implementation). Have you checked with other popular JDBC drivers?

@gotson
Copy link
Collaborator Author

gotson commented Nov 8, 2022

I think i have read somewhere that JUL before 1.9 was a no-no, but can't remember the details. Would need to investigate further.

@gotson
Copy link
Collaborator Author

gotson commented Nov 8, 2022

Have you checked with other popular JDBC drivers?

@gotson
Copy link
Collaborator Author

gotson commented Nov 8, 2022

I think i have read somewhere that JUL before 1.9 was a no-no, but can't remember the details. Would need to investigate further.

Actually it's not about JUL, but JDK9 introduced System.Logger, which is akin to SLF4J. Some resources i found about it:

@gotson
Copy link
Collaborator Author

gotson commented Nov 8, 2022

In some places we also use DriverManager.println which seems to be the correct way to print JDBC connection related logs.

I checked on the web and could not find any good source of information about this. It's not used in pgjdbc nor H2 either.

If anyone has some information on that, i am quite interested.

@github-actions
Copy link
Contributor

🎉 This issue has been resolved in 3.43.2.0 (Release Notes)

@github-actions github-actions bot added the released Issue has been released label Oct 13, 2023
gotson added a commit to gotson/sqlite-jdbc that referenced this issue Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement released Issue has been released review wanted This needs more eyes
Projects
None yet
Development

No branches or pull requests

2 participants