You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2021/12/17 02:16:16 UTC
[logging-log4j2] 03/03: No need to nest.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 56e41ddf7c7f8d51938bd0878b1fee1c9027ecfa
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 16 21:16:09 2021 -0500
No need to nest.
---
.../org/apache/logging/log4j/core/config/Configurator.java | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
index f4b2966..6ed1420 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
@@ -46,15 +46,14 @@ public final class Configurator {
final LoggerContextFactory factory = LogManager.getFactory();
if (factory instanceof Log4jContextFactory) {
return (Log4jContextFactory) factory;
+ }
+ if (factory != null) {
+ LOGGER.error("LogManager returned an instance of {} which does not implement {}. Unable to initialize Log4j.",
+ factory.getClass().getName(), Log4jContextFactory.class.getName());
} else {
- if (factory != null) {
- LOGGER.error("LogManager returned an instance of {} which does not implement {}. Unable to initialize Log4j.",
- factory.getClass().getName(), Log4jContextFactory.class.getName());
- } else {
- LOGGER.fatal("LogManager did not return a LoggerContextFactory. This indicates something has gone terribly wrong!");
- }
- return null;
+ LOGGER.fatal("LogManager did not return a LoggerContextFactory. This indicates something has gone terribly wrong!");
}
+ return null;
}
/**