-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
doc: guidance on PMD guard log statement warning #5220
Conversation
docs/Code-Conventions.md
Outdated
log.atDebug().log("log something {} and {}", method(), param); | ||
``` | ||
|
||
Please do not use the more verbose variant(s) of the fluent logging API to keep complexity low and your log statements readable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also provide an example here of a more "verbose variant"?
Something like this?
logger.atError().addArgument(() -> entry.getValue()).addArgument(e).log("log some exception: {}");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to avoid this because I know people tend to skim through text and just copy anything 🙈
That's why I didn't want to provide an example for the version we don't want.
If you think we need it though, I can add it. What do you think @BenjaminAmos ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. That particular example was what inspired these guidelines, I believe?
Would something more vague work? For example:
Please do not use the more verbose variant(s) of the fluent logging API to keep complexity low and your log statements readable. | |
Please do not use the more verbose variant(s) of the fluent logging API (such as `LoggingEventBuilder#addArgument`) to keep complexity low and your log statements readable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I think that's okay. I'll adjust it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed it. is it alright like that?
Co-authored-by: BenjaminAmos <24301287+BenjaminAmos@users.noreply.github.com>
Based on our discussion on Discord, see link.