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 19:10:50 UTC
svn commit: r1580956 -
/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java
Author: ggregory
Date: Mon Mar 24 18:10:50 2014
New Revision: 1580956
URL: http://svn.apache.org/r1580956
Log:
Sort methods.
Modified:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java
Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java?rev=1580956&r1=1580955&r2=1580956&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java Mon Mar 24 18:10:50 2014
@@ -59,14 +59,6 @@ public class Log4jContextFactory impleme
}
/**
- * Returns the ContextSelector.
- * @return The ContextSelector.
- */
- public ContextSelector getSelector() {
- return selector;
- }
-
- /**
* Loads the LoggerContext using the ContextSelector.
* @param fqcn The fully qualified class name of the caller.
* @param loader The ClassLoader to use or null.
@@ -93,20 +85,19 @@ public class Log4jContextFactory impleme
* @param externalContext An external context (such as a ServletContext) to be associated with the LoggerContext.
* @param currentContext If true returns the current Context, if false returns the Context appropriate
* for the caller if a more appropriate Context can be determined.
- * @param configLocation The location of the configuration for the LoggerContext.
+ * @param source The configuration source.
* @return The LoggerContext.
*/
- @Override
public LoggerContext getContext(final String fqcn, final ClassLoader loader, final Object externalContext,
- final boolean currentContext, final URI configLocation, final String name) {
- final LoggerContext ctx = selector.getContext(fqcn, loader, currentContext, configLocation);
+ final boolean currentContext, final ConfigurationFactory.ConfigurationSource source) {
+ final LoggerContext ctx = selector.getContext(fqcn, loader, currentContext, null);
if (externalContext != null && ctx.getExternalContext() == null) {
ctx.setExternalContext(externalContext);
}
if (ctx.getStatus() == LoggerContext.Status.INITIALIZED) {
- if (configLocation != null || name != null) {
+ if (source != null) {
ContextAnchor.THREAD_CONTEXT.set(ctx);
- final Configuration config = ConfigurationFactory.getInstance().getConfiguration(name, configLocation);
+ final Configuration config = ConfigurationFactory.getInstance().getConfiguration(source);
ctx.start(config);
ContextAnchor.THREAD_CONTEXT.remove();
} else {
@@ -123,19 +114,20 @@ public class Log4jContextFactory impleme
* @param externalContext An external context (such as a ServletContext) to be associated with the LoggerContext.
* @param currentContext If true returns the current Context, if false returns the Context appropriate
* for the caller if a more appropriate Context can be determined.
- * @param source The configuration source.
+ * @param configLocation The location of the configuration for the LoggerContext.
* @return The LoggerContext.
*/
+ @Override
public LoggerContext getContext(final String fqcn, final ClassLoader loader, final Object externalContext,
- final boolean currentContext, final ConfigurationFactory.ConfigurationSource source) {
- final LoggerContext ctx = selector.getContext(fqcn, loader, currentContext, null);
+ final boolean currentContext, final URI configLocation, final String name) {
+ final LoggerContext ctx = selector.getContext(fqcn, loader, currentContext, configLocation);
if (externalContext != null && ctx.getExternalContext() == null) {
ctx.setExternalContext(externalContext);
}
if (ctx.getStatus() == LoggerContext.Status.INITIALIZED) {
- if (source != null) {
+ if (configLocation != null || name != null) {
ContextAnchor.THREAD_CONTEXT.set(ctx);
- final Configuration config = ConfigurationFactory.getInstance().getConfiguration(source);
+ final Configuration config = ConfigurationFactory.getInstance().getConfiguration(name, configLocation);
ctx.start(config);
ContextAnchor.THREAD_CONTEXT.remove();
} else {
@@ -146,6 +138,14 @@ public class Log4jContextFactory impleme
}
/**
+ * Returns the ContextSelector.
+ * @return The ContextSelector.
+ */
+ public ContextSelector getSelector() {
+ return selector;
+ }
+
+ /**
* Removes knowledge of a LoggerContext.
*
* @param context The context to remove.