Skip to content

Reduce logging at info level #53

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

oven
Copy link
Contributor

@oven oven commented Oct 19, 2021

Logging XML at the Info level seems a little too much. Move this to debug instead.

@@ -72,7 +72,7 @@ public static Hello from(final String xml)
builder.capability(node.getTextContent());
}
final Hello hello = builder.build();
log.info("hello is: {}", hello.getXml());
if (log.isDebugEnabled()) log.debug("hello is: {}", hello.getXml());
Copy link
Contributor

Choose a reason for hiding this comment

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

If this project switched to Log4j2, we could use suppliers as the arguments into log.debug. By doing this, no need for this if statement at the start. If debug is not enabled, the supplier will never get called.

See https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/Logger.html#debug-java.lang.String-org.apache.logging.log4j.util.Supplier...-

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but at the moment this project does not use Log4j2. The point of this PR is to move logging from "Info" to "Debug".

Copy link
Contributor

Choose a reason for hiding this comment

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

Curious on estimate of how much work it would be to switch to Log4j2?

@GregDThomas
Copy link
Contributor

Curious on estimate of how much work it would be to switch to Log4j2?

Should be trivial, little more than swapping out @Slf4j for @log4j2 plus dependencies.

If that's something you'd be interested in, I'm more than happy to submit a PR with that change in.

@senderic
Copy link
Contributor

senderic commented Nov 18, 2021 via email

@oven
Copy link
Contributor Author

oven commented Nov 19, 2021

Adding log4j2 as a dependency will have consequences for applications using netconf-java. Please don’t.

@oven
Copy link
Contributor Author

oven commented Dec 9, 2021

Logging frameworks aside, can we agree that full xml logging belongs on the debug level and not the info level, so we can close and merge this pull request?

@ydnath
Copy link
Member

ydnath commented Jul 26, 2022

+1 to full XML logging in debug level. This can get very large depending on the RPC context.

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.

5 participants