Skip to content

Commit be5dc5a

Browse files
committed
Differentiate warning by Java version
1 parent 2dd2086 commit be5dc5a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

log4j-api/src/main/java/org/apache/logging/log4j/util/StackLocator.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,19 @@ public final class StackLocator {
7272
} else {
7373
o = getCallerClassMethod.invoke(null, 1);
7474
if (o == sunReflectionClass) {
75-
System.out.println("WARNING: Unexpected result from sun.reflect.Reflection.getCallerClass(int), adjusting offset for future calls.");
75+
LowLevelLogUtil.log(
76+
"WARNING: Unexpected result from sun.reflect.Reflection.getCallerClass(int), adjusting offset for future calls.");
7677
java7u25CompensationOffset = 1;
7778
}
7879
}
7980
} catch (final Exception | LinkageError e) {
81+
if (Constants.JAVA_MAJOR_VERSION > 8) {
82+
LowLevelLogUtil.log(
83+
"WARNING: Runtime environment does not support multi-release JARs. This will impact location-based features.");
84+
} else {
85+
LowLevelLogUtil.log(
86+
"WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact location-based features.");
87+
}
8088
getCallerClassMethod = null;
8189
java7u25CompensationOffset = -1;
8290
}

0 commit comments

Comments
 (0)