logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1420741 - /logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/LogManager.java
Date Wed, 12 Dec 2012 15:12:37 GMT
Author: ggregory
Date: Wed Dec 12 15:12:35 2012
New Revision: 1420741

URL: http://svn.apache.org/viewvc?rev=1420741&view=rev
Log:
Sort methods.

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

Modified: logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/LogManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/LogManager.java?rev=1420741&r1=1420740&r2=1420741&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/LogManager.java
(original)
+++ logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/LogManager.java
Wed Dec 12 15:12:35 2012
@@ -55,12 +55,6 @@ public class LogManager {
     private static final Logger logger = StatusLogger.getLogger();
 
     /**
-     * Prevents instantiation
-     */
-    protected LogManager() {
-    }
-
-    /**
      * Scans the classpath to find all logging implementation. Currently, only one will
      * be used but this could be extended to allow multiple implementations to be used.
      */
@@ -148,82 +142,24 @@ public class LogManager {
         }
     }
 
-    /**
-     * Returns the LoggerContextFactory.
-     * @return The LoggerContextFactory.
-     */
-    public static LoggerContextFactory getFactory() {
-        return factory;
-    }
-
-    /**
-     * Returns a Logger with the specified name.
-     *
-     * @param name The logger name.
-     * @return The Logger.
-     */
-    public static Logger getLogger(final String name) {
-        return factory.getContext(LogManager.class.getName(), null, false).getLogger(name);
-    }
-
-    /**
-     * Returns a Logger with the specified name.
-     *
-     * @param name The logger name.
-     * @param messageFactory The message factory is used only when creating a logger, subsequent
use does not change the logger but will log a warning if mismatched.
-     * @return The Logger.
-     */
-    public static Logger getLogger(final String name, final MessageFactory messageFactory)
{
-        return factory.getContext(LogManager.class.getName(), null, false).getLogger(name,
messageFactory);
-    }
-
-    /**
-     * Returns a Logger using the fully qualified name of the Class as the Logger name.
-     * @param clazz The Class whose name should be used as the Logger name.
-     * @return The Logger.
-     */
-    public static Logger getLogger(final Class<?> clazz) {
-        return getLogger(clazz != null ? clazz.getName() : null);
-    }
-
-    /**
-     * Returns a Logger using the fully qualified name of the Class as the Logger name.
-     * @param clazz The Class whose name should be used as the Logger name.
-     * @param messageFactory The message factory is used only when creating a logger, subsequent
use does not change the logger but will log a warning if mismatched.
-     * @return The Logger.
-     */
-    public static Logger getLogger(final Class<?> clazz, final MessageFactory messageFactory)
{
-        return getLogger(clazz != null ? clazz.getName() : null, messageFactory);
-    }
-
-    /**
-     * Returns a Logger using the fully qualified class name of the value as the Logger name.
-     * @param value The value whose class name should be used as the Logger name.
-     * @return The Logger.
-     */
-    public static Logger getLogger(final Object value) {
-        return getLogger(value != null ? value.getClass() : null);
-    }
-
-    /**
-     * Returns a Logger using the fully qualified class name of the value as the Logger name.
-     * @param value The value whose class name should be used as the Logger name.
-     * @param messageFactory The message factory is used only when creating a logger, subsequent
use does not change the logger but will log a warning if mismatched.
-     * @return The Logger.
-     */
-    public static Logger getLogger(final Object value, final MessageFactory messageFactory)
{
-        return getLogger(value != null ? value.getClass() : null, messageFactory);
-    }
+    private static ClassLoader findClassLoader() {
+        ClassLoader cl;
+        if (System.getSecurityManager() == null) {
+            cl = Thread.currentThread().getContextClassLoader();
+        } else {
+            cl = java.security.AccessController.doPrivileged(
+                new java.security.PrivilegedAction<ClassLoader>() {
+                    public ClassLoader run() {
+                        return Thread.currentThread().getContextClassLoader();
+                    }
+                }
+            );
+        }
+        if (cl == null) {
+            cl = LogManager.class.getClassLoader();
+        }
 
-    /**
-     * Returns a Logger with the specified name.
-     *
-     * @param fqcn The fully qualified class name of the class that this method is a member
of.
-     * @param name The logger name.
-     * @return The Logger.
-     */
-    protected static Logger getLogger(final String fqcn, final String name) {
-        return factory.getContext(fqcn, null, false).getLogger(name);
+        return cl;
     }
 
     /**
@@ -265,7 +201,6 @@ public class LogManager {
         return factory.getContext(LogManager.class.getName(), loader, currentContext);
     }
 
-
     /**
      * Returns a LoggerContext
      * @param fqcn The fully qualified class name of the Class that this method is a member
of.
@@ -279,7 +214,6 @@ public class LogManager {
         return factory.getContext(fqcn, null, currentContext);
     }
 
-
     /**
      * Returns a LoggerContext
      * @param fqcn The fully qualified class name of the Class that this method is a member
of.
@@ -295,24 +229,84 @@ public class LogManager {
         return factory.getContext(fqcn, loader, currentContext);
     }
 
-    private static ClassLoader findClassLoader() {
-        ClassLoader cl;
-        if (System.getSecurityManager() == null) {
-            cl = Thread.currentThread().getContextClassLoader();
-        } else {
-            cl = java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction<ClassLoader>() {
-                    public ClassLoader run() {
-                        return Thread.currentThread().getContextClassLoader();
-                    }
-                }
-            );
-        }
-        if (cl == null) {
-            cl = LogManager.class.getClassLoader();
-        }
+    /**
+     * Returns the LoggerContextFactory.
+     * @return The LoggerContextFactory.
+     */
+    public static LoggerContextFactory getFactory() {
+        return factory;
+    }
 
-        return cl;
+    /**
+     * Returns a Logger using the fully qualified name of the Class as the Logger name.
+     * @param clazz The Class whose name should be used as the Logger name.
+     * @return The Logger.
+     */
+    public static Logger getLogger(final Class<?> clazz) {
+        return getLogger(clazz != null ? clazz.getName() : null);
+    }
+
+    /**
+     * Returns a Logger using the fully qualified name of the Class as the Logger name.
+     * @param clazz The Class whose name should be used as the Logger name.
+     * @param messageFactory The message factory is used only when creating a logger, subsequent
use does not change the logger but will log a warning if mismatched.
+     * @return The Logger.
+     */
+    public static Logger getLogger(final Class<?> clazz, final MessageFactory messageFactory)
{
+        return getLogger(clazz != null ? clazz.getName() : null, messageFactory);
+    }
+
+    /**
+     * Returns a Logger using the fully qualified class name of the value as the Logger name.
+     * @param value The value whose class name should be used as the Logger name.
+     * @return The Logger.
+     */
+    public static Logger getLogger(final Object value) {
+        return getLogger(value != null ? value.getClass() : null);
+    }
+
+    /**
+     * Returns a Logger using the fully qualified class name of the value as the Logger name.
+     * @param value The value whose class name should be used as the Logger name.
+     * @param messageFactory The message factory is used only when creating a logger, subsequent
use does not change the logger but will log a warning if mismatched.
+     * @return The Logger.
+     */
+    public static Logger getLogger(final Object value, final MessageFactory messageFactory)
{
+        return getLogger(value != null ? value.getClass() : null, messageFactory);
+    }
+
+    /**
+     * Returns a Logger with the specified name.
+     *
+     * @param name The logger name.
+     * @return The Logger.
+     */
+    public static Logger getLogger(final String name) {
+        return factory.getContext(LogManager.class.getName(), null, false).getLogger(name);
+    }
+
+
+    /**
+     * Returns a Logger with the specified name.
+     *
+     * @param name The logger name.
+     * @param messageFactory The message factory is used only when creating a logger, subsequent
use does not change the logger but will log a warning if mismatched.
+     * @return The Logger.
+     */
+    public static Logger getLogger(final String name, final MessageFactory messageFactory)
{
+        return factory.getContext(LogManager.class.getName(), null, false).getLogger(name,
messageFactory);
+    }
+
+
+    /**
+     * Returns a Logger with the specified name.
+     *
+     * @param fqcn The fully qualified class name of the class that this method is a member
of.
+     * @param name The logger name.
+     * @return The Logger.
+     */
+    protected static Logger getLogger(final String fqcn, final String name) {
+        return factory.getContext(fqcn, null, false).getLogger(name);
     }
 
     private static boolean validVersion(final String version) {
@@ -324,4 +318,10 @@ public class LogManager {
         return false;
     }
 
+    /**
+     * Prevents instantiation
+     */
+    protected LogManager() {
+    }
+
 }



Mime
View raw message