You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2014/10/06 00:56:52 UTC

[2/6] git commit: Add mvn -DEBUG system property support to ILC.

Add mvn -DEBUG system property support to ILC.

  - Just run mvn with the "-DEBUG" option to automatically enable
  debug logging for the StatusLogger when using ILC.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/29304061
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/29304061
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/29304061

Branch: refs/heads/master
Commit: 29304061e98e074c709eadcce5d2fa47c8072a42
Parents: 69c96c9
Author: Matt Sicker <ma...@apache.org>
Authored: Sun Oct 5 17:18:23 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sun Oct 5 17:18:23 2014 -0500

----------------------------------------------------------------------
 .../org/apache/logging/log4j/junit/InitialLoggerContext.java  | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/29304061/log4j-core/src/test/java/org/apache/logging/log4j/junit/InitialLoggerContext.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/junit/InitialLoggerContext.java b/log4j-core/src/test/java/org/apache/logging/log4j/junit/InitialLoggerContext.java
index 2867b81..138edf4 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/junit/InitialLoggerContext.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/junit/InitialLoggerContext.java
@@ -16,6 +16,7 @@
  */
 package org.apache.logging.log4j.junit;
 
+import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.Logger;
 import org.apache.logging.log4j.core.LoggerContext;
@@ -31,6 +32,9 @@ import static org.junit.Assert.*;
 
 /**
  * JUnit {@link TestRule} for constructing a new LoggerContext using a specified configuration file.
+ * If the system property {@code EBUG} is set (e.g., through the command line option {@code -DEBUG}), then the
+ * StatusLogger will be set to the debug level. This allows for more debug messages as the StatusLogger will be in the
+ * error level until a configuration file has been read and parsed into a tree of Nodes.
  */
 public class InitialLoggerContext implements TestRule {
 
@@ -46,6 +50,9 @@ public class InitialLoggerContext implements TestRule {
 
     @Override
     public Statement apply(final Statement base, final Description description) {
+        if (System.getProperties().containsKey("EBUG")) {
+            StatusLogger.getLogger().setLevel(Level.DEBUG);
+        }
         testClassName = description.getClassName();
         return new Statement() {
             @Override