Repository: logging-log4j2 Updated Branches: refs/heads/master 3752f48e8 -> 842d1d8ea
[LOG4J2-2023] Use a class' canonical name instead of name to create its logger name. If the canonical name is null, then use the class name. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/842d1d8e Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/842d1d8e Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/842d1d8e Branch: refs/heads/master Commit: 842d1d8ea1e8a94eead1ab0af3ade5c3b9c843ee Parents: 3752f48 Author: Gary Gregory <[email protected]> Authored: Thu Aug 31 14:56:38 2017 -0600 Committer: Gary Gregory <[email protected]> Committed: Thu Aug 31 14:56:38 2017 -0600 ---------------------------------------------------------------------- .../org/apache/logging/log4j/LogManagerTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/842d1d8e/log4j-api/src/test/java/org/apache/logging/log4j/LogManagerTest.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/LogManagerTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/LogManagerTest.java index d9847f2..99e6ce8 100644 --- a/log4j-api/src/test/java/org/apache/logging/log4j/LogManagerTest.java +++ b/log4j-api/src/test/java/org/apache/logging/log4j/LogManagerTest.java @@ -23,6 +23,9 @@ import org.junit.Test; import static org.junit.Assert.*; +import java.io.Closeable; +import java.io.IOException; + /** * */ @@ -65,6 +68,20 @@ public class LogManagerTest { } @Test + public void testGetLoggerForAnonymousInnerClass() throws IOException { + Closeable closeable = new Closeable() { + + Logger LOGGER = LogManager.getLogger(getClass()); + + @Override + public void close() throws IOException { + Assert.assertEquals("org.apache.logging.log4j.LogManagerTest$1", LOGGER.getName()); + } + }; + closeable.close(); + } + + @Test public void testGetLoggerForInnerClass() { Assert.assertEquals("org.apache.logging.log4j.LogManagerTest.InnerClass", InnerClass.LOGGER.getName()); }
