You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/03/24 17:16:32 UTC
[05/11] logging-log4j2 git commit: Fix GcFreeLoggingTest
Fix GcFreeLoggingTest
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/13859245
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/13859245
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/13859245
Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 138592456d36ebc9ef1cc24e0a842d35fe729801
Parents: 80cc833
Author: Mikael Ståldal <mi...@magine.com>
Authored: Wed Mar 23 14:45:56 2016 +0100
Committer: Mikael Ståldal <mi...@magine.com>
Committed: Wed Mar 23 14:45:56 2016 +0100
----------------------------------------------------------------------
.../logging/log4j/core/GcFreeLoggingTest.java | 6 +++---
log4j-core/src/test/resources/gcFreeLogging.xml | 19 +++++++++++++++++++
2 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/13859245/log4j-core/src/test/java/org/apache/logging/log4j/core/GcFreeLoggingTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/GcFreeLoggingTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/GcFreeLoggingTest.java
index 4a52ff6..00fa319 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/GcFreeLoggingTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/GcFreeLoggingTest.java
@@ -68,7 +68,7 @@ public class GcFreeLoggingTest {
public static void main(String[] args) throws Exception {
System.setProperty("log4j2.enable.threadlocals", "true");
System.setProperty("log4j2.is.webapp", "false");
- System.setProperty("log4j.configurationFile", "perf3PlainNoLoc.xml");
+ System.setProperty("log4j.configurationFile", "gcFreeLogging.xml");
System.setProperty("Log4jContextSelector", AsyncLoggerContextSelector.class.getName());
assertTrue("Constants.ENABLE_THREADLOCALS", Constants.ENABLE_THREADLOCALS);
@@ -114,8 +114,8 @@ public class GcFreeLoggingTest {
logger.error("Test parameterized message {}{}", "param", "param2");
logger.error("Test parameterized message {}{}{}", "param", "param2", "abc");
}
- AllocationRecorder.removeSampler(sampler);
Thread.sleep(50);
+ AllocationRecorder.removeSampler(sampler);
}
private static File agentJar() {
@@ -125,7 +125,7 @@ public class GcFreeLoggingTest {
throw new IllegalStateException("Could not find url for " + name);
}
final String temp = url.toString();
- final String path = temp.substring("jar:file:/".length(), temp.indexOf('!'));
+ final String path = temp.substring("jar:file:".length(), temp.indexOf('!'));
return new File(path);
}
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/13859245/log4j-core/src/test/resources/gcFreeLogging.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/gcFreeLogging.xml b/log4j-core/src/test/resources/gcFreeLogging.xml
new file mode 100644
index 0000000..6cf9066
--- /dev/null
+++ b/log4j-core/src/test/resources/gcFreeLogging.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="OFF">
+ <Appenders>
+ <RandomAccessFile name="RandomAccessFilePattern" fileName="gcfree.log" immediateFlush="false" append="false">
+ <PatternLayout>
+ <Pattern>%d %p %c{1.} [%t] %X{aKey} %m %ex%n</Pattern>
+ </PatternLayout>
+ </RandomAccessFile>
+ <RandomAccessFile name="RandomAccessFileGelf" fileName="gcfree.json" immediateFlush="false" append="false">
+ <GelfLayout compressionType="OFF"/>
+ </RandomAccessFile>
+ </Appenders>
+ <Loggers>
+ <Root level="info" includeLocation="false">
+ <appender-ref ref="RandomAccessFilePattern"/>
+ <appender-ref ref="RandomAccessFileGelf"/>
+ </Root>
+ </Loggers>
+</Configuration>