-
Notifications
You must be signed in to change notification settings - Fork 563
Fix logger name in HalFormsAdaptingResponseBodyAdvice
#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
Fix logger name in HalFormsAdaptingResponseBodyAdvice
#2479
Conversation
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.java.logging.slf4j.LoggersNamedForEnclosingClass?organizationId=U3ByaW5n Co-authored-by: Moderne <[email protected]>
@@ -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); |
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.
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); |
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.
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.
Co-authored-by: Moderne <[email protected]> Fixes GH-2479.
Co-authored-by: Moderne <[email protected]> Fixes GH-2479.
Co-authored-by: Moderne <[email protected]> Fixes GH-2479.
HalFormsAdaptingResponseBodyAdvice
I've partially applied the changes in the PR. As Mark pointed out, generally assuming you'd always want to obtain a logger for the same class might not hold true in edge cases, such as the one in our tests here. Thanks, nonetheless! |
Hope this helps :)
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.java.logging.slf4j.LoggersNamedForEnclosingClass?organizationId=U3ByaW5n