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 2013/07/13 06:51:47 UTC
svn commit: r1502744 -
/logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/LogManager.java
Author: ggregory
Date: Sat Jul 13 04:51:46 2013
New Revision: 1502744
URL: http://svn.apache.org/r1502744
Log:
Sort members in AB order.
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=1502744&r1=1502743&r2=1502744&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 Sat Jul 13 04:51:46 2013
@@ -36,18 +36,19 @@ import org.apache.logging.log4j.util.Pro
* The anchor point for the logging system.
*/
public class LogManager {
- /**
- * The name of the root Logger.
- */
- public static final String ROOT_LOGGER_NAME = "";
+
+ private static LoggerContextFactory factory;
private static final String FACTORY_PROPERTY_NAME = "log4j2.loggerContextFactory";
- private static LoggerContextFactory factory;
-
private static final Logger LOGGER = StatusLogger.getLogger();
/**
+ * The name of the root Logger.
+ */
+ public static final String ROOT_LOGGER_NAME = "";
+
+ /**
* 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.
*/
@@ -121,9 +122,13 @@ public class LogManager {
}
/**
- * Prevents instantiation
+ * 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.
+ * @return a class name
*/
- protected LogManager() {
+ private static String getClassName(final int depth) {
+ return new Throwable().getStackTrace()[depth].getClassName();
}
/**
@@ -310,6 +315,14 @@ public class LogManager {
}
/**
+ * Returns a Logger with the name of the calling class.
+ * @return The Logger for the calling class.
+ */
+ public static Logger getLogger() {
+ return getLogger(getClassName(2));
+ }
+
+ /**
* 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. If null it will default to the calling
* class.
@@ -332,6 +345,16 @@ public class LogManager {
}
/**
+ * Returns a Logger with the name of the calling class.
+ * @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 for the calling class.
+ */
+ public static Logger getLogger(final MessageFactory messageFactory) {
+ return getLogger(getClassName(2), 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. If null the name of the calling
* class will be used as the logger name.
@@ -378,24 +401,6 @@ public class LogManager {
}
/**
- * Returns a Logger with the name of the calling class.
- * @return The Logger for the calling class.
- */
- public static Logger getLogger() {
- return getLogger(getClassName(2));
- }
-
- /**
- * Returns a Logger with the name of the calling class.
- * @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 for the calling class.
- */
- public static Logger getLogger(final MessageFactory messageFactory) {
- return getLogger(getClassName(2), 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.
@@ -407,12 +412,9 @@ public class LogManager {
}
/**
- * 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.
- * @return a class name
+ * Prevents instantiation
*/
- private static String getClassName(final int depth) {
- return new Throwable().getStackTrace()[depth].getClassName();
+ protected LogManager() {
}
+
}