All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.patches.01-LPS-193979.patch Maven / Gradle / Ivy

The newest version!
diff --git a/org/apache/commons/logging/LogSource.java b/org/apache/commons/logging/LogSource.java
index 95a12c0..4a74d76 100644
--- a/org/apache/commons/logging/LogSource.java
+++ b/org/apache/commons/logging/LogSource.java
@@ -73,7 +73,7 @@ public class LogSource {
 
         // Is Log4J Available?
         try {
-            log4jIsAvailable = null != Class.forName("org.apache.log4j.Logger");
+            log4jIsAvailable = null != Class.forName("org.apache.logging.log4j.Logger");
         } catch (Throwable t) {
             log4jIsAvailable = false;
         }
@@ -217,3 +217,4 @@ public class LogSource {
         return (String[]) logs.keySet().toArray(new String[logs.size()]);
     }
 }
+/* @generated */
\ No newline at end of file
diff --git a/org/apache/commons/logging/impl/Log4JLogger.java b/org/apache/commons/logging/impl/Log4JLogger.java
index de3b140..104858f 100644
--- a/org/apache/commons/logging/impl/Log4JLogger.java
+++ b/org/apache/commons/logging/impl/Log4JLogger.java
@@ -19,26 +19,13 @@ package org.apache.commons.logging.impl;
 
 import java.io.Serializable;
 import org.apache.commons.logging.Log;
