Skip to content

Reduce logging at info level#53

Open
oven wants to merge 1 commit into
Juniper:masterfrom
oven:reduce-logging
Open

Reduce logging at info level#53
oven wants to merge 1 commit into
Juniper:masterfrom
oven:reduce-logging

Conversation

@oven

@oven oven commented Oct 19, 2021

Copy link
Copy Markdown
Contributor

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

}
final Hello hello = builder.build();
log.info("hello is: {}", hello.getXml());
if (log.isDebugEnabled()) log.debug("hello is: {}", hello.getXml());

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

senderic commented Nov 18, 2021 via email

Copy link
Copy Markdown
Contributor

@oven

oven commented Nov 19, 2021

Copy link
Copy Markdown
Contributor Author

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

@oven

oven commented Dec 9, 2021

Copy link
Copy Markdown
Contributor Author

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

ydnath commented Jul 26, 2022

Copy link
Copy Markdown
Member

+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