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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/net/juniper/netconf/element/Hello.java
Original file line number Diff line number Diff line change
Expand Up @@ -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?

return hello;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/juniper/netconf/element/RpcReply.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static <T extends AbstractNetconfElement> T from(final String xml)
.errors(errorList)
.originalDocument(document)
.build();
log.info("rpc-reply is: {}", rpcReply.getXml());
if (log.isDebugEnabled()) log.debug("rpc-reply is: {}", rpcReply.getXml());
return (T) rpcReply;
}

Expand Down