Skip to content

refactor: Loggers should be named for their enclosing classes #2479

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: main
Choose a base branch
from

Conversation

jkschneider
Copy link

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 14, 2025
@@ -42,7 +41,7 @@
class HalFormsAdaptingResponseBodyAdvice<T extends RepresentationModel<T>>
implements ResponseBodyAdvice<RepresentationModel<T>> {

private static final Logger logger = LoggerFactory.getLogger(RequestResponseBodyMethodProcessor.class);
private static final Logger logger = LoggerFactory.getLogger(HalFormsAdaptingResponseBodyAdvice.class);
Copy link
Member

Choose a reason for hiding this comment

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

This one is useful.

@@ -47,7 +47,7 @@ class RepositoryRestExceptionHandlerUnitTests {
@BeforeAll
public static void silenceLog() {

logger = (Logger) LoggerFactory.getLogger(RepositoryRestExceptionHandler.class);
logger = (Logger) LoggerFactory.getLogger(RepositoryRestExceptionHandlerUnitTests.class);
Copy link
Member

Choose a reason for hiding this comment

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

This one is not useful as it accomplishes something else. The recipe would benefit from considering tests and where (method or class body) the logger is actually obtained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants