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 2019/06/18 17:09:15 UTC

[logging-log4j2] branch release-2.x updated: Add org.apache.logging.log4j.junit.LoggerContextRule.getConfigurationLocation().

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/release-2.x by this push:
     new be58283  Add org.apache.logging.log4j.junit.LoggerContextRule.getConfigurationLocation().
be58283 is described below

commit be582839d85b339b6b385e81334e317c3e429bb1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 18 13:09:11 2019 -0400

    Add org.apache.logging.log4j.junit.LoggerContextRule.getConfigurationLocation().
---
 .../logging/log4j/junit/LoggerContextRule.java     | 35 ++++++++++++++--------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java b/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
index 09ce947..d6d960c 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
@@ -51,7 +51,7 @@ public class LoggerContextRule implements TestRule, LoggerContextAccessor {
 
     private static final String SYS_PROP_KEY_CLASS_NAME = "org.apache.logging.log4j.junit.LoggerContextRule#ClassName";
     private static final String SYS_PROP_KEY_DISPLAY_NAME = "org.apache.logging.log4j.junit.LoggerContextRule#DisplayName";
-    private final String configLocation;
+    private final String configurationLocation;
     private LoggerContext loggerContext;
     private Class<? extends ContextSelector> contextSelectorClass;
     private String testClassName;
@@ -68,36 +68,36 @@ public class LoggerContextRule implements TestRule, LoggerContextAccessor {
     /**
      * Constructs a new LoggerContextRule for a given configuration file.
      *
-     * @param configLocation
+     * @param configurationLocation
      *            path to configuration file
      */
-    public LoggerContextRule(final String configLocation) {
-        this(configLocation, null);
+    public LoggerContextRule(final String configurationLocation) {
+        this(configurationLocation, null);
     }
 
     /**
      * Constructs a new LoggerContextRule for a given configuration file and a custom {@link ContextSelector} class.
      *
-     * @param configLocation
+     * @param configurationLocation
      *            path to configuration file
      * @param contextSelectorClass
      *            custom ContextSelector class to use instead of default
      */
-    public LoggerContextRule(final String configLocation, final Class<? extends ContextSelector> contextSelectorClass) {
-        this(configLocation, contextSelectorClass, AbstractLifeCycle.DEFAULT_STOP_TIMEOUT,
+    public LoggerContextRule(final String configurationLocation, final Class<? extends ContextSelector> contextSelectorClass) {
+        this(configurationLocation, contextSelectorClass, AbstractLifeCycle.DEFAULT_STOP_TIMEOUT,
                 AbstractLifeCycle.DEFAULT_STOP_TIMEUNIT);
     }
 
-    public LoggerContextRule(final String configLocation, final Class<? extends ContextSelector> contextSelectorClass,
+    public LoggerContextRule(final String configurationLocation, final Class<? extends ContextSelector> contextSelectorClass,
             final long shutdownTimeout, final TimeUnit shutdownTimeUnit) {
-        this.configLocation = configLocation;
+        this.configurationLocation = configurationLocation;
         this.contextSelectorClass = contextSelectorClass;
         this.shutdownTimeout = shutdownTimeout;
         this.shutdownTimeUnit = shutdownTimeUnit;
     }
 
-    public LoggerContextRule(final String config, final int shutdownTimeout, final TimeUnit shutdownTimeUnit) {
-        this(config, null, shutdownTimeout, shutdownTimeUnit);
+    public LoggerContextRule(final String configurationLocation, final int shutdownTimeout, final TimeUnit shutdownTimeUnit) {
+        this(configurationLocation, null, shutdownTimeout, shutdownTimeUnit);
     }
 
     @Override
@@ -118,7 +118,7 @@ public class LoggerContextRule implements TestRule, LoggerContextAccessor {
                 System.setProperty(SYS_PROP_KEY_CLASS_NAME, description.getClassName());
                 System.setProperty(SYS_PROP_KEY_DISPLAY_NAME, description.getDisplayName());
                 loggerContext = Configurator.initialize(description.getDisplayName(),
-                        description.getTestClass().getClassLoader(), configLocation);
+                        description.getTestClass().getClassLoader(), configurationLocation);
                 try {
                     base.evaluate();
                 } finally {
@@ -175,6 +175,15 @@ public class LoggerContextRule implements TestRule, LoggerContextAccessor {
     }
 
     /**
+     * Gets the configuration location.
+     * 
+     * @return the configuration location.
+     */
+	public String getConfigurationLocation() {
+		return configurationLocation;
+	}
+
+    /**
      * Gets the current LoggerContext associated with this rule.
      *
      * @return the current LoggerContext.
@@ -283,7 +292,7 @@ public class LoggerContextRule implements TestRule, LoggerContextAccessor {
     public String toString() {
         final StringBuilder builder = new StringBuilder();
         builder.append("LoggerContextRule [configLocation=");
-        builder.append(configLocation);
+        builder.append(configurationLocation);
         builder.append(", contextSelectorClass=");
         builder.append(contextSelectorClass);
         builder.append("]");