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/LOG4J2-1349-gcfree-threadcontext
Commit: f2a07e66a724f26554cb9f5ed62cfb4fbae889fb
Parents: 74f5976
Author: Gary Gregory <ggreg...@apache.org>
Authored: Fri Sep 9 09:31:54 2016 -0700
Committer: Gary Gregory <ggreg...@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

Reply via email to