-import org.apache.log4j.Logger;
-import org.apache.log4j.Priority;
-import org.apache.log4j.Level;
+import org.apache.logging.log4j.core.Logger;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
 
 /**
  * Implementation of {@link Log} that maps directly to a
- * Logger for log4J version 1.2.
- * 

- * Initial configuration of the corresponding Logger instances should be done - * in the usual manner, as outlined in the Log4J documentation. - *

- * The reason this logger is distinct from the 1.3 logger is that in version 1.2 - * of Log4J: - *

    - *
  • class Logger takes Priority parameters not Level parameters. - *
  • class Level extends Priority - *
- * Log4J1.3 is expected to change Level so it no longer extends Priority, which is - * a non-binary-compatible change. The class generated by compiling this code against - * log4j 1.2 will therefore not run against log4j 1.3. + * Logger for log4J version 2.17. * * @version $Id: Log4JLogger.java 1448119 2013-02-20 12:28:04Z tn $ */ @@ -53,47 +40,11 @@ public class Log4JLogger implements Log, Serializable { private static final String FQCN = Log4JLogger.class.getName(); /** Log to this logger */ - private transient volatile Logger logger = null; + private transient volatile Logger logger; /** Logger name */ private final String name; - private static final Priority traceLevel; - - // ------------------------------------------------------------ - // Static Initializer. - // - // Note that this must come after the static variable declarations - // otherwise initialiser expressions associated with those variables - // will override any settings done here. - // - // Verify that log4j is available, and that it is version 1.2. - // If an ExceptionInInitializerError is generated, then LogFactoryImpl - // will treat that as meaning that the appropriate underlying logging - // library is just not present - if discovery is in progress then - // discovery will continue. - // ------------------------------------------------------------ - - static { - if (!Priority.class.isAssignableFrom(Level.class)) { - // nope, this is log4j 1.3, so force an ExceptionInInitializerError - throw new InstantiationError("Log4J 1.2 not available"); - } - - // Releases of log4j1.2 >= 1.2.12 have Priority.TRACE available, earlier - // versions do not. If TRACE is not available, then we have to map - // calls to Log.trace(...) onto the DEBUG level. - - Priority _traceLevel; - try { - _traceLevel = (Priority) Level.class.getDeclaredField("TRACE").get(null); - } catch(Exception ex) { - // ok, trace not available - _traceLevel = Level.DEBUG; - } - traceLevel = _traceLevel; - } - // ------------------------------------------------------------ Constructor public Log4JLogger() { @@ -121,133 +72,129 @@ public class Log4JLogger implements Log, Serializable { } /** - * Logs a message with org.apache.log4j.Priority.TRACE. - * When using a log4j version that does not support the TRACE - * level, the message will be logged at the DEBUG level. + * Logs a message with org.apache.logging.log4j.Level.TRACE. * * @param message to log * @see org.apache.commons.logging.Log#trace(Object) */ public void trace(Object message) { - getLogger().log(FQCN, traceLevel, message, null); + getLogger().logIfEnabled(FQCN, Level.TRACE, null, message, null); } /** - * Logs a message with org.apache.log4j.Priority.TRACE. - * When using a log4j version that does not support the TRACE - * level, the message will be logged at the DEBUG level. + * Logs a message with org.apache.logging.log4j.Level.TRACE. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#trace(Object, Throwable) */ public void trace(Object message, Throwable t) { - getLogger().log(FQCN, traceLevel, message, t); + getLogger().logIfEnabled(FQCN, Level.TRACE, null, message, t); } /** - * Logs a message with org.apache.log4j.Priority.DEBUG. + * Logs a message with org.apache.logging.log4j.Level.DEBUG. * * @param message to log * @see org.apache.commons.logging.Log#debug(Object) */ public void debug(Object message) { - getLogger().log(FQCN, Level.DEBUG, message, null); + getLogger().logIfEnabled(FQCN, Level.DEBUG, null, message, null); } /** - * Logs a message with org.apache.log4j.Priority.DEBUG. + * Logs a message with org.apache.logging.log4j.Level.DEBUG. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#debug(Object, Throwable) */ public void debug(Object message, Throwable t) { - getLogger().log(FQCN, Level.DEBUG, message, t); + getLogger().logIfEnabled(FQCN, Level.DEBUG, null, message, t); } /** - * Logs a message with org.apache.log4j.Priority.INFO. + * Logs a message with org.apache.logging.log4j.Level.INFO. * * @param message to log * @see org.apache.commons.logging.Log#info(Object) */ public void info(Object message) { - getLogger().log(FQCN, Level.INFO, message, null); + getLogger().logIfEnabled(FQCN, Level.INFO, null, message, null); } /** - * Logs a message with org.apache.log4j.Priority.INFO. + * Logs a message with org.apache.logging.log4j.Level.INFO. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#info(Object, Throwable) */ public void info(Object message, Throwable t) { - getLogger().log(FQCN, Level.INFO, message, t); + getLogger().logIfEnabled(FQCN, Level.INFO, null, message, t); } /** - * Logs a message with org.apache.log4j.Priority.WARN. + * Logs a message with org.apache.logging.log4j.Level.WARN. * * @param message to log * @see org.apache.commons.logging.Log#warn(Object) */ public void warn(Object message) { - getLogger().log(FQCN, Level.WARN, message, null); + getLogger().logIfEnabled(FQCN, Level.WARN, null, message, null); } /** - * Logs a message with org.apache.log4j.Priority.WARN. + * Logs a message with org.apache.logging.log4j.Level.WARN. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#warn(Object, Throwable) */ public void warn(Object message, Throwable t) { - getLogger().log(FQCN, Level.WARN, message, t); + getLogger().logIfEnabled(FQCN, Level.WARN, null, message, t); } /** - * Logs a message with org.apache.log4j.Priority.ERROR. + * Logs a message with org.apache.logging.log4j.Level.ERROR. * * @param message to log * @see org.apache.commons.logging.Log#error(Object) */ public void error(Object message) { - getLogger().log(FQCN, Level.ERROR, message, null); + getLogger().logIfEnabled(FQCN, Level.ERROR, null, message, null); } /** - * Logs a message with org.apache.log4j.Priority.ERROR. + * Logs a message with org.apache.logging.log4j.Level.ERROR. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#error(Object, Throwable) */ public void error(Object message, Throwable t) { - getLogger().log(FQCN, Level.ERROR, message, t); + getLogger().logIfEnabled(FQCN, Level.ERROR, null, message, t); } /** - * Logs a message with org.apache.log4j.Priority.FATAL. + * Logs a message with org.apache.logging.log4j.Level.FATAL. * * @param message to log * @see org.apache.commons.logging.Log#fatal(Object) */ public void fatal(Object message) { - getLogger().log(FQCN, Level.FATAL, message, null); + getLogger().logIfEnabled(FQCN, Level.FATAL, null, message, null); } /** - * Logs a message with org.apache.log4j.Priority.FATAL. + * Logs a message with org.apache.logging.log4j.Level.FATAL. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#fatal(Object, Throwable) */ public void fatal(Object message, Throwable t) { - getLogger().log(FQCN, Level.FATAL, message, t); + getLogger().logIfEnabled(FQCN, Level.FATAL, null, message, t); } /** @@ -259,7 +206,9 @@ public class Log4JLogger implements Log, Serializable { synchronized(this) { result = logger; if (result == null) { - logger = result = Logger.getLogger(name); + logger = result = + (org.apache.logging.log4j.core.Logger) + LogManager.getLogger(name); } } } @@ -277,14 +226,14 @@ public class Log4JLogger implements Log, Serializable { * Check whether the Log4j Logger used is enabled for ERROR priority. */ public boolean isErrorEnabled() { - return getLogger().isEnabledFor(Level.ERROR); + return getLogger().isErrorEnabled(); } /** * Check whether the Log4j Logger used is enabled for FATAL priority. */ public boolean isFatalEnabled() { - return getLogger().isEnabledFor(Level.FATAL); + return getLogger().isFatalEnabled(); } /** @@ -296,17 +245,16 @@ public class Log4JLogger implements Log, Serializable { /** * Check whether the Log4j Logger used is enabled for TRACE priority. - * When using a log4j version that does not support the TRACE level, this call - * will report whether DEBUG is enabled or not. */ public boolean isTraceEnabled() { - return getLogger().isEnabledFor(traceLevel); + return getLogger().isTraceEnabled(); } /** * Check whether the Log4j Logger used is enabled for WARN priority. */ public boolean isWarnEnabled() { - return getLogger().isEnabledFor(Level.WARN); + return getLogger().isWarnEnabled(); } } +/* @generated */ \ No newline at end of file




© 2015 - 2024 Weber Informatics LLC | Privacy Policy