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 2014/03/24 22:36:33 UTC

svn commit: r1581076 - /logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java

Author: ggregory
Date: Mon Mar 24 21:36:33 2014
New Revision: 1581076

URL: http://svn.apache.org/r1581076
Log:
Detects if a Logger with the specified name exists. This is a convenience method for porting from version 1.

Modified:
    logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java

Modified: logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java?rev=1581076&r1=1581075&r2=1581076&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java (original)
+++ logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java Mon Mar 24 21:36:33 2014
@@ -122,6 +122,18 @@ public class LogManager {
     }
 
     /**
+     * Detects if a Logger with the specified name exists. This is a convenience method for porting from version 1.
+     * 
+     * @param name
+     *            The Logger name to search for.
+     * @return true if the Logger exists, false otherwise.
+     * @see LoggerContext#hasLogger(String)
+     */
+    public static boolean exists(String name) {
+        return getContext().hasLogger(name);
+    }
+
+    /**
      * Gets the class name of the caller in the current stack at the given {@code depth}.
      *
      * @param depth a 0-based index in the current stack.