You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/08/15 12:44:12 UTC
(commons-logging) 01/06: Sort members
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git
commit 9fb30f8541a857e9bbc6c6863dfb243409c73dd4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 15 07:29:24 2024 -0400
Sort members
---
.../org/apache/commons/logging/LogFactory.java | 78 +++++++++++-----------
1 file changed, 39 insertions(+), 39 deletions(-)
diff --git a/src/main/java/org/apache/commons/logging/LogFactory.java b/src/main/java/org/apache/commons/logging/LogFactory.java
index 4f4a2ef..f88a54a 100644
--- a/src/main/java/org/apache/commons/logging/LogFactory.java
+++ b/src/main/java/org/apache/commons/logging/LogFactory.java
@@ -1405,45 +1405,6 @@ public abstract class LogFactory {
return newFactory(factoryClass, classLoader, null);
}
- /**
- * Tries to load one of the standard three implementations from the given classloader.
- * <p>
- * We assume that {@code classLoader} can load this class.
- * </p>
- * @param classLoader The classloader to use.
- * @return An implementation of this class.
- */
- private static LogFactory newStandardFactory(final ClassLoader classLoader) {
- if (isClassAvailable(LOG4J_TO_SLF4J_BRIDGE, classLoader)) {
- try {
- return (LogFactory) Class.forName(FACTORY_SLF4J, true, classLoader).getConstructor().newInstance();
- } catch (final LinkageError | ReflectiveOperationException ignored) {
- } finally {
- logDiagnostic(
- "[LOOKUP] Log4j API to SLF4J redirection detected. Loading the SLF4J LogFactory implementation '" + FACTORY_SLF4J + "'.");
- }
- }
- try {
- return (LogFactory) Class.forName(FACTORY_LOG4J_API, true, classLoader).getConstructor().newInstance();
- } catch (final LinkageError | ReflectiveOperationException ignored) {
- } finally {
- logDiagnostic("[LOOKUP] Loading the Log4j API LogFactory implementation '" + FACTORY_LOG4J_API + "'.");
- }
- try {
- return (LogFactory) Class.forName(FACTORY_SLF4J, true, classLoader).getConstructor().newInstance();
- } catch (final LinkageError | ReflectiveOperationException ignored) {
- } finally {
- logDiagnostic("[LOOKUP] Loading the SLF4J LogFactory implementation '" + FACTORY_SLF4J + "'.");
- }
- try {
- return (LogFactory) Class.forName(FACTORY_DEFAULT, true, classLoader).getConstructor().newInstance();
- } catch (final LinkageError | ReflectiveOperationException ignored) {
- } finally {
- logDiagnostic("[LOOKUP] Loading the legacy LogFactory implementation '" + FACTORY_DEFAULT + "'.");
- }
- return null;
- }
-
/**
* Gets a new instance of the specified {@code LogFactory} implementation class, loaded by the specified class loader. If that fails, try the class loader
* used to load this (abstract) LogFactory.
@@ -1500,6 +1461,45 @@ public abstract class LogFactory {
return (LogFactory) result;
}
+ /**
+ * Tries to load one of the standard three implementations from the given classloader.
+ * <p>
+ * We assume that {@code classLoader} can load this class.
+ * </p>
+ * @param classLoader The classloader to use.
+ * @return An implementation of this class.
+ */
+ private static LogFactory newStandardFactory(final ClassLoader classLoader) {
+ if (isClassAvailable(LOG4J_TO_SLF4J_BRIDGE, classLoader)) {
+ try {
+ return (LogFactory) Class.forName(FACTORY_SLF4J, true, classLoader).getConstructor().newInstance();
+ } catch (final LinkageError | ReflectiveOperationException ignored) {
+ } finally {
+ logDiagnostic(
+ "[LOOKUP] Log4j API to SLF4J redirection detected. Loading the SLF4J LogFactory implementation '" + FACTORY_SLF4J + "'.");
+ }
+ }
+ try {
+ return (LogFactory) Class.forName(FACTORY_LOG4J_API, true, classLoader).getConstructor().newInstance();
+ } catch (final LinkageError | ReflectiveOperationException ignored) {
+ } finally {
+ logDiagnostic("[LOOKUP] Loading the Log4j API LogFactory implementation '" + FACTORY_LOG4J_API + "'.");
+ }
+ try {
+ return (LogFactory) Class.forName(FACTORY_SLF4J, true, classLoader).getConstructor().newInstance();
+ } catch (final LinkageError | ReflectiveOperationException ignored) {
+ } finally {
+ logDiagnostic("[LOOKUP] Loading the SLF4J LogFactory implementation '" + FACTORY_SLF4J + "'.");
+ }
+ try {
+ return (LogFactory) Class.forName(FACTORY_DEFAULT, true, classLoader).getConstructor().newInstance();
+ } catch (final LinkageError | ReflectiveOperationException ignored) {
+ } finally {
+ logDiagnostic("[LOOKUP] Loading the legacy LogFactory implementation '" + FACTORY_DEFAULT + "'.");
+ }
+ return null;
+ }
+
/**
* Returns a string that uniquely identifies the specified object, including
* its class.