carterkozak commented on a change in pull request #475:
URL: https://github.com/apache/logging-log4j2/pull/475#discussion_r598920010



##########
File path: 
log4j-slf4j18-impl/src/main/java/org/apache/logging/slf4j/Log4jLoggerFactory.java
##########
@@ -47,8 +47,12 @@ protected Logger newLogger(final String name, final 
LoggerContext context) {
 
     @Override
     protected LoggerContext getContext() {
-        final Class<?> anchor = StackLocatorUtil.getCallerClass(FQCN, PACKAGE);
-        return anchor == null ? LogManager.getContext() : 
getContext(StackLocatorUtil.getCallerClass(anchor));
+        final Class<?> anchor = 
LogManager.getFactory().isClassLoaderDependent()
+                ? StackLocatorUtil.getCallerClass(FQCN, PACKAGE)
+                : null;
+        return anchor == null
+                ? LogManager.getContext()
+                : getContext(StackLocatorUtil.getCallerClass(anchor));

Review comment:
       I can iterate on this PR with each component in an isolated commit, that 
may be easiest to review. Let me know if you think the current approach adding 
`boolean isClassLoaderDependent()` is reasonable.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to