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 2016/09/09 16:31:57 UTC

logging-log4j2 git commit: Add org.apache.logging.log4j.junit.LoggerContextRule.getLogger(Class).

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 74f597635 -> f2a07e66a


Add
org.apache.logging.log4j.junit.LoggerContextRule.getLogger(Class<?>).

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

Branch: refs/heads/master
Commit: f2a07e66a724f26554cb9f5ed62cfb4fbae889fb
Parents: 74f5976
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Sep 9 09:31:54 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Sep 9 09:31:54 2016 -0700

----------------------------------------------------------------------
 .../apache/logging/log4j/junit/LoggerContextRule.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f2a07e66/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
----------------------------------------------------------------------
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 cc0b343..1f1a95e 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
@@ -208,6 +208,17 @@ public class LoggerContextRule implements TestRule {
     }
 
     /**
+     * Gets a named Logger for the given class in this LoggerContext.
+     *
+     * @param clazz
+     *            The Class whose name should be used as the Logger name. If null it will default to the calling class.
+     * @return the named Logger.
+     */
+    public Logger getLogger(final Class<?> clazz) {
+        return loggerContext.getLogger(clazz.getName());
+    }
+
+    /**
      * Gets a named Logger in this LoggerContext.
      *
      * @param name