You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2024/04/04 10:22:39 UTC
(logging-log4j2) branch 2.x updated: Removes usage of `Constants` in `StackLocator`
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/2.x by this push:
new 01fd727e74 Removes usage of `Constants` in `StackLocator`
01fd727e74 is described below
commit 01fd727e74d6556183ebf9e4affbf5831044a516
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Thu Apr 4 11:35:15 2024 +0200
Removes usage of `Constants` in `StackLocator`
---
.../java/org/apache/logging/log4j/util/StackLocator.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/StackLocator.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/StackLocator.java
index e5b50fc7ca..8871b44a11 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/StackLocator.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/StackLocator.java
@@ -88,13 +88,11 @@ public final class StackLocator {
}
}
} catch (final Exception | LinkageError e) {
- if (Constants.JAVA_MAJOR_VERSION > 8) {
- LOGGER.warn(
- "Runtime environment or build system does not support multi-release JARs. This will impact location-based features.");
- } else {
- LOGGER.warn(
- "`sun.reflect.Reflection.getCallerClass(int)` is not supported. This will impact location-based features.");
- }
+ // We can not use `Constants` here, since they depend on `PropertiesUtil`.
+ LOGGER.warn(
+ System.getProperty("java.version", "").startsWith("1.8")
+ ? "`sun.reflect.Reflection.getCallerClass(int)` is not supported. This will impact location-based features."
+ : "Runtime environment or build system does not support multi-release JARs. This will impact location-based features.");
getCallerClassMethod = null;
java7u25CompensationOffset = -1;
}