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

doc: guidance on PMD guard log statement warning #5220

Merged
merged 5 commits into from
Mar 10, 2024

Conversation

jdrueckert
Copy link
Member

Based on our discussion on Discord, see link.

@jdrueckert jdrueckert added Category: Doc Requests, Issues and Changes targeting javadoc and module documentation Type: Improvement Request for or addition/enhancement of a feature Category: Test/QA Requests, Issues and Changes targeting tests and quality assurance Size: S Small effort likely only affecting a single area and requiring little to no research labels Mar 10, 2024
@jdrueckert jdrueckert self-assigned this Mar 10, 2024
@jdrueckert jdrueckert added this to the 2023 Revive - Milestone 3 milestone Mar 10, 2024
docs/Code-Conventions.md Outdated Show resolved Hide resolved
docs/Code-Conventions.md Outdated Show resolved Hide resolved
docs/Code-Conventions.md Outdated Show resolved Hide resolved
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.
Copy link
Contributor

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: {}");

Copy link
Member Author

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 ?

Copy link
Contributor

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:

Suggested change
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.

Copy link
Member Author

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

Copy link
Member Author

@jdrueckert jdrueckert Mar 10, 2024

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?

docs/Code-Conventions.md Outdated Show resolved Hide resolved
docs/Code-Conventions.md Outdated Show resolved Hide resolved
jdrueckert and others added 2 commits March 10, 2024 21:01
Co-authored-by: BenjaminAmos <24301287+BenjaminAmos@users.noreply.github.com>
@BenjaminAmos BenjaminAmos merged commit bcae39f into develop Mar 10, 2024
9 checks passed
@BenjaminAmos BenjaminAmos deleted the doc/pmd-guard-log-warning branch March 10, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Doc Requests, Issues and Changes targeting javadoc and module documentation Category: Test/QA Requests, Issues and Changes targeting tests and quality assurance Size: S Small effort likely only affecting a single area and requiring little to no research Type: Improvement Request for or addition/enhancement of a feature
Projects
Status: No status
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants