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

Use slf4j+java.util.logging for logging needs. #383

Merged
merged 31 commits into from
Dec 21, 2021
Merged

Conversation

remeh
Copy link
Contributor

@remeh remeh commented Dec 20, 2021

JMXFetch needs for logging features are fairly small, this PR is switching all the logging to use java.util.logging SLF4J bindings.

All features (file logging with rotation, stdout, stderr, log levels, rfc3339 date time format support) should still be present.

Some rough performances tests have been used to confirm that JMXFetch still performs well when it logs a lot, even if it is not really verbose in default scenarios.

This PR bumps SLF4J from 1.7.26 to 1.7.32.

Copy link
Member

@olivielpeau olivielpeau left a comment

Choose a reason for hiding this comment

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

Thanks! I haven't reviewed the CustomLogger changes in details, but the log level conversion looks good to me. Left a few nit comments.

.gitignore Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
src/main/java/org/datadog/jmxfetch/util/LogLevel.java Outdated Show resolved Hide resolved
src/main/java/org/datadog/jmxfetch/util/LogLevel.java Outdated Show resolved Hide resolved
Copy link
Contributor

@sgnn7 sgnn7 left a comment

Choose a reason for hiding this comment

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

@remeh Left some comments but it's mostly nits. Great work on this!

Comment on lines 40 to 43
/** contains returns if the given log level is contained.
* If this level is `OFF`, `contains` returns `true` only if `other` is `OFF`
* as well.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Javadoc-like comments in this file probably need a bit standardization/formatting

src/main/java/org/datadog/jmxfetch/util/LogLevel.java Outdated Show resolved Hide resolved
src/main/java/org/datadog/jmxfetch/util/CustomLogger.java Outdated Show resolved Hide resolved
src/main/java/org/datadog/jmxfetch/util/CustomLogger.java Outdated Show resolved Hide resolved
src/main/java/org/datadog/jmxfetch/util/CustomLogger.java Outdated Show resolved Hide resolved
src/main/java/org/datadog/jmxfetch/util/CustomLogger.java Outdated Show resolved Hide resolved
Otherwise, the root logger remains at the INFO level and finer log
levels can't be configured successfully
We need to match slf4j-jdk14's mapping.

Also, add a test.
Copy link
Member

@olivielpeau olivielpeau left a comment

Choose a reason for hiding this comment

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

I left a few comments that I'll address right away

src/main/java/org/datadog/jmxfetch/App.java Show resolved Hide resolved
src/main/java/org/datadog/jmxfetch/util/CustomLogger.java Outdated Show resolved Hide resolved
src/main/java/org/datadog/jmxfetch/util/CustomLogger.java Outdated Show resolved Hide resolved
Copy link
Member

@olivielpeau olivielpeau left a comment

Choose a reason for hiding this comment

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

PR LGTM

Copy link
Member

@olivielpeau olivielpeau left a comment

Choose a reason for hiding this comment

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

Re-approving to account for Remy's latest changes.

I've QA'ed the current state of the branch with an agent, LGTM.

@olivielpeau olivielpeau merged commit fe8bd6d into master Dec 21, 2021
@olivielpeau olivielpeau deleted the remeh/jdk14 branch December 21, 2021 14:12
olivielpeau added a commit that referenced this pull request Dec 21, 2021
Also bumps SLF4J from 1.7.26 to 1.7.32.

Co-authored-by: truthbk <[email protected]>
Co-authored-by: Srdjan Grubor <[email protected]>
Co-authored-by: Olivier Vielpeau <[email protected]>
Co-authored-by: Olivier Vielpeau <[email protected]>
olivielpeau added a commit that referenced this pull request Dec 21, 2021
Also bumps SLF4J from 1.7.26 to 1.7.32.

Co-authored-by: truthbk <[email protected]>
Co-authored-by: Srdjan Grubor <[email protected]>
Co-authored-by: Olivier Vielpeau <[email protected]>
Co-authored-by: Olivier Vielpeau <[email protected]>
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.

4 participants