[2/3] logging-log4j2 git commit: LOG4J2-323 improved helper status logging
LOG4J2-323 improved helper status logging Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/129ae4aa Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/129ae4aa Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/129ae4aa Branch: refs/heads/master Commit: 129ae4aae60ba1dc0c9dc9a87fde6caca35e7f6c Parents: 6b7e138 Author: rpopmaAuthored: Fri Oct 23 23:16:21 2015 +0900 Committer: rpopma Committed: Fri Oct 23 23:16:21 2015 +0900 -- .../core/async/AsyncLoggerConfigHelper.java | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/129ae4aa/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigHelper.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigHelper.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigHelper.java index 6636eba..1efdd18 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigHelper.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigHelper.java @@ -116,22 +116,23 @@ class AsyncLoggerConfigHelper implements AsyncLoggerConfigDelegate { disruptor.handleEventsWith(handlers); LOGGER.debug( -"Starting AsyncLoggerConfig disruptor with ringbuffer size={}, waitStrategy={}, exceptionHandler={}...", +"Starting AsyncLoggerConfig disruptor with ringbufferSize={}, waitStrategy={}, exceptionHandler={}...", disruptor.getRingBuffer().getBufferSize(), waitStrategy.getClass().getSimpleName(), errorHandler); disruptor.start(); } private static WaitStrategy createWaitStrategy() { final String strategy = System.getProperty("AsyncLoggerConfig.WaitStrategy"); -LOGGER.trace("property AsyncLoggerConfig.WaitStrategy={}", strategy); -if ("Sleep".equals(strategy)) { -return new SleepingWaitStrategy(); -} else if ("Yield".equals(strategy)) { -return new YieldingWaitStrategy(); -} else if ("Block".equals(strategy)) { -return new BlockingWaitStrategy(); +if (strategy != null) { + LOGGER.trace("property AsyncLoggerConfig.WaitStrategy={}", strategy); + if ("Sleep".equals(strategy)) { + return new SleepingWaitStrategy(); + } else if ("Yield".equals(strategy)) { + return new YieldingWaitStrategy(); + } else if ("Block".equals(strategy)) { + return new BlockingWaitStrategy(); + } } -LOGGER.trace("AsyncLoggerConfigHelper disruptor event handler uses BlockingWaitStrategy"); return new BlockingWaitStrategy(); }
logging-log4j2 git commit: LOG4J2-493 better status debug logging during disruptor start/stop
Repository: logging-log4j2 Updated Branches: refs/heads/master c705ffdc1 -> d8ede120f LOG4J2-493 better status debug logging during disruptor start/stop Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d8ede120 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d8ede120 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d8ede120 Branch: refs/heads/master Commit: d8ede120f066f1112467717d724e9d9627dde675 Parents: c705ffd Author: rpopmaAuthored: Sat Oct 24 01:10:18 2015 +0900 Committer: rpopma Committed: Sat Oct 24 01:10:18 2015 +0900 -- .../logging/log4j/core/async/AsyncLoggerHelper.java | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d8ede120/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java index 5c90eae..bd8508a 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java @@ -75,10 +75,11 @@ class AsyncLoggerHelper { */ synchronized void start() { if (disruptor != null) { -LOGGER.trace("[{}] AsyncLoggerHelper not starting new disruptor, using existing object.", contextName); +LOGGER.trace("[{}] AsyncLoggerHelper not starting new disruptor for this context, using existing object.", +contextName); return; } -LOGGER.trace("[{}] AsyncLoggerHelper creating new disruptor.", contextName); +LOGGER.trace("[{}] AsyncLoggerHelper creating new disruptor for this context.", contextName); final int ringBufferSize = calculateRingBufferSize(); final WaitStrategy waitStrategy = createWaitStrategy(); executor = Executors.newSingleThreadExecutor(new DaemonThreadFactory("AsyncLogger[" + contextName + "]")); @@ -94,7 +95,7 @@ class AsyncLoggerHelper { disruptor.handleEventsWith(handlers); LOGGER.debug( - "[{}] Starting AsyncLogger disruptor with ringbufferSize={}, waitStrategy={}, exceptionHandler={}...", + "[{}] Starting AsyncLogger disruptor for this context with ringbufferSize={}, waitStrategy={}, exceptionHandler={}...", contextName, disruptor.getRingBuffer().getBufferSize(), waitStrategy.getClass().getSimpleName(), errorHandler); disruptor.start(); @@ -182,13 +183,12 @@ class AsyncLoggerHelper { synchronized void stop() { final Disruptor temp = getDisruptor(); if (temp == null) { -LOGGER.trace("[{}] AsyncLoggerHelper: disruptor already shut down.", contextName); +LOGGER.trace("[{}] AsyncLoggerHelper: disruptor for this context already shut down.", contextName); return; // disruptor was already shut down by another thread } -LOGGER.debug("[{}] AsyncLoggerHelper: shutting down disruptor.", contextName); +LOGGER.debug("[{}] AsyncLoggerHelper: shutting down disruptor for this context.", contextName); -// Must guarantee that publishing to the RingBuffer has stopped -// before we call disruptor.shutdown() +// We must guarantee that publishing to the RingBuffer has stopped before we call disruptor.shutdown(). disruptor = null; // client code fails with NPE if log after stop. This is by design. // Calling Disruptor.shutdown() will wait until all enqueued events are fully processed,
[16/50] logging-log4j2 git commit: Use try-with-resources.
Use try-with-resources. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/6fa48c56 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/6fa48c56 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/6fa48c56 Branch: refs/heads/LOG4J2-1161 Commit: 6fa48c56075c1f74b118a9166540fd570b45f0a5 Parents: 95e9bda Author: Matt SickerAuthored: Wed Oct 21 01:08:05 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 01:08:05 2015 -0500 -- .../java/org/apache/logging/log4j/core/config/XIncludeTest.java | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6fa48c56/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java index 566081b..807e0cb 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java @@ -126,14 +126,11 @@ public class XIncludeTest { logger.debug("This is test message number {}", random); int count = 0; String line = Strings.EMPTY; -final BufferedReader in = new BufferedReader(new FileReader(this.logFileName)); -try { +try (BufferedReader in = new BufferedReader(new FileReader(this.logFileName))) { while (in.ready()) { ++count; line = in.readLine(); } -} finally { -in.close(); } assertThat(count, is(equalTo(1))); assertThat(line, endsWith(Long.toString(random)));
[22/50] logging-log4j2 git commit: Use TemporaryFolder rule.
Use TemporaryFolder rule. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/080ce0f4 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/080ce0f4 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/080ce0f4 Branch: refs/heads/LOG4J2-1161 Commit: 080ce0f49c88a9e7006932ef0b6555d48c15d738 Parents: 844187e Author: Matt SickerAuthored: Wed Oct 21 01:45:27 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 01:45:27 2015 -0500 -- .../appender/RandomAccessFileManagerTest.java | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/080ce0f4/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/RandomAccessFileManagerTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/RandomAccessFileManagerTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/RandomAccessFileManagerTest.java index e38f5fa..f127db3 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/RandomAccessFileManagerTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/RandomAccessFileManagerTest.java @@ -23,7 +23,9 @@ import java.io.OutputStream; import java.io.RandomAccessFile; import org.apache.logging.log4j.core.util.NullOutputStream; +import org.junit.ClassRule; import org.junit.Test; +import org.junit.rules.TemporaryFolder; import static org.junit.Assert.*; @@ -32,6 +34,9 @@ import static org.junit.Assert.*; */ public class RandomAccessFileManagerTest { +@ClassRule +public static TemporaryFolder folder = new TemporaryFolder(); + /** * Test method for * {@link org.apache.logging.log4j.core.appender.RandomAccessFileManager#write(byte[], int, int)} @@ -39,8 +44,7 @@ public class RandomAccessFileManagerTest { */ @Test public void testWrite_multiplesOfBufferSize() throws IOException { -final File file = File.createTempFile("log4j2", "test"); -file.deleteOnExit(); +final File file = folder.newFile(); try (final RandomAccessFile raf = new RandomAccessFile(file, "rw")) { final OutputStream os = NullOutputStream.NULL_OUTPUT_STREAM; final RandomAccessFileManager manager = new RandomAccessFileManager(raf, file.getName(), os, false, @@ -61,8 +65,7 @@ public class RandomAccessFileManagerTest { */ @Test public void testWrite_dataExceedingBufferSize() throws IOException { -final File file = File.createTempFile("log4j2", "test"); -file.deleteOnExit(); +final File file = folder.newFile(); try (final RandomAccessFile raf = new RandomAccessFile(file, "rw")) { final OutputStream os = NullOutputStream.NULL_OUTPUT_STREAM; final RandomAccessFileManager manager = new RandomAccessFileManager(raf, file.getName(), os, false, @@ -79,8 +82,7 @@ public class RandomAccessFileManagerTest { @Test public void testConfigurableBufferSize() throws IOException { -final File file = File.createTempFile("log4j2", "test"); -file.deleteOnExit(); +final File file = folder.newFile(); try (final RandomAccessFile raf = new RandomAccessFile(file, "rw")) { final OutputStream os = NullOutputStream.NULL_OUTPUT_STREAM; final int bufferSize = 4 * 1024; @@ -95,8 +97,7 @@ public class RandomAccessFileManagerTest { @Test public void testWrite_dataExceedingMinBufferSize() throws IOException { -final File file = File.createTempFile("log4j2", "test"); -file.deleteOnExit(); +final File file = folder.newFile(); try (final RandomAccessFile raf = new RandomAccessFile(file, "rw")) { final OutputStream os = NullOutputStream.NULL_OUTPUT_STREAM; final int bufferSize = 1; @@ -115,8 +116,7 @@ public class RandomAccessFileManagerTest { @Test public void testAppendDoesNotOverwriteExistingFile() throws IOException { final boolean isAppend = true; -final File file = File.createTempFile("log4j2", "test"); -file.deleteOnExit(); +final File file = folder.newFile(); assertEquals(0, file.length()); final byte[] bytes = new byte[4 * 1024];
[40/50] logging-log4j2 git commit: fix test to work correctly on machines where locale is en_US but date symbols are Japanese
fix test to work correctly on machines where locale is en_US but date symbols are Japanese Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/6e45177d Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/6e45177d Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/6e45177d Branch: refs/heads/LOG4J2-1161 Commit: 6e45177dd8ab5509a28d3f45312405db5edf2dd0 Parents: 59cc8e5 Author: rpopmaAuthored: Fri Oct 23 01:51:33 2015 +0900 Committer: rpopma Committed: Fri Oct 23 01:51:33 2015 +0900 -- .../log4j/core/util/datetime/FixedDateFormatTest.java | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6e45177d/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java index dc222e7..8bfc6af 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java @@ -19,6 +19,7 @@ package org.apache.logging.log4j.core.util.datetime; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; import java.util.concurrent.TimeUnit; import org.apache.logging.log4j.core.util.datetime.FixedDateFormat.FixedFormat; @@ -68,7 +69,7 @@ public class FixedDateFormatTest { assertEquals("MMdd", FixedFormat.COMPACT.getFastDateFormat().getPattern()); assertEquals("-MM-dd ", FixedFormat.DEFAULT.getFastDateFormat().getPattern()); } - + @Test public void testCreateIfSupported_nonNullIfNameMatches() { for (final FixedDateFormat.FixedFormat format : FixedDateFormat.FixedFormat.values()) { @@ -121,7 +122,7 @@ public class FixedDateFormatTest { assertNull("timezone", FixedDateFormat.createIfSupported(options)); } -@Test(expected=NullPointerException.class) +@Test(expected = NullPointerException.class) public void testConstructorDisallowsNull() { new FixedDateFormat(null); } @@ -138,7 +139,7 @@ public class FixedDateFormatTest { final long start = now - TimeUnit.HOURS.toMillis(25); final long end = now + TimeUnit.HOURS.toMillis(25); for (final FixedFormat format : FixedFormat.values()) { -final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern()); +final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern(), Locale.getDefault()); final FixedDateFormat customTF = new FixedDateFormat(format); for (long time = start; time < end; time += 12345) { final String actual = customTF.format(time); @@ -154,7 +155,7 @@ public class FixedDateFormatTest { final long start = now - TimeUnit.HOURS.toMillis(25); final long end = now + TimeUnit.HOURS.toMillis(25); for (final FixedFormat format : FixedFormat.values()) { -final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern()); +final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern(), Locale.getDefault()); final FixedDateFormat customTF = new FixedDateFormat(format); for (long time = end; time > start; time -= 12345) { final String actual = customTF.format(time); @@ -171,7 +172,7 @@ public class FixedDateFormatTest { final long end = now + TimeUnit.HOURS.toMillis(25); final char[] buffer = new char[128]; for (final FixedFormat format : FixedFormat.values()) { -final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern()); +final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern(), Locale.getDefault()); final FixedDateFormat customTF = new FixedDateFormat(format); for (long time = start; time < end; time += 12345) { final int length = customTF.format(time, buffer, 23); @@ -189,7 +190,7 @@ public class FixedDateFormatTest { final long end = now + TimeUnit.HOURS.toMillis(25); final char[] buffer = new char[128]; for (final FixedFormat format : FixedFormat.values()) { -final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern()); +final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern(), Locale.getDefault());
[09/50] logging-log4j2 git commit: Make non-serializable field transient.
Make non-serializable field transient. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/237d9a48 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/237d9a48 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/237d9a48 Branch: refs/heads/LOG4J2-1161 Commit: 237d9a48ebf5f37ad0e5f34b7ae35443b08b548b Parents: d8dab5a Author: Matt SickerAuthored: Fri Oct 16 22:37:01 2015 -0500 Committer: Matt Sicker Committed: Tue Oct 20 23:55:32 2015 -0500 -- .../apache/logging/log4j/message/LocalizedMessageFactory.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/237d9a48/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessageFactory.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessageFactory.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessageFactory.java index 06b6dd3..08be290 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessageFactory.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/LocalizedMessageFactory.java @@ -25,8 +25,9 @@ import java.util.ResourceBundle; public class LocalizedMessageFactory extends AbstractMessageFactory { private static final long serialVersionUID = 1L; - -private final ResourceBundle resourceBundle; + +// FIXME: cannot use ResourceBundle name for serialization until Java 8 +private transient final ResourceBundle resourceBundle; private final String baseName; public LocalizedMessageFactory(final ResourceBundle resourceBundle) {
[20/50] logging-log4j2 git commit: Use try-with-resources
Use try-with-resources Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/aad67342 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/aad67342 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/aad67342 Branch: refs/heads/LOG4J2-1161 Commit: aad6734263272df070846170e75720664dab99b0 Parents: b0df3f4 Author: Matt SickerAuthored: Wed Oct 21 01:26:08 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 01:26:08 2015 -0500 -- .../log4j/core/appender/JsonCompleteFileAppenderTest.java | 5 + .../appender/MemoryMappedFileAppenderLocationTest.java| 5 + .../core/appender/MemoryMappedFileAppenderRemapTest.java | 5 + .../core/appender/MemoryMappedFileAppenderSimpleTest.java | 5 + .../core/appender/RandomAccessFileAppenderTests.java | 5 + .../log4j/core/appender/XmlCompactFileAppenderTest.java | 4 +--- .../log4j/core/appender/XmlCompleteFileAppenderTest.java | 4 +--- .../logging/log4j/core/appender/XmlFileAppenderTest.java | 4 +--- .../core/appender/XmlRandomAccessFileAppenderTest.java| 4 +--- .../core/appender/db/jdbc/AbstractJdbcAppenderTest.java | 5 + .../logging/log4j/core/async/perftest/PerfTest.java | 5 + .../logging/log4j/core/config/ConfigurationTest.java | 5 + .../logging/log4j/core/net/ssl/SslConfigurationTest.java | 10 ++ .../java/org/apache/logging/log4j/core/util/Compare.java | 9 ++--- .../logging/log4j/perf/jmh/JdbcAppenderBenchmark.java | 5 + 15 files changed, 17 insertions(+), 63 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/aad67342/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/JsonCompleteFileAppenderTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/JsonCompleteFileAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/JsonCompleteFileAppenderTest.java index 5d9b6a1..6634fde 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/JsonCompleteFileAppenderTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/JsonCompleteFileAppenderTest.java @@ -55,16 +55,13 @@ public class JsonCompleteFileAppenderTest { String line4; String line5; String line6; -final BufferedReader reader = new BufferedReader(new FileReader(this.logFile)); -try { +try (final BufferedReader reader = new BufferedReader(new FileReader(this.logFile))) { line1 = reader.readLine(); line2 = reader.readLine(); line3 = reader.readLine(); line4 = reader.readLine(); line5 = reader.readLine(); line6 = reader.readLine(); -} finally { -reader.close(); } assertNotNull("line1", line1); final String msg1 = "["; http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/aad67342/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderLocationTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderLocationTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderLocationTest.java index cad76bc..54c2cee 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderLocationTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderLocationTest.java @@ -75,13 +75,10 @@ public class MemoryMappedFileAppenderLocationTest { assertEquals("Shrunk to actual used size", 474 + 2 * LINESEP, f.length()); String line1, line2, line3; -final BufferedReader reader = new BufferedReader(new FileReader(LOGFILE)); -try { +try (final BufferedReader reader = new BufferedReader(new FileReader(LOGFILE))) { line1 = reader.readLine(); line2 = reader.readLine(); line3 = reader.readLine(); -} finally { -reader.close(); } assertNotNull(line1); assertThat(line1, containsString("Test log1")); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/aad67342/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java
[28/50] logging-log4j2 git commit: Remove redundant casts.
Remove redundant casts. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4612109f Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4612109f Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4612109f Branch: refs/heads/LOG4J2-1161 Commit: 4612109f696fe9e841773ff1eedbd55b49ad1f06 Parents: 22a8b3d Author: Matt SickerAuthored: Wed Oct 21 02:35:57 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 02:35:57 2015 -0500 -- .../log4j/core/appender/routing/RoutingAppenderWithJndiTest.java | 4 ++-- .../log4j/core/appender/routing/RoutingDefaultAppenderTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4612109f/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutingAppenderWithJndiTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutingAppenderWithJndiTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutingAppenderWithJndiTest.java index f27f8ff..9339846 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutingAppenderWithJndiTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutingAppenderWithJndiTest.java @@ -50,8 +50,8 @@ public class RoutingAppenderWithJndiTest { @Before public void before() throws NamingException { MockContextFactory.setAsInitial(); -listAppender1 = (ListAppender) RoutingAppenderWithJndiTest.init.getAppender("List1"); -listAppender2 = (ListAppender) RoutingAppenderWithJndiTest.init.getAppender("List2"); +listAppender1 = RoutingAppenderWithJndiTest.init.getListAppender("List1"); +listAppender2 = RoutingAppenderWithJndiTest.init.getListAppender("List2"); } @After http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4612109f/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutingDefaultAppenderTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutingDefaultAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutingDefaultAppenderTest.java index 948f8a9..a84460c 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutingDefaultAppenderTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutingDefaultAppenderTest.java @@ -48,7 +48,7 @@ public class RoutingDefaultAppenderTest { @Before public void setUp() throws Exception { -app = (ListAppender) this.init.getAppender("List"); +app = this.init.getListAppender("List"); } @After
[10/50] logging-log4j2 git commit: Make Logger properly serializable using proxy class.
Make Logger properly serializable using proxy 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/37f85123 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/37f85123 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/37f85123 Branch: refs/heads/LOG4J2-1161 Commit: 37f8512339da826c8c0be1c4aa30ed2840e48c13 Parents: 237d9a4 Author: Matt SickerAuthored: Wed Oct 21 00:13:36 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 00:13:36 2015 -0500 -- .../org/apache/logging/log4j/core/Logger.java | 50 ++-- .../log4j/core/LoggerSerializationTest.java | 2 - 2 files changed, 46 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/37f85123/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java index 40852a5..51b3e39 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java @@ -16,6 +16,7 @@ */ package org.apache.logging.log4j.core; +import java.io.ObjectStreamException; import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; @@ -72,10 +73,14 @@ public class Logger extends AbstractLogger implements Supplier { privateConfig = new PrivateConfig(context.getConfiguration(), this); } +protected Object writeReplace() throws ObjectStreamException { +return new LoggerProxy(getName(), getMessageFactory()); +} + /** * This method is only used for 1.x compatibility. Returns the parent of this Logger. If it doesn't already exist * return a temporary Logger. - * + * * @return The parent Logger. */ public Logger getParent() { @@ -285,9 +290,7 @@ public class Logger extends AbstractLogger implements Supplier { /** * The binding between a Logger and its configuration. */ -// TODO: Should not be Serializable per EJ item 74 (2nd Ed)? -protected class PrivateConfig implements Serializable { -private static final long serialVersionUID = 1L; +protected class PrivateConfig { // config fields are public to make them visible to Logger subclasses /** LoggerConfig to delegate the actual logging to. */ public final LoggerConfig loggerConfig; // SUPPRESS CHECKSTYLE @@ -389,6 +392,28 @@ public class Logger extends AbstractLogger implements Supplier { } /** + * Serialization proxy class for Logger. Since the LoggerContext and config information can be reconstructed on the + * fly, the only information needed for a Logger are what's available in AbstractLogger. + * + * @since 2.5 + */ +protected static class LoggerProxy implements Serializable { +private static final long serialVersionUID = 1L; + +private final String name; +private final MessageFactory messageFactory; + +public LoggerProxy(String name, MessageFactory messageFactory) { +this.name = name; +this.messageFactory = messageFactory; +} + +protected Object readResolve() throws ObjectStreamException { +return new Logger(LoggerContext.getContext(), name, messageFactory); +} +} + +/** * Returns a String representation of this instance in the form {@code "name:level[ in context_name]"}. * * @return A String describing this Logger instance. @@ -402,4 +427,21 @@ public class Logger extends AbstractLogger implements Supplier { final String contextName = context.getName(); return contextName == null ? nameLevel : nameLevel + " in " + contextName; } + +@Override +public boolean equals(final Object o) { +if (this == o) { +return true; +} +if (o == null || getClass() != o.getClass()) { +return false; +} +final Logger that = (Logger) o; +return getName().equals(that.getName()); +} + +@Override +public int hashCode() { +return getName().hashCode(); +} } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/37f85123/log4j-core/src/test/java/org/apache/logging/log4j/core/LoggerSerializationTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/LoggerSerializationTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/LoggerSerializationTest.java
[01/50] logging-log4j2 git commit: LOG4J2-323, 493, 1159 factor out AsyncLogger.Info into top-level class
Repository: logging-log4j2 Updated Branches: refs/heads/LOG4J2-1161 990a97c0b -> d3a064150 LOG4J2-323, 493, 1159 factor out AsyncLogger.Info into top-level 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/bf3ba25d Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/bf3ba25d Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/bf3ba25d Branch: refs/heads/LOG4J2-1161 Commit: bf3ba25dfe9e4d8a831bea783bed3a6e65b4593b Parents: 6d62c74 Author: rpopmaAuthored: Wed Oct 21 02:04:10 2015 +0900 Committer: rpopma Committed: Wed Oct 21 02:04:10 2015 +0900 -- .../logging/log4j/core/async/AsyncLogger.java | 89 --- .../log4j/core/async/AsyncLoggerHelper.java | 5 +- .../apache/logging/log4j/core/async/Info.java | 109 +++ .../AsyncLoggerThreadNameStrategyTest.java | 4 +- 4 files changed, 114 insertions(+), 93 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bf3ba25d/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java index c2214f8..72d81d3 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java @@ -18,7 +18,6 @@ package org.apache.logging.log4j.core.async; import java.util.Map; import java.util.Objects; -import java.util.concurrent.ExecutorService; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Marker; @@ -37,7 +36,6 @@ import org.apache.logging.log4j.message.Message; import org.apache.logging.log4j.message.MessageFactory; import org.apache.logging.log4j.message.TimestampMessage; import org.apache.logging.log4j.status.StatusLogger; -import org.apache.logging.log4j.util.PropertiesUtil; import com.lmax.disruptor.dsl.Disruptor; @@ -62,98 +60,12 @@ import com.lmax.disruptor.dsl.Disruptor; */ public class AsyncLogger extends Logger { -/** - * Strategy for deciding whether thread name should be cached or not. - */ -static enum ThreadNameStrategy { // LOG4J2-467 -CACHED { -@Override -public String getThreadName(final Info info) { -return info.cachedThreadName; -} -}, -UNCACHED { -@Override -public String getThreadName(final Info info) { -return Thread.currentThread().getName(); -} -}; -abstract String getThreadName(Info info); - -static ThreadNameStrategy create() { -final String name = PropertiesUtil.getProperties().getStringProperty("AsyncLogger.ThreadNameStrategy", -CACHED.name()); -try { -final ThreadNameStrategy result = ThreadNameStrategy.valueOf(name); -LOGGER.debug("AsyncLogger.ThreadNameStrategy={}", result); -return result; -} catch (final Exception ex) { -LOGGER.debug("Using AsyncLogger.ThreadNameStrategy.CACHED: '{}' not valid: {}", name, ex.toString()); -return CACHED; -} -} -} - -/** - * Tuple with the event translator and thread name for a thread. - */ -static class Info { -private final RingBufferLogEventTranslator translator; -private final String cachedThreadName; -private final boolean isAppenderThread; - -public Info(final RingBufferLogEventTranslator translator, final String threadName, final boolean appenderThread) { -this.translator = translator; -this.cachedThreadName = threadName; -this.isAppenderThread = appenderThread; -} - -/** - * Initialize an {@code Info} object that is threadlocal to the consumer/appender thread. This Info object - * uniquely has attribute {@code isAppenderThread} set to {@code true}. All other Info objects will have this - * attribute set to {@code false}. This allows us to detect Logger.log() calls initiated from the appender - * thread, which may cause deadlock when the RingBuffer is full. (LOG4J2-471) - * - * @param executor runs the appender thread - */ -public static void initExecutorThreadInstance(final ExecutorService executor) { -executor.submit(new Runnable() { -@Override -public void run() { -final boolean
[25/50] logging-log4j2 git commit: Remove redundant casts.
Remove redundant casts. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/ed65b408 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ed65b408 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ed65b408 Branch: refs/heads/LOG4J2-1161 Commit: ed65b408c4fab44850e8fd61191961c88149d4d5 Parents: 0b72e49 Author: Matt SickerAuthored: Wed Oct 21 02:06:04 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 02:06:04 2015 -0500 -- .../log4j/core/appender/RollingRandomAccessFileAppender.java | 2 +- .../logging/log4j/core/appender/routing/RoutingAppender.java | 2 +- .../java/org/apache/logging/log4j/core/layout/PatternLayout.java | 2 +- .../java/org/apache/logging/log4j/core/layout/Rfc5424Layout.java | 2 +- .../log4j/core/pattern/ExtendedThrowablePatternConverter.java | 2 +- .../logging/log4j/core/pattern/RootThrowablePatternConverter.java | 2 +- .../log4j/core/appender/routing/JsonRoutingAppender2Test.java | 2 +- .../log4j/core/appender/routing/JsonRoutingAppenderTest.java | 2 +- .../log4j/core/async/AsyncLoggersWithAsyncAppenderTest.java| 2 +- .../log4j/core/async/AsyncLoggersWithAsyncLoggerConfigTest.java| 2 +- .../log4j/core/config/plugins/util/PluginManagerPackagesTest.java | 2 +- .../logging/log4j/perf/jmh/AsyncAppenderLogbackBenchmark.java | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ed65b408/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java index 4efdaa8..cf47d46 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java @@ -121,7 +121,7 @@ public final class RollingRandomAccessFileAppender extends AbstractOutputStreamA * @return the buffer size */ public int getBufferSize() { -return ((RollingRandomAccessFileManager) getManager()).getBufferSize(); +return getManager().getBufferSize(); } /** http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ed65b408/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java index d9b2818..02be2c2 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java @@ -151,7 +151,7 @@ public final class RoutingAppender extends AbstractAppender { final Node appNode = new Node(node); config.createConfiguration(appNode, event); if (appNode.getObject() instanceof Appender) { -final Appender app = (Appender) appNode.getObject(); +final Appender app = appNode.getObject(); app.start(); return app; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ed65b408/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java index 6c57820..28d6329 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java @@ -218,7 +218,7 @@ public final class PatternLayout extends AbstractStringLayout { if (parser == null) { parser = new PatternParser(config, KEY, LogEventPatternConverter.class); config.addComponent(KEY, parser); -parser = (PatternParser) config.getComponent(KEY); +parser = config.getComponent(KEY); } return parser; }
[29/50] logging-log4j2 git commit: Merge remote-tracking branch 'origin/master' into LOG4J2-323-493-1159-AsyncMemLeak
Merge remote-tracking branch 'origin/master' into LOG4J2-323-493-1159-AsyncMemLeak Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/a0d9be5d Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/a0d9be5d Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/a0d9be5d Branch: refs/heads/LOG4J2-1161 Commit: a0d9be5dc74a673dad9e6978a5ac48070454c4a4 Parents: c697938 4612109 Author: rpopmaAuthored: Wed Oct 21 23:47:07 2015 +0900 Committer: rpopma Committed: Wed Oct 21 23:47:07 2015 +0900 -- .../log4j/message/LocalizedMessageFactory.java | 5 +- .../org/apache/logging/log4j/core/Logger.java | 50 ++-- .../log4j/core/appender/AbstractManager.java| 21 .../core/appender/MemoryMappedFileManager.java | 7 --- .../core/appender/OutputStreamManager.java | 8 ++-- .../core/appender/RandomAccessFileManager.java | 5 +- .../RollingRandomAccessFileAppender.java| 2 +- .../appender/db/AbstractDatabaseManager.java| 6 +-- .../appender/db/jdbc/JdbcDatabaseManager.java | 4 +- .../appender/db/jpa/JpaDatabaseManager.java | 2 +- .../appender/rolling/RollingFileManager.java| 12 ++--- .../rolling/RollingRandomAccessFileManager.java | 8 ++-- .../core/appender/routing/RoutingAppender.java | 2 +- .../log4j/core/layout/PatternLayout.java| 2 +- .../log4j/core/layout/Rfc5424Layout.java| 2 +- .../logging/log4j/core/net/SmtpManager.java | 8 ++-- .../ExtendedThrowablePatternConverter.java | 2 +- .../pattern/RootThrowablePatternConverter.java | 2 +- .../logging/log4j/core/util/FileWatcher.java| 2 +- .../apache/logging/log4j/core/HostNameTest.java | 2 +- .../apache/logging/log4j/core/LogEventTest.java | 3 ++ .../logging/log4j/core/LoggerDateTest.java | 2 +- .../log4j/core/LoggerSerializationTest.java | 2 - .../apache/logging/log4j/core/LookupTest.java | 2 +- .../log4j/core/appender/AsyncAppenderTest.java | 32 + .../appender/JsonCompleteFileAppenderTest.java | 5 +- .../MemoryMappedFileAppenderLocationTest.java | 9 ++-- .../MemoryMappedFileAppenderRemapTest.java | 9 ++-- .../MemoryMappedFileAppenderSimpleTest.java | 9 ++-- .../appender/RandomAccessFileAppenderTests.java | 5 +- .../appender/RandomAccessFileManagerTest.java | 20 .../appender/XmlCompactFileAppenderTest.java| 4 +- .../appender/XmlCompleteFileAppenderTest.java | 4 +- .../core/appender/XmlFileAppenderTest.java | 4 +- .../XmlRandomAccessFileAppenderTest.java| 4 +- .../db/jdbc/AbstractJdbcAppenderTest.java | 5 +- .../routing/JsonRoutingAppender2Test.java | 40 +--- .../routing/JsonRoutingAppenderTest.java| 40 +--- .../routing/RoutingAppenderWithJndiTest.java| 4 +- .../routing/RoutingDefaultAppenderTest.java | 2 +- .../AsyncLoggersWithAsyncAppenderTest.java | 37 +++ .../AsyncLoggersWithAsyncLoggerConfigTest.java | 37 +++ .../core/async/perftest/IPerfTestRunner.java| 6 +-- .../log4j/core/async/perftest/PerfTest.java | 5 +- .../log4j/core/config/ConfigurationTest.java| 5 +- .../config/ReconfigurationDeadlockTest.java | 2 +- .../logging/log4j/core/config/XIncludeTest.java | 5 +- .../plugins/util/PluginManagerPackagesTest.java | 2 +- ...opertiesConfigurationRootLoggerOnlyTest.java | 14 +++--- .../properties/PropertiesConfigurationTest.java | 14 +++--- .../properties/RollingFilePropertiesTest.java | 15 +++--- .../core/filter/AbstractScriptFilterTest.java | 6 +-- .../log4j/core/filter/MapFilterTest.java| 23 +++-- .../core/filter/StructuredDataFilterTest.java | 15 +++--- .../core/net/ssl/SslConfigurationTest.java | 10 +--- .../apache/logging/log4j/core/util/Compare.java | 9 +--- .../log4j/core/util/WatchManagerTest.java | 10 ++-- .../logging/log4j/junit/LoggerContextRule.java | 40 ++-- .../flume/appender/FlumePersistentManager.java | 10 ++-- .../perf/jmh/AsyncAppenderLogbackBenchmark.java | 2 +- .../log4j/perf/jmh/JdbcAppenderBenchmark.java | 5 +- pom.xml | 6 +-- src/changes/changes.xml | 3 ++ 63 files changed, 290 insertions(+), 348 deletions(-) --
[06/50] logging-log4j2 git commit: Remove unused type parameter.
Remove unused type parameter. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2a82643f Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2a82643f Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2a82643f Branch: refs/heads/LOG4J2-1161 Commit: 2a82643feb5e58df374d9029d95186b7c45c736e Parents: c1748d0 Author: ggregoryAuthored: Tue Oct 20 15:36:19 2015 -0700 Committer: ggregory Committed: Tue Oct 20 15:36:19 2015 -0700 -- .../main/java/org/apache/logging/log4j/core/util/FileWatcher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2a82643f/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileWatcher.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileWatcher.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileWatcher.java index 5c1679b..1ae64a3 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileWatcher.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileWatcher.java @@ -21,7 +21,7 @@ import java.io.File; /** * Watches for changes in a Path and performs an action when the file is modified. */ -public interface FileWatcher { +public interface FileWatcher { void fileModified(File file); }
[43/50] logging-log4j2 git commit: LOG4J2-493 subclass ClassLoaderContextSelector
LOG4J2-493 subclass ClassLoaderContextSelector Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3705a75d Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3705a75d Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3705a75d Branch: refs/heads/LOG4J2-1161 Commit: 3705a75d173d489b2caa7d053b9d4f27632ebef7 Parents: 7800b8f Author: rpopmaAuthored: Fri Oct 23 02:19:42 2015 +0900 Committer: rpopma Committed: Fri Oct 23 02:19:42 2015 +0900 -- .../core/async/AsyncLoggerContextSelector.java | 43 +--- 1 file changed, 10 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3705a75d/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java index d2ee058..4d739e3 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java @@ -17,22 +17,16 @@ package org.apache.logging.log4j.core.async; import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.selector.ContextSelector; +import org.apache.logging.log4j.core.selector.ClassLoaderContextSelector; import org.apache.logging.log4j.core.util.Constants; import org.apache.logging.log4j.util.PropertiesUtil; /** - * {@code ContextSelector} that returns the singleton {@code AsyncLoggerContext}. + * {@code ContextSelector} that manages {@code AsyncLoggerContext} instances. */ -public class AsyncLoggerContextSelector implements ContextSelector { - -private ConcurrentMap contexts = new ConcurrentHashMap (); +public class AsyncLoggerContextSelector extends ClassLoaderContextSelector { /** * Returns {@code true} if the user specified this selector as the Log4jContextSelector, to make all loggers @@ -45,33 +39,16 @@ public class AsyncLoggerContextSelector implements ContextSelector { PropertiesUtil.getProperties().getStringProperty(Constants.LOG4J_CONTEXT_SELECTOR)); } -@Override -public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext) { -// LOG4J2-666 ensure unique name across separate instances created by webapp classloaders -final int hash = loader == null ? getClass().getClassLoader().hashCode() : loader.hashCode(); -final String key = "AsyncLoggerContext@" + Integer.toHexString(hash); -AsyncLoggerContext result = contexts.get(key); -if (result == null) { -result = new AsyncLoggerContext(key); -return contexts.putIfAbsent(key, result); -} -return result; -} - -@Override -public List getLoggerContexts() { -return new ArrayList(contexts.values()); +protected LoggerContext createContext(final String name, final URI configLocation) { +return new AsyncLoggerContext(name, null, configLocation); } -@Override -public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext, -final URI configLocation) { -return getContext(fqcn, loader, currentContext); +protected String toContextMapKey(final ClassLoader loader) { +// LOG4J2-666 ensure unique name across separate instances created by webapp classloaders +return "AsyncContext@" + Integer.toHexString(System.identityHashCode(loader)); } -@Override -public void removeContext(final LoggerContext context) { -contexts.remove(context.getName()); +protected String defaultContextName() { +return "DefaultAsyncContext@" + Thread.currentThread().getName(); } - }
[47/50] logging-log4j2 git commit: LOG4J2-493 test fixes
LOG4J2-493 test fixes Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7ffd4cfe Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7ffd4cfe Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7ffd4cfe Branch: refs/heads/LOG4J2-1161 Commit: 7ffd4cfe1fec0316a5cd79167f2250cba6752984 Parents: 4b0b01d Author: rpopmaAuthored: Fri Oct 23 02:39:24 2015 +0900 Committer: rpopma Committed: Fri Oct 23 02:39:24 2015 +0900 -- ...ncLoggerContextSelectorInitialStateTest.java | 30 .../async/AsyncLoggerContextSelectorTest.java | 18 +--- 2 files changed, 37 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7ffd4cfe/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorInitialStateTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorInitialStateTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorInitialStateTest.java new file mode 100644 index 000..2d547ed --- /dev/null +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorInitialStateTest.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ +package org.apache.logging.log4j.core.async; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class AsyncLoggerContextSelectorInitialStateTest { + +@Test +public void testLoggerContextsListInitiallyEmpty() { +final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); +assertTrue(selector.getLoggerContexts().isEmpty()); +} +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7ffd4cfe/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java index 23c4cdd..324aa84 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java @@ -24,11 +24,13 @@ import org.junit.Test; import static org.junit.Assert.*; public class AsyncLoggerContextSelectorTest { + +private static final String FQCN = AsyncLoggerContextSelectorTest.class.getName(); @Test public void testContextReturnsAsyncLoggerContext() { final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); -final LoggerContext context = selector.getContext(null, null, false); +final LoggerContext context = selector.getContext(FQCN, null, false); assertTrue(context instanceof AsyncLoggerContext); } @@ -36,21 +38,15 @@ public class AsyncLoggerContextSelectorTest { @Test public void testContext2ReturnsAsyncLoggerContext() { final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); -final LoggerContext context = selector.getContext(null, null, false, null); +final LoggerContext context = selector.getContext(FQCN, null, false, null); assertTrue(context instanceof AsyncLoggerContext); } @Test -public void testLoggerContextsListInitiallyEmpty() { -final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); -assertTrue(selector.getLoggerContexts().isEmpty()); -} - -@Test public void testLoggerContextsReturnsAsyncLoggerContext() { final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); -selector.getContext(null,
[44/50] logging-log4j2 git commit: LOG4J2-493 AsyncLoggerHelper constructor now takes context name; formatted code.
LOG4J2-493 AsyncLoggerHelper constructor now takes context name; formatted code. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4e1fa44a Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4e1fa44a Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4e1fa44a Branch: refs/heads/LOG4J2-1161 Commit: 4e1fa44af4ffbb088cceed9092a7866ae97e2384 Parents: 3705a75 Author: rpopmaAuthored: Fri Oct 23 02:22:34 2015 +0900 Committer: rpopma Committed: Fri Oct 23 02:22:34 2015 +0900 -- .../log4j/core/async/AsyncLoggerContext.java| 27 ++-- 1 file changed, 14 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e1fa44a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java index f9e707b..4efd7cc 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java @@ -30,38 +30,37 @@ import org.apache.logging.log4j.message.MessageFactory; public class AsyncLoggerContext extends LoggerContext { private static final long serialVersionUID = 1L; - + private final AsyncLoggerHelper helper; public AsyncLoggerContext(final String name) { super(name); -helper = new AsyncLoggerHelper(); +helper = new AsyncLoggerHelper(name); } public AsyncLoggerContext(final String name, final Object externalContext) { super(name, externalContext); -helper = new AsyncLoggerHelper(); +helper = new AsyncLoggerHelper(name); } -public AsyncLoggerContext(final String name, final Object externalContext, -final URI configLocn) { +public AsyncLoggerContext(final String name, final Object externalContext, final URI configLocn) { super(name, externalContext, configLocn); -helper = new AsyncLoggerHelper(); +helper = new AsyncLoggerHelper(name); } -public AsyncLoggerContext(final String name, final Object externalContext, -final String configLocn) { +public AsyncLoggerContext(final String name, final Object externalContext, final String configLocn) { super(name, externalContext, configLocn); -helper = new AsyncLoggerHelper(); +helper = new AsyncLoggerHelper(name); } @Override -protected Logger newInstance(final LoggerContext ctx, final String name, -final MessageFactory messageFactory) { +protected Logger newInstance(final LoggerContext ctx, final String name, final MessageFactory messageFactory) { return new AsyncLogger(ctx, name, messageFactory, helper); } -/* (non-Javadoc) +/* + * (non-Javadoc) + * * @see org.apache.logging.log4j.core.LoggerContext#start() */ @Override @@ -70,7 +69,9 @@ public class AsyncLoggerContext extends LoggerContext { super.start(); } -/* (non-Javadoc) +/* + * (non-Javadoc) + * * @see org.apache.logging.log4j.core.LoggerContext#start(org.apache.logging.log4j.core.config.Configuration) */ @Override
logging-log4j2 git commit: Rename withValue to with, add Javadoc
Repository: logging-log4j2 Updated Branches: refs/heads/LOG4J2-1161 d3a064150 -> 66bbf4ddf Rename withValue to with, add Javadoc Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/66bbf4dd Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/66bbf4dd Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/66bbf4dd Branch: refs/heads/LOG4J2-1161 Commit: 66bbf4ddfd94834817bf83a6dc06fb89fae37569 Parents: d3a0641 Author: Mikael StåldalAuthored: Fri Oct 23 15:18:16 2015 +0200 Committer: Mikael Ståldal Committed: Fri Oct 23 15:18:16 2015 +0200 -- .../java/org/apache/logging/log4j/message/MapMessage.java | 8 +++- .../apache/logging/log4j/message/StructuredDataMessage.java | 9 - .../org/apache/logging/log4j/message/MapMessageTest.java| 4 ++-- .../logging/log4j/message/StructuredDataMessageTest.java| 6 +++--- 4 files changed, 20 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/66bbf4dd/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java index 1012d0e..b113ed5 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java @@ -109,7 +109,13 @@ public class MapMessage implements MultiformatMessage { data.clear(); } -public MapMessage withValue(final String key, final String value) { +/** + * Add an item to the data Map in fluent style. + * @param key The name of the data item. + * @param value The value of the data item. + * @return {@code this} + */ +public MapMessage with(final String key, final String value) { put(key, value); return this; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/66bbf4dd/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java index abacce2..f29732e 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java @@ -130,7 +130,14 @@ public class StructuredDataMessage extends MapMessage { } -public StructuredDataMessage withValue(final String key, final String value) { +/** + * Add an item to the data Map in fluent style. + * @param key The name of the data item. + * @param value The value of the data item. + * @return {@code this} + */ +@Override +public StructuredDataMessage with(final String key, final String value) { put(key, value); return this; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/66bbf4dd/log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java -- diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java index 7f43027..e7bef75 100644 --- a/log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java +++ b/log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java @@ -40,8 +40,8 @@ public class MapMessageTest { public void testBuilder() { final String testMsg = "Test message {}"; final MapMessage msg = new MapMessage() -.withValue("message", testMsg) -.withValue("project", "Log4j"); +.with("message", testMsg) +.with("project", "Log4j"); final String result = msg.getFormattedMessage(); final String expected = "message=\"Test message {}\" project=\"Log4j\""; assertEquals(expected, result); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/66bbf4dd/log4j-api/src/test/java/org/apache/logging/log4j/message/StructuredDataMessageTest.java -- diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/message/StructuredDataMessageTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/message/StructuredDataMessageTest.java index ce9ad9b..47116f2 100644 ---
[02/50] logging-log4j2 git commit: LOG4J2-323, 493, 1159 update test for refactoring
LOG4J2-323, 493, 1159 update test for refactoring Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/c6979385 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c6979385 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c6979385 Branch: refs/heads/LOG4J2-1161 Commit: c697938585936779a47928f150401cb74967227e Parents: bf3ba25 Author: rpopmaAuthored: Wed Oct 21 02:08:43 2015 +0900 Committer: rpopma Committed: Wed Oct 21 02:08:43 2015 +0900 -- .../AsyncLoggerThreadNameStrategyTest.java | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c6979385/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerThreadNameStrategyTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerThreadNameStrategyTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerThreadNameStrategyTest.java index 4c96f87..0cf60bf 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerThreadNameStrategyTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerThreadNameStrategyTest.java @@ -24,22 +24,22 @@ public class AsyncLoggerThreadNameStrategyTest { @Test public void testDefaultThreadNameIsCached() throws Exception { -final AsyncLogger.ThreadNameStrategy tns = AsyncLogger.ThreadNameStrategy.create(); -assertSame(AsyncLogger.ThreadNameStrategy.CACHED, tns); +final Info.ThreadNameStrategy tns = Info.ThreadNameStrategy.create(); +assertSame(Info.ThreadNameStrategy.CACHED, tns); } @Test public void testUseCachedThreadNameIfInvalidConfig() throws Exception { System.setProperty("AsyncLogger.ThreadNameStrategy", "\\%%InValid "); -final AsyncLogger.ThreadNameStrategy tns = AsyncLogger.ThreadNameStrategy.create(); -assertSame(AsyncLogger.ThreadNameStrategy.CACHED, tns); +final Info.ThreadNameStrategy tns = Info.ThreadNameStrategy.create(); +assertSame(Info.ThreadNameStrategy.CACHED, tns); } @Test public void testUseUncachedThreadNameIfConfigured() throws Exception { System.setProperty("AsyncLogger.ThreadNameStrategy", "UNCACHED"); -final AsyncLogger.ThreadNameStrategy tns = AsyncLogger.ThreadNameStrategy.create(); -assertSame(AsyncLogger.ThreadNameStrategy.UNCACHED, tns); +final Info.ThreadNameStrategy tns = Info.ThreadNameStrategy.create(); +assertSame(Info.ThreadNameStrategy.UNCACHED, tns); } @Test @@ -47,11 +47,11 @@ public class AsyncLoggerThreadNameStrategyTest { final Info info = new Info(null, "original", false); final String name1 = "MODIFIED-THREADNAME1"; Thread.currentThread().setName(name1); -assertEquals(name1, AsyncLogger.ThreadNameStrategy.UNCACHED.getThreadName(info)); +assertEquals(name1, Info.ThreadNameStrategy.UNCACHED.getThreadName(info)); final String name2 = "OTHER-THREADNAME2"; Thread.currentThread().setName(name2); -assertEquals(name2, AsyncLogger.ThreadNameStrategy.UNCACHED.getThreadName(info)); +assertEquals(name2, Info.ThreadNameStrategy.UNCACHED.getThreadName(info)); } @Test @@ -59,11 +59,11 @@ public class AsyncLoggerThreadNameStrategyTest { final String original = "Original-ThreadName"; Thread.currentThread().setName(original); final Info info = new Info(null, original, false); -assertEquals(original, AsyncLogger.ThreadNameStrategy.CACHED.getThreadName(info)); +assertEquals(original, Info.ThreadNameStrategy.CACHED.getThreadName(info)); final String name2 = "OTHER-THREADNAME2"; Thread.currentThread().setName(name2); -assertEquals(original, AsyncLogger.ThreadNameStrategy.CACHED.getThreadName(info)); +assertEquals(original, Info.ThreadNameStrategy.CACHED.getThreadName(info)); } }
[17/50] logging-log4j2 git commit: Use getListAppender.
Use getListAppender. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/13b480aa Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/13b480aa Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/13b480aa Branch: refs/heads/LOG4J2-1161 Commit: 13b480aaf35849cdbb55168e4892932a94c95b55 Parents: 6fa48c5 Author: Matt SickerAuthored: Wed Oct 21 01:09:04 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 01:09:04 2015 -0500 -- .../logging/log4j/core/filter/AbstractScriptFilterTest.java| 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/13b480aa/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/AbstractScriptFilterTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/AbstractScriptFilterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/AbstractScriptFilterTest.java index bb5c4e1..56fa8f4 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/AbstractScriptFilterTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/AbstractScriptFilterTest.java @@ -43,8 +43,7 @@ public abstract class AbstractScriptFilterTest { ThreadContext.put("UserId", "JohnDoe"); logger.info("This should be logged"); ThreadContext.clearMap(); -final ListAppender app = (ListAppender) getContext().getRequiredAppender("List"); -assertNotNull("No ListAppender", app); +final ListAppender app = getContext().getListAppender("List"); try { List messages = app.getMessages(); assertNotNull("No Messages", messages); @@ -62,8 +61,7 @@ public abstract class AbstractScriptFilterTest { ThreadContext.put("UserId", "JohnDoe"); logger.info("This should be logged"); ThreadContext.clearMap(); -final ListAppender app = (ListAppender) getContext().getRequiredAppender("List"); -assertNotNull("No ListAppender", app); +final ListAppender app = getContext().getListAppender("List"); List messages = app.getMessages(); try { assertNotNull("No Messages", messages);
[37/50] logging-log4j2 git commit: LOG4J2-493 changes to AsyncLogger because AsyncLoggerHelper is no longer static
LOG4J2-493 changes to AsyncLogger because AsyncLoggerHelper is no longer static Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/dc629343 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/dc629343 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/dc629343 Branch: refs/heads/LOG4J2-1161 Commit: dc629343b71c47c972ac5673628b32b82ae33bef Parents: 12f90a9 Author: rpopmaAuthored: Thu Oct 22 10:37:41 2015 +0900 Committer: rpopma Committed: Thu Oct 22 10:37:41 2015 +0900 -- .../logging/log4j/core/async/AsyncLogger.java | 21 +++- 1 file changed, 7 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/dc629343/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java index 72d81d3..486bf69 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java @@ -27,7 +27,6 @@ import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.Property; import org.apache.logging.log4j.core.config.ReliabilityStrategy; import org.apache.logging.log4j.core.impl.Log4jLogEvent; -import org.apache.logging.log4j.core.jmx.RingBufferAdmin; import org.apache.logging.log4j.core.util.Clock; import org.apache.logging.log4j.core.util.ClockFactory; import org.apache.logging.log4j.core.util.DummyNanoClock; @@ -65,6 +64,7 @@ public class AsyncLogger extends Logger { private static final Clock CLOCK = ClockFactory.getClock(); private static volatile NanoClock nanoClock = new DummyNanoClock(); +private AsyncLoggerHelper helper; /** * Constructs an {@code AsyncLogger} with the specified context, name and message factory. @@ -72,16 +72,19 @@ public class AsyncLogger extends Logger { * @param context context of this logger * @param name name of this logger * @param messageFactory message factory of this logger + * @param helper */ -public AsyncLogger(final LoggerContext context, final String name, final MessageFactory messageFactory) { +public AsyncLogger(final LoggerContext context, final String name, final MessageFactory messageFactory, +AsyncLoggerHelper helper) { super(context, name, messageFactory); +this.helper = helper; } @Override public void logMessage(final String fqcn, final Level level, final Marker marker, final Message message, final Throwable thrown) { -final Disruptor temp = AsyncLoggerHelper.getDisruptor(); +final Disruptor temp = helper.getDisruptor(); if (temp == null) { // LOG4J2-639 LOGGER.fatal("Ignoring log event after log4j was shut down"); } else { @@ -143,7 +146,7 @@ public class AsyncLogger extends Logger { message.getFormattedMessage(); // LOG4J2-763: ask message to freeze parameters initLogMessageInfo(info, fqcn, level, marker, message, thrown); -AsyncLoggerHelper.enqueueLogMessageInfo(info.translator); +helper.enqueueLogMessageInfo(info.translator); } private void initLogMessageInfo(Info info, final String fqcn, final Level level, final Marker marker, @@ -212,16 +215,6 @@ public class AsyncLogger extends Logger { } /** - * Creates and returns a new {@code RingBufferAdmin} that instruments the ringbuffer of the {@code AsyncLogger}. - * - * @param contextName name of the global {@code AsyncLoggerContext} - * @return a new {@code RingBufferAdmin} that instruments the ringbuffer - */ -public static RingBufferAdmin createRingBufferAdmin(final String contextName) { -return AsyncLoggerHelper.createRingBufferAdmin(contextName); -} - -/** * Returns the {@code NanoClock} to use for creating the nanoTime timestamp of log events. * * @return the {@code NanoClock} to use for creating the nanoTime timestamp of log events
[36/50] logging-log4j2 git commit: LOG4J2-493 AsyncLoggerContext now has an AsyncLoggerHelper field, essentially managing one Disruptor/Executor per context
LOG4J2-493 AsyncLoggerContext now has an AsyncLoggerHelper field, essentially managing one Disruptor/Executor per context Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/12f90a9f Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/12f90a9f Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/12f90a9f Branch: refs/heads/LOG4J2-1161 Commit: 12f90a9f1f615b3bfb0bdc104698b1495eab0e20 Parents: 586920b Author: rpopmaAuthored: Thu Oct 22 10:36:37 2015 +0900 Committer: rpopma Committed: Thu Oct 22 10:36:37 2015 +0900 -- .../log4j/core/async/AsyncLoggerContext.java| 26 +--- 1 file changed, 22 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/12f90a9f/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java index 44bc41f..f9e707b 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java @@ -21,6 +21,7 @@ import java.net.URI; import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.Configuration; +import org.apache.logging.log4j.core.jmx.RingBufferAdmin; import org.apache.logging.log4j.message.MessageFactory; /** @@ -29,29 +30,35 @@ import org.apache.logging.log4j.message.MessageFactory; public class AsyncLoggerContext extends LoggerContext { private static final long serialVersionUID = 1L; + +private final AsyncLoggerHelper helper; public AsyncLoggerContext(final String name) { super(name); +helper = new AsyncLoggerHelper(); } public AsyncLoggerContext(final String name, final Object externalContext) { super(name, externalContext); +helper = new AsyncLoggerHelper(); } public AsyncLoggerContext(final String name, final Object externalContext, final URI configLocn) { super(name, externalContext, configLocn); +helper = new AsyncLoggerHelper(); } public AsyncLoggerContext(final String name, final Object externalContext, final String configLocn) { super(name, externalContext, configLocn); +helper = new AsyncLoggerHelper(); } @Override protected Logger newInstance(final LoggerContext ctx, final String name, final MessageFactory messageFactory) { -return new AsyncLogger(ctx, name, messageFactory); +return new AsyncLogger(ctx, name, messageFactory, helper); } /* (non-Javadoc) @@ -59,7 +66,7 @@ public class AsyncLoggerContext extends LoggerContext { */ @Override public void start() { -AsyncLoggerHelper.start(); +helper.start(); super.start(); } @@ -68,13 +75,24 @@ public class AsyncLoggerContext extends LoggerContext { */ @Override public void start(Configuration config) { -AsyncLoggerHelper.start(); +helper.start(); super.start(config); } @Override public void stop() { -AsyncLoggerHelper.stop(); // first stop Disruptor +helper.stop(); // first stop Disruptor super.stop(); } + +/** + * Creates and returns a new {@code RingBufferAdmin} that instruments the ringbuffer of the {@code AsyncLogger} + * objects. + * + * @param contextName name of this {@code AsyncLoggerContext} + * @return a new {@code RingBufferAdmin} that instruments the ringbuffer + */ +public RingBufferAdmin createRingBufferAdmin() { +return helper.createRingBufferAdmin(getName()); +} }
[15/50] logging-log4j2 git commit: Invert assert usage.
Invert assert usage. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/95e9bda6 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/95e9bda6 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/95e9bda6 Branch: refs/heads/LOG4J2-1161 Commit: 95e9bda6c09cac3f7094f4be19f9005967da4d4e Parents: 0e40c92 Author: Matt SickerAuthored: Wed Oct 21 01:00:13 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 01:00:13 2015 -0500 -- .../logging/log4j/core/config/ReconfigurationDeadlockTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/95e9bda6/log4j-core/src/test/java/org/apache/logging/log4j/core/config/ReconfigurationDeadlockTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/ReconfigurationDeadlockTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/ReconfigurationDeadlockTest.java index 87c62d2..d1f962e 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/ReconfigurationDeadlockTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/ReconfigurationDeadlockTest.java @@ -77,7 +77,7 @@ public class ReconfigurationDeadlockTest { threads[i].interrupt(); } } -assertTrue("loggerThread didn't finish", stillWaiting == false); +assertFalse("loggerThread didn't finish", stillWaiting); }
[23/50] logging-log4j2 git commit: Use LoggerContextRule to simplify test.
Use LoggerContextRule to simplify test. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/96c38036 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/96c38036 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/96c38036 Branch: refs/heads/LOG4J2-1161 Commit: 96c38036801622e9af283349d6d7abc66b5b8277 Parents: 080ce0f Author: Matt SickerAuthored: Wed Oct 21 02:04:47 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 02:04:47 2015 -0500 -- .../log4j/core/appender/AsyncAppenderTest.java | 32 +++- 1 file changed, 11 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/96c38036/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/AsyncAppenderTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/AsyncAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/AsyncAppenderTest.java index 895e649..7a86e48 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/AsyncAppenderTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/AsyncAppenderTest.java @@ -17,17 +17,15 @@ package org.apache.logging.log4j.core.appender; import java.util.List; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LoggingException; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.config.Configuration; -import org.apache.logging.log4j.core.config.ConfigurationFactory; -import org.apache.logging.log4j.status.StatusLogger; +import org.apache.logging.log4j.junit.LoggerContextRule; import org.apache.logging.log4j.test.appender.ListAppender; import org.junit.After; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.Before; +import org.junit.ClassRule; import org.junit.Test; import static org.junit.Assert.*; @@ -37,23 +35,15 @@ import static org.junit.Assert.*; */ public class AsyncAppenderTest { private static final String CONFIG = "log4j-asynch.xml"; -private static Configuration config; -private static ListAppender listAppender; -private static LoggerContext ctx; -@BeforeClass -public static void setupClass() { -System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG); -ctx = LoggerContext.getContext(false); -config = ctx.getConfiguration(); -listAppender = (ListAppender) config.getAppender("List"); -} +@ClassRule +public static LoggerContextRule context = new LoggerContextRule(CONFIG); + +private ListAppender listAppender; -@AfterClass -public static void cleanupClass() { -System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY); -ctx.reconfigure(); -StatusLogger.getLogger().reset(); +@Before +public void before() throws Exception { +listAppender = context.getListAppender("List"); } @After
[39/50] logging-log4j2 git commit: added benchmark
added benchmark Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/59cc8e58 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/59cc8e58 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/59cc8e58 Branch: refs/heads/LOG4J2-1161 Commit: 59cc8e58fc91884fedb4795abe85eca0832b49f5 Parents: 3195cda Author: rpopmaAuthored: Fri Oct 23 00:33:17 2015 +0900 Committer: rpopma Committed: Fri Oct 23 00:33:17 2015 +0900 -- ...ThreadLocalVsConcurrentHashMapBenchmark.java | 94 1 file changed, 94 insertions(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/59cc8e58/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadLocalVsConcurrentHashMapBenchmark.java -- diff --git a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadLocalVsConcurrentHashMapBenchmark.java b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadLocalVsConcurrentHashMapBenchmark.java new file mode 100644 index 000..7ba0ca4 --- /dev/null +++ b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadLocalVsConcurrentHashMapBenchmark.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ + +package org.apache.logging.log4j.perf.jmh; + +import java.util.concurrent.ConcurrentHashMap; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; + +/** + * Compares performance of ThreadLocal, vs ConcurrentHashMapThread, Object. + */ +// == HOW TO RUN THIS TEST: +// (Quick build: mvn -DskipTests=true clean package -pl log4j-perf -am ) +// +// single thread: +// java -jar log4j-perf/target/benchmarks.jar ".*ThreadLocalVsConcurrentHashMap.*" -f 1 -wi 10 -i 20 -tu ns -bm sample +// +// four threads: +// java -jar log4j-perf/target/benchmarks.jar ".*ThreadLocalVsConcurrentHashMap.*" -f 1 -wi 10 -i 20 -tu ns -bm sample +// -t 4 +// +// Usage help: +// java -jar log4j-perf/target/benchmarks.jar -help +// +@State(Scope.Benchmark) +public class ThreadLocalVsConcurrentHashMapBenchmark { + +private static final String VALUE = "value"; +private static ConcurrentHashMap map = new ConcurrentHashMap (); +private static ThreadLocal threadLocal = new ThreadLocal<>(); + +@Benchmark +public String newInstance() { +StringBuilder sb = getNew(); +sb.append(VALUE); +return sb.toString(); +} + +@Benchmark +public String threadLocal() { +StringBuilder sb = getThreadLocal(); +sb.append(VALUE); +return sb.toString(); +} + +@Benchmark +public String concurrentHashMap() { +StringBuilder sb = getConcurrentMap(); +sb.append(VALUE); +return sb.toString(); +} + +private StringBuilder getNew() { +final StringBuilder buf = new StringBuilder(); +return buf; +} + +private StringBuilder getThreadLocal() { +StringBuilder buf = threadLocal.get(); +if (buf == null) { +buf = new StringBuilder(); +threadLocal.set(buf); +} +buf.setLength(0); +return buf; +} + +private StringBuilder getConcurrentMap() { +StringBuilder buf = map.get(Thread.currentThread()); +if (buf == null) { +buf = new StringBuilder(); +map.put(Thread.currentThread(), buf); +} +buf.setLength(0); +return buf; +} +} \ No newline at end of file
[08/50] logging-log4j2 git commit: Update Surfire and Failsafe from 2.18 to 2.19.
Update Surfire and Failsafe from 2.18 to 2.19. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d8dab5a0 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d8dab5a0 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d8dab5a0 Branch: refs/heads/LOG4J2-1161 Commit: d8dab5a07a656a650a265c633c918e01e037d704 Parents: ffd574d Author: ggregoryAuthored: Tue Oct 20 16:21:27 2015 -0700 Committer: ggregory Committed: Tue Oct 20 16:21:27 2015 -0700 -- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d8dab5a0/pom.xml -- diff --git a/pom.xml b/pom.xml index fe9c7fa..08c3bf7 100644 --- a/pom.xml +++ b/pom.xml @@ -184,8 +184,8 @@ 2.11 2.10.3 -2.18.1 -2.18.1 +2.19 +2.19 2.17 0.11 1.2
[38/50] logging-log4j2 git commit: LOG4J2-493 changes to JMX RingBuffer MBean because AsyncLoggerContext is no longer static
LOG4J2-493 changes to JMX RingBuffer MBean because AsyncLoggerContext is no longer static Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3195cdac Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3195cdac Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3195cdac Branch: refs/heads/LOG4J2-1161 Commit: 3195cdac52d7f964d5fc962b7753f4371e7fd0c7 Parents: dc62934 Author: rpopmaAuthored: Thu Oct 22 10:38:25 2015 +0900 Committer: rpopma Committed: Thu Oct 22 10:38:25 2015 +0900 -- .../src/main/java/org/apache/logging/log4j/core/jmx/Server.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3195cdac/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java index 4860551..b3f4614 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java @@ -174,7 +174,7 @@ public final class Server { register(mbs, mbean, mbean.getObjectName()); if (ctx instanceof AsyncLoggerContext) { -final RingBufferAdmin rbmbean = AsyncLogger.createRingBufferAdmin(ctx.getName()); +final RingBufferAdmin rbmbean = ((AsyncLoggerContext) ctx).createRingBufferAdmin(); register(mbs, rbmbean, rbmbean.getObjectName()); }
[50/50] logging-log4j2 git commit: Merge branch 'master' into LOG4J2-1161
Merge branch 'master' into LOG4J2-1161 Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d3a06415 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d3a06415 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d3a06415 Branch: refs/heads/LOG4J2-1161 Commit: d3a06415095ae3784c3f2034843bdfc874a790f1 Parents: 990a97c 9c3af71 Author: Mikael StåldalAuthored: Fri Oct 23 14:57:19 2015 +0200 Committer: Mikael Ståldal Committed: Fri Oct 23 14:57:19 2015 +0200 -- .../log4j/message/LocalizedMessageFactory.java | 5 +- .../logging/log4j/util/StringBuilders.java | 2 +- .../org/apache/logging/log4j/core/Logger.java | 50 +++- .../logging/log4j/core/LoggerContext.java | 11 +- .../log4j/core/appender/AbstractManager.java| 21 ++ .../log4j/core/appender/FileManager.java| 2 +- .../core/appender/MemoryMappedFileManager.java | 16 +- .../core/appender/OutputStreamManager.java | 8 +- .../core/appender/RandomAccessFileManager.java | 5 +- .../RollingRandomAccessFileAppender.java| 2 +- .../appender/db/AbstractDatabaseManager.java| 6 +- .../appender/db/jdbc/JdbcDatabaseManager.java | 4 +- .../appender/db/jpa/JpaDatabaseManager.java | 2 +- .../appender/rolling/RollingFileManager.java| 12 +- .../rolling/RollingRandomAccessFileManager.java | 8 +- .../core/appender/routing/RoutingAppender.java | 2 +- .../logging/log4j/core/async/AsyncLogger.java | 231 +-- .../log4j/core/async/AsyncLoggerConfig.java | 25 +- .../core/async/AsyncLoggerConfigDelegate.java | 52 + .../core/async/AsyncLoggerConfigHelper.java | 43 ++-- .../log4j/core/async/AsyncLoggerContext.java| 54 - .../core/async/AsyncLoggerContextSelector.java | 48 ++-- .../log4j/core/async/AsyncLoggerHelper.java | 210 + .../apache/logging/log4j/core/async/Info.java | 109 + .../core/config/AbstractConfiguration.java | 20 +- .../log4j/core/config/ConfigurationFactory.java | 3 +- .../logging/log4j/core/config/LoggerConfig.java | 3 +- .../core/config/builder/api/package-info.java | 2 +- .../plugins/convert/TypeConverterRegistry.java | 2 +- .../core/config/plugins/util/PluginBuilder.java | 45 ++-- .../plugins/validation/ConstraintValidator.java | 5 +- .../validators/RequiredValidator.java | 18 +- .../plugins/visitors/PluginElementVisitor.java | 2 +- .../config/plugins/visitors/PluginVisitors.java | 1 - .../logging/log4j/core/impl/Log4jLogEvent.java | 2 + .../apache/logging/log4j/core/jmx/Server.java | 12 +- .../log4j/core/layout/PatternLayout.java| 2 +- .../log4j/core/layout/Rfc5424Layout.java| 2 +- .../logging/log4j/core/net/SmtpManager.java | 8 +- .../ExtendedThrowablePatternConverter.java | 2 +- .../pattern/RootThrowablePatternConverter.java | 2 +- .../selector/ClassLoaderContextSelector.java| 46 ++-- .../logging/log4j/core/util/ClockFactory.java | 10 +- .../logging/log4j/core/util/FileWatcher.java| 2 +- log4j-core/src/site/xdoc/index.xml | 2 +- .../apache/logging/log4j/core/HostNameTest.java | 2 +- .../apache/logging/log4j/core/LogEventTest.java | 3 + .../logging/log4j/core/LoggerDateTest.java | 2 +- .../log4j/core/LoggerSerializationTest.java | 2 - .../apache/logging/log4j/core/LookupTest.java | 2 +- .../log4j/core/appender/AsyncAppenderTest.java | 32 +-- .../appender/JsonCompleteFileAppenderTest.java | 5 +- .../MemoryMappedFileAppenderLocationTest.java | 9 +- .../MemoryMappedFileAppenderRemapTest.java | 9 +- .../MemoryMappedFileAppenderSimpleTest.java | 9 +- .../appender/RandomAccessFileAppenderTests.java | 5 +- .../appender/RandomAccessFileManagerTest.java | 20 +- .../appender/XmlCompactFileAppenderTest.java| 4 +- .../appender/XmlCompleteFileAppenderTest.java | 4 +- .../core/appender/XmlFileAppenderTest.java | 4 +- .../XmlRandomAccessFileAppenderTest.java| 4 +- .../db/jdbc/AbstractJdbcAppenderTest.java | 5 +- .../routing/JsonRoutingAppender2Test.java | 40 +--- .../routing/JsonRoutingAppenderTest.java| 40 +--- .../routing/RoutingAppenderWithJndiTest.java| 4 +- .../routing/RoutingDefaultAppenderTest.java | 2 +- ...ncLoggerContextSelectorInitialStateTest.java | 30 +++ .../async/AsyncLoggerContextSelectorTest.java | 14 +- .../AsyncLoggerThreadNameStrategyTest.java | 24 +- .../AsyncLoggersWithAsyncAppenderTest.java | 37 +-- .../AsyncLoggersWithAsyncLoggerConfigTest.java | 37 +-- .../core/async/perftest/IPerfTestRunner.java| 6 +- .../log4j/core/async/perftest/PerfTest.java | 5 +-
[35/50] logging-log4j2 git commit: LOG4J2-493 allow for multiple, distinct AsyncLoggerHelper instances
LOG4J2-493 allow for multiple, distinct AsyncLoggerHelper instances - Disruptor and Executor are now non-static fields in AsyncLoggerHelper - converted all static methods to non-static methods Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/586920b4 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/586920b4 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/586920b4 Branch: refs/heads/LOG4J2-1161 Commit: 586920b47cc4f656ab9fa5f7584e1d72cc9bdf1a Parents: 7e6c1b2 Author: rpopmaAuthored: Thu Oct 22 10:35:43 2015 +0900 Committer: rpopma Committed: Thu Oct 22 10:35:43 2015 +0900 -- .../log4j/core/async/AsyncLoggerHelper.java | 30 ++-- 1 file changed, 15 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/586920b4/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java index 43dacc1..33a34e1 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java @@ -39,8 +39,8 @@ import com.lmax.disruptor.dsl.ProducerType; * Helper class for AsyncLogger: * * Separates the AsyncLogger business logic (logging) from the mechanics of working with the LMAX Disruptor. - * Disruptor initialization no longer happens in a static initializer block in AsyncLogger to prevent problems where - * the Disruptor is unintentionally initialized (and a thread started) because a static method in AsyncLogger is called + * Disruptor initialization no longer happens in a initializer block in AsyncLogger to prevent problems where + * the Disruptor is unintentionally initialized (and a thread started) because a method in AsyncLogger is called * (LOG4J2-1159). * Enable a reference counting scheme tracking the total number of starts and stops, so the Disruptor and associated * Executor can be shut down when usage becomes zero. This fixes a long-standing issue that made AsyncLoggers unsuitable @@ -54,11 +54,11 @@ public class AsyncLoggerHelper { private static final int RINGBUFFER_DEFAULT_SIZE = 256 * 1024; private static final StatusLogger LOGGER = StatusLogger.getLogger(); -private static ExecutorService executor; -private static volatile Disruptor disruptor; -private static volatile int count = 0; +private ExecutorService executor; +private volatile Disruptor disruptor; +private volatile int count = 0; -static Disruptor getDisruptor() { +Disruptor getDisruptor() { return disruptor; } @@ -68,12 +68,12 @@ public class AsyncLoggerHelper { * * @see #release() */ -static synchronized void start() { +synchronized void start() { count++; initDisruptor(); } -private static synchronized void initDisruptor() { +private synchronized void initDisruptor() { if (disruptor != null) { LOGGER.trace("AsyncLoggerHelper not starting new disruptor, using existing object. Ref count is {}.", count); return; @@ -96,7 +96,7 @@ public class AsyncLoggerHelper { disruptor.start(); } -private static int calculateRingBufferSize() { +private int calculateRingBufferSize() { int ringBufferSize = RINGBUFFER_DEFAULT_SIZE; final String userPreferredRBSize = PropertiesUtil.getProperties().getStringProperty( "AsyncLogger.RingBufferSize", String.valueOf(ringBufferSize)); @@ -114,7 +114,7 @@ public class AsyncLoggerHelper { return Integers.ceilingNextPowerOfTwo(ringBufferSize); } -private static WaitStrategy createWaitStrategy() { +private WaitStrategy createWaitStrategy() { final String strategy = PropertiesUtil.getProperties().getStringProperty("AsyncLogger.WaitStrategy"); LOGGER.debug("property AsyncLogger.WaitStrategy={}", strategy); if ("Sleep".equals(strategy)) { @@ -128,7 +128,7 @@ public class AsyncLoggerHelper { return new BlockingWaitStrategy(); } -private static ExceptionHandler getExceptionHandler() { +private ExceptionHandler getExceptionHandler() { final String cls = PropertiesUtil.getProperties().getStringProperty("AsyncLogger.ExceptionHandler"); if (cls == null) { LOGGER.debug("No AsyncLogger.ExceptionHandler specified"); @@ -146,7 +146,7 @@ public class
[27/50] logging-log4j2 git commit: Simplify tests with LoggerContextRule.
Simplify tests with LoggerContextRule. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/22a8b3d3 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/22a8b3d3 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/22a8b3d3 Branch: refs/heads/LOG4J2-1161 Commit: 22a8b3d35a021b7eb7148dce9e6d6ee4ff7e459a Parents: 639bef4 Author: Matt SickerAuthored: Wed Oct 21 02:25:05 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 02:31:51 2015 -0500 -- .../routing/JsonRoutingAppender2Test.java | 40 ++-- .../routing/JsonRoutingAppenderTest.java| 40 ++-- .../AsyncLoggersWithAsyncAppenderTest.java | 37 -- .../AsyncLoggersWithAsyncLoggerConfigTest.java | 37 -- 4 files changed, 36 insertions(+), 118 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/22a8b3d3/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/JsonRoutingAppender2Test.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/JsonRoutingAppender2Test.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/JsonRoutingAppender2Test.java index af7c078..21d37f5 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/JsonRoutingAppender2Test.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/JsonRoutingAppender2Test.java @@ -18,17 +18,15 @@ package org.apache.logging.log4j.core.appender.routing; import java.io.File; import java.util.List; + import org.apache.logging.log4j.EventLogger; import org.apache.logging.log4j.core.LogEvent; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.config.Configuration; -import org.apache.logging.log4j.core.config.ConfigurationFactory; +import org.apache.logging.log4j.junit.CleanFiles; +import org.apache.logging.log4j.junit.LoggerContextRule; import org.apache.logging.log4j.message.StructuredDataMessage; -import org.apache.logging.log4j.status.StatusLogger; -import org.apache.logging.log4j.test.appender.ListAppender; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.ClassRule; import org.junit.Test; +import org.junit.rules.RuleChain; import static org.junit.Assert.*; @@ -37,39 +35,23 @@ import static org.junit.Assert.*; */ public class JsonRoutingAppender2Test { private static final String CONFIG = "log4j-routing2.json"; -private static Configuration config; -private static ListAppender listAppender; -private static LoggerContext ctx; +private static final String LOG_FILENAME = "target/rolling1/rollingtest-Unknown.log"; -@BeforeClass -public static void setupClass() { -System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG); -ctx = LoggerContext.getContext(false); -config = ctx.getConfiguration(); -listAppender = config.getAppender("List"); -final File file = new File("target/rolling1/rollingtest-Unknown.log"); -file.delete(); -} +private static LoggerContextRule context = new LoggerContextRule(CONFIG); -@AfterClass -public static void cleanupClass() { -System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY); -ctx.reconfigure(); -StatusLogger.getLogger().reset(); -final File file = new File("target/rolling1/rollingtest-Unknown.log"); -file.delete(); -} +@ClassRule +public static RuleChain rules = RuleChain.outerRule(new CleanFiles(LOG_FILENAME)).around(context); @Test public void routingTest() { StructuredDataMessage msg = new StructuredDataMessage("Test", "This is a test", "Service"); EventLogger.logEvent(msg); -final List list = listAppender.getEvents(); +final List list = context.getListAppender("List").getEvents(); assertNotNull("No events generated", list); assertTrue("Incorrect number of events. Expected 1, got " + list.size(), list.size() == 1); msg = new StructuredDataMessage("Test", "This is a test", "Unknown"); EventLogger.logEvent(msg); -final File file = new File("target/rolling1/rollingtest-Unknown.log"); +final File file = new File(LOG_FILENAME); assertTrue("File was not created", file.exists()); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/22a8b3d3/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/routing/JsonRoutingAppenderTest.java
[32/50] logging-log4j2 git commit: Fix test to match code change.
Fix test to match code change. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3da6c31d Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3da6c31d Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3da6c31d Branch: refs/heads/LOG4J2-1161 Commit: 3da6c31dbe096a1967f32b12c4ef3e93704da963 Parents: 0eb6ddf Author: ggregoryAuthored: Wed Oct 21 13:11:49 2015 -0700 Committer: ggregory Committed: Wed Oct 21 13:11:49 2015 -0700 -- .../logging/log4j/core/async/AsyncLoggerContextSelectorTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3da6c31d/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java index dc60aab..3bae290 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java @@ -54,7 +54,7 @@ public class AsyncLoggerContextSelectorTest { public void testContextNameIsAsyncLoggerContextWithClassHashCode() { final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); final LoggerContext context = selector.getContext(null, null, false); -final String expectedContextName = "AsyncLoggerContext@" + AsyncLoggerContext.class.hashCode(); +final String expectedContextName = "AsyncLoggerContext@" + Integer.toHexString(AsyncLoggerContext.class.hashCode()); assertEquals(expectedContextName, context.getName()); }
[14/50] logging-log4j2 git commit: Simplify MapFilterTest using LoggerContextRule.
Simplify MapFilterTest using LoggerContextRule. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/0e40c927 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/0e40c927 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/0e40c927 Branch: refs/heads/LOG4J2-1161 Commit: 0e40c927dbd477d990529f2a06148e9ebeb20570 Parents: caa7cc7 Author: Matt SickerAuthored: Wed Oct 21 00:50:22 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 00:50:22 2015 -0500 -- .../log4j/core/filter/MapFilterTest.java| 23 ++-- 1 file changed, 7 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0e40c927/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/MapFilterTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/MapFilterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/MapFilterTest.java index 56ddbc0..61006cb 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/MapFilterTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/MapFilterTest.java @@ -23,16 +23,13 @@ import java.util.Map; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.Filter; -import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.Configuration; -import org.apache.logging.log4j.core.config.Configurator; import org.apache.logging.log4j.core.util.KeyValuePair; +import org.apache.logging.log4j.junit.LoggerContextRule; import org.apache.logging.log4j.message.MapMessage; -import org.apache.logging.log4j.status.StatusLogger; import org.apache.logging.log4j.test.appender.ListAppender; -import org.junit.After; +import org.junit.ClassRule; import org.junit.Test; import static org.junit.Assert.*; @@ -42,12 +39,8 @@ import static org.junit.Assert.*; */ public class MapFilterTest { -@After -public void cleanup() { -final LoggerContext ctx = LoggerContext.getContext(false); -ctx.reconfigure(); -StatusLogger.getLogger().reset(); -} +@ClassRule +public static LoggerContextRule context = new LoggerContextRule("log4j2-mapfilter.xml"); @Test public void testFilter() { @@ -77,8 +70,7 @@ public class MapFilterTest { @Test public void testConfig() { -final LoggerContext ctx = Configurator.initialize("Test1", "target/test-classes/log4j2-mapfilter.xml"); -final Configuration config = ctx.getConfiguration(); +final Configuration config = context.getConfiguration(); final Filter filter = config.getFilter(); assertNotNull("No MapFilter", filter); assertTrue("Not a MapFilter", filter instanceof MapFilter); @@ -94,9 +86,8 @@ public class MapFilterTest { final Map eventMap = new HashMap<>(); eventMap.put("eventId", "Login"); logger.debug(new MapMessage(eventMap)); -final Appender app = config.getAppender("LIST"); -assertNotNull("No List appender", app); -final List msgs = ((ListAppender) app).getMessages(); +final ListAppender app = context.getListAppender("LIST"); +final List msgs = app.getMessages(); assertNotNull("No messages", msgs); assertFalse("No messages", msgs.isEmpty());
[33/50] logging-log4j2 git commit: fixed typo in debug status message
fixed typo in debug status message Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2a853aa8 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2a853aa8 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2a853aa8 Branch: refs/heads/LOG4J2-1161 Commit: 2a853aa87af2fa73679fbb47954e3559c77ddae3 Parents: 3da6c31 Author: rpopmaAuthored: Thu Oct 22 09:14:49 2015 +0900 Committer: rpopma Committed: Thu Oct 22 09:14:49 2015 +0900 -- .../org/apache/logging/log4j/web/Log4jWebInitializerImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2a853aa8/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jWebInitializerImpl.java -- diff --git a/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jWebInitializerImpl.java b/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jWebInitializerImpl.java index 02f17fe..b54bf0f 100644 --- a/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jWebInitializerImpl.java +++ b/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jWebInitializerImpl.java @@ -163,7 +163,7 @@ final class Log4jWebInitializerImpl extends AbstractLifeCycle implements Log4jWe String configLocation = location; if (configLocation == null) { final String[] paths = SetUtils.prefixSet(servletContext.getResourcePaths(WEB_INF), WEB_INF + "log4j2"); -LOGGER.debug("getConfigURI found resource paths {} in servletConext at [{}]", Arrays.toString(paths), WEB_INF); +LOGGER.debug("getConfigURI found resource paths {} in servletContext at [{}]", Arrays.toString(paths), WEB_INF); if (paths.length == 1) { configLocation = paths[0]; } else if (paths.length > 1) { @@ -185,7 +185,7 @@ final class Log4jWebInitializerImpl extends AbstractLifeCycle implements Log4jWe final URL url = servletContext.getResource(configLocation); if (url != null) { final URI uri = url.toURI(); -LOGGER.debug("getConfigURI found resource [{}] in servletConext at [{}]", uri, configLocation); +LOGGER.debug("getConfigURI found resource [{}] in servletContext at [{}]", uri, configLocation); return uri; } } @@ -195,7 +195,7 @@ final class Log4jWebInitializerImpl extends AbstractLifeCycle implements Log4jWe if (location != null) { try { final URI correctedFilePathUri = NetUtils.toURI(location); -LOGGER.debug("getConfigURI found [{}] in servletConext at [{}]", correctedFilePathUri, location); +LOGGER.debug("getConfigURI found [{}] in servletContext at [{}]", correctedFilePathUri, location); return correctedFilePathUri; } catch (final Exception e) { LOGGER.error("Unable to convert configuration location [{}] to a URI", location, e);
[48/50] logging-log4j2 git commit: made field final; javadoc
made field final; javadoc Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/86e0a0ab Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/86e0a0ab Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/86e0a0ab Branch: refs/heads/LOG4J2-1161 Commit: 86e0a0abf109817cd25c3029a006702cf2d54237 Parents: 7ffd4cf Author: rpopmaAuthored: Fri Oct 23 03:11:17 2015 +0900 Committer: rpopma Committed: Fri Oct 23 03:11:17 2015 +0900 -- .../java/org/apache/logging/log4j/core/async/AsyncLogger.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/86e0a0ab/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java index 486bf69..058a642 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java @@ -64,7 +64,7 @@ public class AsyncLogger extends Logger { private static final Clock CLOCK = ClockFactory.getClock(); private static volatile NanoClock nanoClock = new DummyNanoClock(); -private AsyncLoggerHelper helper; +private final AsyncLoggerHelper helper; /** * Constructs an {@code AsyncLogger} with the specified context, name and message factory. @@ -72,10 +72,10 @@ public class AsyncLogger extends Logger { * @param context context of this logger * @param name name of this logger * @param messageFactory message factory of this logger - * @param helper + * @param helper helper class that logging can be delegated to. This object owns the Disruptor. */ public AsyncLogger(final LoggerContext context, final String name, final MessageFactory messageFactory, -AsyncLoggerHelper helper) { +final AsyncLoggerHelper helper) { super(context, name, messageFactory); this.helper = helper; }
[04/50] logging-log4j2 git commit: Don't run this test on Windows.
Don't run this test on Windows. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/f291ec71 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/f291ec71 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/f291ec71 Branch: refs/heads/LOG4J2-1161 Commit: f291ec711e3acbc09d6026ba7dde682c77e74ba7 Parents: 98bbbf5 Author: ggregoryAuthored: Tue Oct 20 15:33:29 2015 -0700 Committer: ggregory Committed: Tue Oct 20 15:33:29 2015 -0700 -- .../org/apache/logging/log4j/core/util/WatchManagerTest.java| 5 - 1 file changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f291ec71/log4j-core/src/test/java/org/apache/logging/log4j/core/util/WatchManagerTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/WatchManagerTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/WatchManagerTest.java index 2b07ae2..b44f894 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/WatchManagerTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/WatchManagerTest.java @@ -16,6 +16,7 @@ */ package org.apache.logging.log4j.core.util; +import org.junit.Assume; import org.junit.Ignore; import org.junit.Test; @@ -43,9 +44,11 @@ public class WatchManagerTest { private String originalFile = "target/test-classes/log4j-test1.xml"; private String newFile = "target/test-classes/log4j-test1.yaml"; -@Ignore +private static final boolean IS_WINDOWS = System.getProperty("os.name").startsWith("Windows"); + @Test public void testWatchManager() throws Exception { +Assume.assumeFalse(IS_WINDOWS); ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1); WatchManager watchManager = new WatchManager(); watchManager.setIntervalSeconds(1);
[26/50] logging-log4j2 git commit: Add ContextSelector customization to LoggerContextRule.
Add ContextSelector customization to LoggerContextRule. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/639bef46 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/639bef46 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/639bef46 Branch: refs/heads/LOG4J2-1161 Commit: 639bef46696b2b16d5cdb01844b8ce1b711ef485 Parents: ed65b40 Author: Matt SickerAuthored: Wed Oct 21 02:24:51 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 02:24:51 2015 -0500 -- .../logging/log4j/junit/LoggerContextRule.java | 40 ++-- 1 file changed, 36 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/639bef46/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 006d70c..1915a2f 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 @@ -22,6 +22,8 @@ import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.Configurator; +import org.apache.logging.log4j.core.selector.ContextSelector; +import org.apache.logging.log4j.core.util.Constants; import org.apache.logging.log4j.status.StatusLogger; import org.apache.logging.log4j.test.appender.ListAppender; import org.junit.rules.TestRule; @@ -39,13 +41,31 @@ import static org.junit.Assert.*; public class LoggerContextRule implements TestRule { private final String configLocation; +private final Class contextSelectorClass; private LoggerContext context; private String testClassName; +/** + * Constructs a new LoggerContextRule for a given configuration file. + * + * @param configLocation path to configuration file + */ public LoggerContextRule(final String configLocation) { +this(configLocation, null); +} + +/** + * Constructs a new LoggerContextRule for a given configuration file and a custom {@link ContextSelector} class. + * + * @param configLocation path to configuration file + * @param contextSelectorClass custom ContextSelector class to use instead of default + * @since 2.5 + */ +public LoggerContextRule(final String configLocation, final Class contextSelectorClass) { this.configLocation = configLocation; +this.contextSelectorClass = contextSelectorClass; } @Override @@ -58,6 +78,9 @@ public class LoggerContextRule implements TestRule { return new Statement() { @Override public void evaluate() throws Throwable { +if (contextSelectorClass != null) { +System.setProperty(Constants.LOG4J_CONTEXT_SELECTOR, contextSelectorClass.getName()); +} context = Configurator.initialize( description.getDisplayName(), description.getTestClass().getClassLoader(), @@ -68,6 +91,7 @@ public class LoggerContextRule implements TestRule { } finally { Configurator.shutdown(context); StatusLogger.getLogger().reset(); +System.clearProperty(Constants.LOG4J_CONTEXT_SELECTOR); } } }; @@ -75,6 +99,7 @@ public class LoggerContextRule implements TestRule { /** * Gets the current LoggerContext associated with this rule. + * * @return the current LoggerContext. */ public LoggerContext getContext() { @@ -83,6 +108,7 @@ public class LoggerContextRule implements TestRule { /** * Gets a named Logger using the test class's name from this LoggerContext. + * * @return the test class's named Logger. */ public Logger getLogger() { @@ -101,6 +127,7 @@ public class LoggerContextRule implements TestRule { /** * Gets the associated Configuration for the configuration file this was constructed with. + * * @return this LoggerContext's Configuration. */ public Configuration getConfiguration() { @@ -109,6 +136,7 @@ public class LoggerContextRule implements TestRule { /** * Gets a named Appender for this LoggerContext. + * * @param name the name of the Appender to look up. * @return the named Appender or {@code null} if it
[42/50] logging-log4j2 git commit: LOG4J2-493 factored out context creation to separate method to facilitate subclassing, formatted code.
LOG4J2-493 factored out context creation to separate method to facilitate subclassing, formatted code. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7800b8f0 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7800b8f0 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7800b8f0 Branch: refs/heads/LOG4J2-1161 Commit: 7800b8f0416c6d9370de3eb7ab5da6e1ffdce36e Parents: 25fe68d Author: rpopmaAuthored: Fri Oct 23 02:18:50 2015 +0900 Committer: rpopma Committed: Fri Oct 23 02:18:50 2015 +0900 -- .../selector/ClassLoaderContextSelector.java| 44 +++- 1 file changed, 25 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7800b8f0/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java index f7fa5d4..6aa87b0 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java @@ -33,11 +33,11 @@ import org.apache.logging.log4j.status.StatusLogger; import org.apache.logging.log4j.util.ReflectionUtil; /** - * This ContextSelector chooses a LoggerContext based upon the ClassLoader of the caller. This allows Loggers - * assigned to static variables to be released along with the classes that own then. Other ContextSelectors - * will generally cause Loggers associated with classes loaded from different ClassLoaders to be co-mingled. - * This is a problem if, for example, a web application is undeployed as some of the Loggers being released may be - * associated with a Class in a parent ClassLoader, which will generally have negative consequences. + * This ContextSelector chooses a LoggerContext based upon the ClassLoader of the caller. This allows Loggers assigned + * to static variables to be released along with the classes that own then. Other ContextSelectors will generally cause + * Loggers associated with classes loaded from different ClassLoaders to be co-mingled. This is a problem if, for + * example, a web application is undeployed as some of the Loggers being released may be associated with a Class in a + * parent ClassLoader, which will generally have negative consequences. * * The main downside to this ContextSelector is that Configuration is more challenging. * @@ -45,12 +45,12 @@ import org.apache.logging.log4j.util.ReflectionUtil; */ public class ClassLoaderContextSelector implements ContextSelector { -private static final AtomicReference CONTEXT = new AtomicReference<>(); +private static final AtomicReference DEFAULT_CONTEXT = new AtomicReference<>(); protected static final StatusLogger LOGGER = StatusLogger.getLogger(); protected static final ConcurrentMap > CONTEXT_MAP = -new ConcurrentHashMap<>(); +new ConcurrentHashMap<>(); @Override public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext) { @@ -59,7 +59,7 @@ public class ClassLoaderContextSelector implements ContextSelector { @Override public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext, -final URI configLocation) { +final URI configLocation) { if (currentContext) { final LoggerContext ctx = ContextAnchor.THREAD_CONTEXT.get(); if (ctx != null) { @@ -142,9 +142,8 @@ public class ClassLoaderContextSelector implements ContextSelector { } */ } } -LoggerContext ctx = new LoggerContext(name, null, configLocation); -final AtomicReference r = -new AtomicReference<>(); +LoggerContext ctx = createContext(name, configLocation); +final AtomicReference r = new AtomicReference<>(); r.set(new WeakReference<>(ctx)); CONTEXT_MAP.putIfAbsent(name, r); ctx = CONTEXT_MAP.get(name).get().get(); @@ -156,29 +155,36 @@ public class ClassLoaderContextSelector implements ContextSelector { if (ctx.getConfigLocation() == null && configLocation != null) { LOGGER.debug("Setting configuration to {}", configLocation);
[41/50] logging-log4j2 git commit: LOG4J2-493 removed obsolete counter, improved status logging
LOG4J2-493 removed obsolete counter, improved status logging Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/25fe68d2 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/25fe68d2 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/25fe68d2 Branch: refs/heads/LOG4J2-1161 Commit: 25fe68d2de481d66b4dd26ac67ecdb6f2f72e4d7 Parents: 6e45177 Author: rpopmaAuthored: Fri Oct 23 02:15:08 2015 +0900 Committer: rpopma Committed: Fri Oct 23 02:15:08 2015 +0900 -- .../log4j/core/async/AsyncLoggerHelper.java | 78 +--- 1 file changed, 35 insertions(+), 43 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/25fe68d2/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java index 33a34e1..027fa0d 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java @@ -36,16 +36,10 @@ import com.lmax.disruptor.dsl.Disruptor; import com.lmax.disruptor.dsl.ProducerType; /** - * Helper class for AsyncLogger: - * - * Separates the AsyncLogger business logic (logging) from the mechanics of working with the LMAX Disruptor. - * Disruptor initialization no longer happens in a initializer block in AsyncLogger to prevent problems where - * the Disruptor is unintentionally initialized (and a thread started) because a method in AsyncLogger is called - * (LOG4J2-1159). - * Enable a reference counting scheme tracking the total number of starts and stops, so the Disruptor and associated - * Executor can be shut down when usage becomes zero. This fixes a long-standing issue that made AsyncLoggers unsuitable - * for use in web applications (LOG4J2-493). - * + * Helper class for async loggers: AsyncLoggerHelper handles the mechanics of working with the LMAX Disruptor, and + * works with its associated AsyncLoggerContext to synchronize the life cycle of the Disruptor and its thread with the + * life cycle of the context. The AsyncLoggerHelper of the context is shared by all AsyncLogger objects created by that + * AsyncLoggerContext. */ public class AsyncLoggerHelper { private static final int SLEEP_MILLIS_BETWEEN_DRAIN_ATTEMPTS = 50; @@ -54,34 +48,36 @@ public class AsyncLoggerHelper { private static final int RINGBUFFER_DEFAULT_SIZE = 256 * 1024; private static final StatusLogger LOGGER = StatusLogger.getLogger(); +private final String contextName; private ExecutorService executor; private volatile Disruptor disruptor; -private volatile int count = 0; + +public AsyncLoggerHelper(String contextName) { +this.contextName = contextName; +} + +public String getContextName() { +return contextName; +} Disruptor getDisruptor() { return disruptor; } /** - * Increases the reference count and creates and starts a new Disruptor and associated thread if none currently - * exists. + * Creates and starts a new Disruptor and associated thread if none currently exists. * - * @see #release() + * @see #stop() */ synchronized void start() { -count++; -initDisruptor(); -} - -private synchronized void initDisruptor() { if (disruptor != null) { -LOGGER.trace("AsyncLoggerHelper not starting new disruptor, using existing object. Ref count is {}.", count); +LOGGER.trace("[{}] AsyncLoggerHelper not starting new disruptor, using existing object.", contextName); return; } -LOGGER.trace("AsyncLoggerHelper creating new disruptor. Ref count is {}.", count); +LOGGER.trace("[{}] AsyncLoggerHelper creating new disruptor.", contextName); final int ringBufferSize = calculateRingBufferSize(); final WaitStrategy waitStrategy = createWaitStrategy(); -executor = Executors.newSingleThreadExecutor(new DaemonThreadFactory("AsyncLogger-")); +executor = Executors.newSingleThreadExecutor(new DaemonThreadFactory(contextName + "-Logger-")); Info.initExecutorThreadInstance(executor); disruptor = new Disruptor<>(RingBufferLogEvent.FACTORY, ringBufferSize, executor, ProducerType.MULTI, @@ -91,8 +87,8 @@ public class AsyncLoggerHelper { final RingBufferLogEventHandler[] handlers = {new RingBufferLogEventHandler()};
[21/50] logging-log4j2 git commit: Use CoreLoggerContexts.stopLoggerContext in tests.
Use CoreLoggerContexts.stopLoggerContext in tests. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/844187e8 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/844187e8 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/844187e8 Branch: refs/heads/LOG4J2-1161 Commit: 844187e838b510ff11522c19e86d413f996d47ad Parents: aad6734 Author: Matt SickerAuthored: Wed Oct 21 01:35:07 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 01:35:07 2015 -0500 -- .../core/appender/MemoryMappedFileAppenderLocationTest.java | 4 ++-- .../log4j/core/appender/MemoryMappedFileAppenderRemapTest.java | 4 ++-- .../log4j/core/appender/MemoryMappedFileAppenderSimpleTest.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/844187e8/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderLocationTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderLocationTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderLocationTest.java index 54c2cee..f767c5e 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderLocationTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderLocationTest.java @@ -22,7 +22,7 @@ import java.io.FileReader; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.core.CoreLoggerContexts; import org.apache.logging.log4j.core.config.ConfigurationFactory; import org.apache.logging.log4j.core.util.Integers; import org.junit.Before; @@ -69,7 +69,7 @@ public class MemoryMappedFileAppenderLocationTest { log.warn("Test log2"); assertEquals("not grown", expectedFileLength, f.length()); } finally { -(LoggerContext.getContext(false)).stop(); +CoreLoggerContexts.stopLoggerContext(false); } final int LINESEP = System.getProperty("line.separator").length(); assertEquals("Shrunk to actual used size", 474 + 2 * LINESEP, f.length()); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/844187e8/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java index 87e4d35..54f5103 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderRemapTest.java @@ -23,7 +23,7 @@ import java.util.Arrays; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.core.CoreLoggerContexts; import org.apache.logging.log4j.core.config.ConfigurationFactory; import org.junit.Before; import org.junit.Test; @@ -69,7 +69,7 @@ public class MemoryMappedFileAppenderRemapTest { log.warn(new String(text)); assertEquals("grown again", 256 * 3, f.length()); } finally { -(LoggerContext.getContext(false)).stop(); +CoreLoggerContexts.stopLoggerContext(false); } final int LINESEP = System.getProperty("line.separator").length(); assertEquals("Shrunk to actual used size", 658 + 3 * LINESEP, f.length()); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/844187e8/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderSimpleTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderSimpleTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderSimpleTest.java index ccdd9d2..9d310c9 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderSimpleTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderSimpleTest.java @@ -22,7 +22,7 @@ import java.io.FileReader; import
[05/50] logging-log4j2 git commit: Remove unused imports.
Remove unused imports. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/c1748d04 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c1748d04 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c1748d04 Branch: refs/heads/LOG4J2-1161 Commit: c1748d04b342186637bfd406acdf8c5a50476d2b Parents: f291ec7 Author: ggregoryAuthored: Tue Oct 20 15:33:55 2015 -0700 Committer: ggregory Committed: Tue Oct 20 15:33:55 2015 -0700 -- .../org/apache/logging/log4j/core/util/WatchManagerTest.java | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c1748d04/log4j-core/src/test/java/org/apache/logging/log4j/core/util/WatchManagerTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/WatchManagerTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/WatchManagerTest.java index b44f894..857879b 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/WatchManagerTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/WatchManagerTest.java @@ -16,9 +16,7 @@ */ package org.apache.logging.log4j.core.util; -import org.junit.Assume; -import org.junit.Ignore; -import org.junit.Test; +import static org.junit.Assert.assertNotNull; import java.io.File; import java.io.FileOutputStream; @@ -33,7 +31,8 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import static org.junit.Assert.*; +import org.junit.Assume; +import org.junit.Test; /** * Test the WatchManager
[18/50] logging-log4j2 git commit: Use LoggerContextRule as desired by LOG4J2-498
Use LoggerContextRule as desired by LOG4J2-498 Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/5b5773e3 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/5b5773e3 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/5b5773e3 Branch: refs/heads/LOG4J2-1161 Commit: 5b5773e37e2e52921f77d9bee5e30db3cf2f79a9 Parents: 13b480a Author: Matt SickerAuthored: Wed Oct 21 01:11:08 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 01:11:08 2015 -0500 -- .../PropertiesConfigurationRootLoggerOnlyTest.java | 14 +++--- .../properties/PropertiesConfigurationTest.java | 14 +++--- .../config/properties/RollingFilePropertiesTest.java | 15 --- .../log4j/core/filter/StructuredDataFilterTest.java | 15 --- 4 files changed, 30 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5b5773e3/log4j-core/src/test/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationRootLoggerOnlyTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationRootLoggerOnlyTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationRootLoggerOnlyTest.java index 88b0709..5a8be67 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationRootLoggerOnlyTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationRootLoggerOnlyTest.java @@ -21,28 +21,28 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.Filter; import org.apache.logging.log4j.core.LifeCycle; -import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.Configuration; -import org.apache.logging.log4j.core.config.ConfigurationFactory; import org.apache.logging.log4j.core.config.LoggerConfig; import org.apache.logging.log4j.core.filter.ThresholdFilter; +import org.apache.logging.log4j.junit.LoggerContextRule; +import org.junit.ClassRule; import org.junit.Test; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; /** * */ public class PropertiesConfigurationRootLoggerOnlyTest { +@ClassRule +public static LoggerContextRule context = new LoggerContextRule("log4j2-properties-root-only.properties"); + @Test public void testPropertiesConfiguration() { -System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, "target/test-classes/log4j2-properties-root-only.properties"); -Configuration config = ((LoggerContext)LogManager.getContext(false)).getConfiguration(); +Configuration config = context.getConfiguration(); assertNotNull("No configuration created", config); assertEquals("Incorrect State: " + config.getState(), config.getState(), LifeCycle.State.STARTED); Map appenders = config.getAppenders(); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5b5773e3/log4j-core/src/test/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationTest.java index 6c78abb..dfe24a5 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/properties/PropertiesConfigurationTest.java @@ -21,28 +21,28 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.Filter; import org.apache.logging.log4j.core.LifeCycle; -import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.Configuration; -import org.apache.logging.log4j.core.config.ConfigurationFactory; import org.apache.logging.log4j.core.config.LoggerConfig; import org.apache.logging.log4j.core.filter.ThresholdFilter; +import org.apache.logging.log4j.junit.LoggerContextRule; +import org.junit.ClassRule; import org.junit.Test; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import
[30/50] logging-log4j2 git commit: JMX small improvements
JMX small improvements Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d7b1a023 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d7b1a023 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d7b1a023 Branch: refs/heads/LOG4J2-1161 Commit: d7b1a023c9b0127a3d6b887d36563c8da47a4b2f Parents: a0d9be5 Author: rpopmaAuthored: Thu Oct 22 00:03:50 2015 +0900 Committer: rpopma Committed: Thu Oct 22 00:03:50 2015 +0900 -- .../log4j/core/async/AsyncLoggerContextSelector.java| 2 +- .../main/java/org/apache/logging/log4j/core/jmx/Server.java | 9 - .../log4j/core/selector/ClassLoaderContextSelector.java | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d7b1a023/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java index 68420a3..83e644c 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java @@ -33,7 +33,7 @@ public class AsyncLoggerContextSelector implements ContextSelector { // LOG4J2-666 ensure unique name across separate instances created by webapp classloaders private static final AsyncLoggerContext CONTEXT = new AsyncLoggerContext("AsyncLoggerContext@" -+ AsyncLoggerContext.class.hashCode()); ++ Integer.toHexString(AsyncLoggerContext.class.hashCode())); /** * Returns {@code true} if the user specified this selector as the Log4jContextSelector, to make all loggers http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d7b1a023/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java index 1ea55e9..4860551 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java @@ -161,8 +161,11 @@ public final class Server { LOGGER.debug("Could not register MBeans: no ContextSelector found."); return; } +LOGGER.trace("Reregistering MBeans after reconfigure. Selector={}", selector); final List contexts = selector.getLoggerContexts(); +int i = 0; for (final LoggerContext ctx : contexts) { +LOGGER.trace("Reregistering context ({}/{}): '{}' {}", ++i, contexts.size(), ctx.getName(), ctx); // first unregister the context and all nested loggers, // appenders, statusLogger, contextSelector, ringbuffers... unregisterLoggerContext(ctx.getName(), mbs); @@ -329,8 +332,12 @@ public final class Server { try { final ObjectName pattern = new ObjectName(search); final Set found = mbs.queryNames(pattern, null); +if (found.isEmpty()) { + LOGGER.trace("Unregistering but no MBeans found matching '{}'", search); +} else { + LOGGER.trace("Unregistering {} MBeans: {}", found.size(), found); +} for (final ObjectName objectName : found) { -LOGGER.debug("Unregistering MBean {}", objectName); mbs.unregisterMBean(objectName); } } catch (final Exception ex) { http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d7b1a023/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java index e3b5679..f7fa5d4 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java @@ -169,7 +169,7 @@ public class ClassLoaderContextSelector implements ContextSelector { } private String toContextMapKey(final ClassLoader loader) { -
[12/50] logging-log4j2 git commit: Add @Test to test method.
Add @Test to test method. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/581d885d Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/581d885d Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/581d885d Branch: refs/heads/LOG4J2-1161 Commit: 581d885d60ce6a74deaa35d4d0acab1c220a0d63 Parents: 9762412 Author: Matt SickerAuthored: Wed Oct 21 00:28:03 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 00:28:03 2015 -0500 -- .../src/test/java/org/apache/logging/log4j/core/LogEventTest.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/581d885d/log4j-core/src/test/java/org/apache/logging/log4j/core/LogEventTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/LogEventTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/LogEventTest.java index 4c0b85b..d8729ca 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/LogEventTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/LogEventTest.java @@ -120,6 +120,7 @@ public class LogEventTest { assertEquals("both zero nanoTime", event2, actual); } +@Test public void testEquals() { final LogEvent event1 = Log4jLogEvent.newBuilder() // .setLoggerName(this.getClass().getName()) //
[46/50] logging-log4j2 git commit: LOG4J2-493 fixed tests: AsyncLoggerContext is no longer a singleton
LOG4J2-493 fixed tests: AsyncLoggerContext is no longer a singleton Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4b0b01dd Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4b0b01dd Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4b0b01dd Branch: refs/heads/LOG4J2-1161 Commit: 4b0b01ddac5e26905b1a45c5c1086f32fb6c8b91 Parents: 6659d55 Author: rpopmaAuthored: Fri Oct 23 02:25:53 2015 +0900 Committer: rpopma Committed: Fri Oct 23 02:25:53 2015 +0900 -- .../core/async/AsyncLoggerContextSelectorTest.java | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4b0b01dd/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java index 3bae290..23c4cdd 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java @@ -42,10 +42,17 @@ public class AsyncLoggerContextSelectorTest { } @Test +public void testLoggerContextsListInitiallyEmpty() { +final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); +assertTrue(selector.getLoggerContexts().isEmpty()); +} + +@Test public void testLoggerContextsReturnsAsyncLoggerContext() { final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); -final List list = selector.getLoggerContexts(); +selector.getContext(null, null, false); +final List list = selector.getLoggerContexts(); assertEquals(1, list.size()); assertTrue(list.get(0) instanceof AsyncLoggerContext); } @@ -54,7 +61,8 @@ public class AsyncLoggerContextSelectorTest { public void testContextNameIsAsyncLoggerContextWithClassHashCode() { final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector(); final LoggerContext context = selector.getContext(null, null, false); -final String expectedContextName = "AsyncLoggerContext@" + Integer.toHexString(AsyncLoggerContext.class.hashCode()); +final int hash = getClass().getClassLoader().hashCode(); +final String expectedContextName = "AsyncLoggerContext@" + Integer.toHexString(hash); assertEquals(expectedContextName, context.getName()); }
[49/50] logging-log4j2 git commit: LOG4J2-323 preparations toward having one AsyncLoggerConfigHelper per Configuration, shared by all AsyncLoggerConfig objects
LOG4J2-323 preparations toward having one AsyncLoggerConfigHelper per Configuration, shared by all AsyncLoggerConfig objects - extract interface AsyncLoggerConfigDelegate from AsyncLoggerConfigHelper - removed AsyncLoggerConfig field from Helper, since a single helper will be servicing all AsyncLoggerConfigs in the same configuration Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/9c3af711 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/9c3af711 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/9c3af711 Branch: refs/heads/LOG4J2-1161 Commit: 9c3af711478e459ac0423f2eca83bd86481db93e Parents: 86e0a0a Author: rpopmaAuthored: Fri Oct 23 09:47:24 2015 +0900 Committer: rpopma Committed: Fri Oct 23 09:47:24 2015 +0900 -- .../log4j/core/async/AsyncLoggerConfig.java | 25 ++ .../core/async/AsyncLoggerConfigDelegate.java | 52 .../core/async/AsyncLoggerConfigHelper.java | 39 +-- 3 files changed, 68 insertions(+), 48 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9c3af711/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfig.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfig.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfig.java index 186575d..7be1e8f 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfig.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfig.java @@ -70,26 +70,7 @@ public class AsyncLoggerConfig extends LoggerConfig { private static final long serialVersionUID = 1L; -private AsyncLoggerConfigHelper helper; - -/** - * Default constructor. - */ -public AsyncLoggerConfig() { -super(); -} - -/** - * Constructor that sets the name, level and additive values. - * - * @param name The Logger name. - * @param level The Level. - * @param additive true if the Logger is additive, false otherwise. - */ -public AsyncLoggerConfig(final String name, final Level level, -final boolean additive) { -super(name, level, additive); -} +private AsyncLoggerConfigDelegate helper; protected AsyncLoggerConfig(final String name, final List appenders, final Filter filter, @@ -111,7 +92,7 @@ public class AsyncLoggerConfig extends LoggerConfig { event.getThreadName(); // pass on the event to a separate thread -if (!helper.callAppendersFromAnotherThread(event)) { +if (!helper.tryCallAppendersInBackground(event, this)) { super.callAppenders(event); } } @@ -130,7 +111,7 @@ public class AsyncLoggerConfig extends LoggerConfig { LOGGER.trace("AsyncLoggerConfig[{}] starting...", displayName()); this.setStarting(); if (helper == null) { -helper = new AsyncLoggerConfigHelper(this); +helper = new AsyncLoggerConfigHelper(); } else { AsyncLoggerConfigHelper.claim(); // LOG4J2-336 } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9c3af711/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDelegate.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDelegate.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDelegate.java new file mode 100644 index 000..229b08e --- /dev/null +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDelegate.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ + +package org.apache.logging.log4j.core.async; + +import
[24/50] logging-log4j2 git commit: Remove redundant static finals in interface.
Remove redundant static finals in interface. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/0b72e494 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/0b72e494 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/0b72e494 Branch: refs/heads/LOG4J2-1161 Commit: 0b72e494d9ba98538a21676be90a8d7bd2048ef7 Parents: 96c3803 Author: Matt SickerAuthored: Wed Oct 21 02:05:12 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 02:05:12 2015 -0500 -- .../logging/log4j/core/async/perftest/IPerfTestRunner.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0b72e494/log4j-core/src/test/java/org/apache/logging/log4j/core/async/perftest/IPerfTestRunner.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/perftest/IPerfTestRunner.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/perftest/IPerfTestRunner.java index 2e4c32c..62bec14 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/perftest/IPerfTestRunner.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/perftest/IPerfTestRunner.java @@ -19,10 +19,10 @@ package org.apache.logging.log4j.core.async.perftest; import com.lmax.disruptor.collections.Histogram; public interface IPerfTestRunner { -static final String LINE100 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!\"#$%&'()-=^~|\\@`[]{};:+*,.<>/?_123456"; -static final String THROUGHPUT_MSG = LINE100 + LINE100 + LINE100 + LINE100 +String LINE100 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!\"#$%&'()-=^~|\\@`[]{};:+*,.<>/?_123456"; +String THROUGHPUT_MSG = LINE100 + LINE100 + LINE100 + LINE100 + LINE100; -static final String LATENCY_MSG = "Short msg"; +String LATENCY_MSG = "Short msg"; void runThroughputTest(int lines, Histogram histogram);
[03/50] logging-log4j2 git commit: Consistently log exceptions when using the status logger.
Consistently log exceptions when using the status logger. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/98bbbf55 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/98bbbf55 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/98bbbf55 Branch: refs/heads/LOG4J2-1161 Commit: 98bbbf55b5989491ca5c65ae762469876d3ca893 Parents: 82cbdee Author: ggregoryAuthored: Tue Oct 20 15:31:02 2015 -0700 Committer: ggregory Committed: Tue Oct 20 15:31:02 2015 -0700 -- .../log4j/core/appender/AbstractManager.java| 21 .../core/appender/MemoryMappedFileManager.java | 7 --- .../core/appender/OutputStreamManager.java | 8 .../core/appender/RandomAccessFileManager.java | 5 ++--- .../appender/db/AbstractDatabaseManager.java| 6 ++ .../appender/db/jdbc/JdbcDatabaseManager.java | 4 ++-- .../appender/db/jpa/JpaDatabaseManager.java | 2 +- .../appender/rolling/RollingFileManager.java| 12 +-- .../rolling/RollingRandomAccessFileManager.java | 8 .../logging/log4j/core/net/SmtpManager.java | 8 .../flume/appender/FlumePersistentManager.java | 10 +- 11 files changed, 51 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/98bbbf55/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java index 1d0e3f1..d256a4f 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java @@ -21,7 +21,9 @@ import java.util.Map; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.message.Message; import org.apache.logging.log4j.status.StatusLogger; /** @@ -142,4 +144,23 @@ public abstract class AbstractManager { public Map getContentFormat() { return new HashMap<>(); } + +protected void log(Level level, String message, Throwable throwable) { +Message m = LOGGER.getMessageFactory().newMessage("{} {} {}: {}", +getClass().getSimpleName(), getName(), message, throwable); +LOGGER.log(level, m, throwable); +} + +protected void logDebug(String message, Throwable throwable) { +log(Level.DEBUG, message, throwable); +} + +protected void logError(String message, Throwable throwable) { +log(Level.ERROR, message, throwable); +} + +protected void logWarn(String message, Throwable throwable) { +log(Level.WARN, message, throwable); +} + } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/98bbbf55/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileManager.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileManager.java index 9bc5d48..0aa4be6 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileManager.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileManager.java @@ -35,7 +35,6 @@ import java.util.Objects; import org.apache.logging.log4j.core.Layout; import org.apache.logging.log4j.core.util.Closer; import org.apache.logging.log4j.core.util.NullOutputStream; -import org.apache.logging.log4j.message.Message; /** * Extends OutputStreamManager but instead of using a buffered output stream, this class maps a region of a file into @@ -125,12 +124,6 @@ public class MemoryMappedFileManager extends OutputStreamManager { // already done in AbstractOutputStreamAppender.append } -protected void logError(String message, Throwable throwable) { -Message m = LOGGER.getMessageFactory().newMessage("{} {} {}: {}", -getClass().getSimpleName(), getName(), message, throwable); -LOGGER.error(m, throwable); -} - private synchronized void remap() { final long offset = this.mappingOffset + mappedBuffer.position(); final int length = mappedBuffer.remaining() + regionLength;
[13/50] logging-log4j2 git commit: Remove redundant casts in unit tests.
Remove redundant casts in unit tests. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/caa7cc79 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/caa7cc79 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/caa7cc79 Branch: refs/heads/LOG4J2-1161 Commit: caa7cc795ea9dcbec07cbd95a5f15065e52f57af Parents: 581d885 Author: Matt SickerAuthored: Wed Oct 21 00:39:13 2015 -0500 Committer: Matt Sicker Committed: Wed Oct 21 00:39:13 2015 -0500 -- .../src/test/java/org/apache/logging/log4j/core/HostNameTest.java | 2 +- .../test/java/org/apache/logging/log4j/core/LoggerDateTest.java| 2 +- .../src/test/java/org/apache/logging/log4j/core/LookupTest.java| 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/caa7cc79/log4j-core/src/test/java/org/apache/logging/log4j/core/HostNameTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/HostNameTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/HostNameTest.java index ca7b99e..ee56883 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/HostNameTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/HostNameTest.java @@ -46,7 +46,7 @@ public class HostNameTest { @Before public void before() { host = context.getListAppender("HostTest").clear(); -hostFile = (RollingFileAppender) context.getRequiredAppender("HostFile"); +hostFile = context.getRequiredAppender("HostFile", RollingFileAppender.class); } @Test http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/caa7cc79/log4j-core/src/test/java/org/apache/logging/log4j/core/LoggerDateTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/LoggerDateTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/LoggerDateTest.java index 5cb0cf8..a6a5ca2 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/LoggerDateTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/LoggerDateTest.java @@ -39,7 +39,7 @@ public class LoggerDateTest { @Before public void before() { -fileApp = (FileAppender) context.getRequiredAppender("File"); +fileApp = context.getRequiredAppender("File", FileAppender.class); } @Test http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/caa7cc79/log4j-core/src/test/java/org/apache/logging/log4j/core/LookupTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/LookupTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/LookupTest.java index 04c837a..42c7f3c 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/LookupTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/LookupTest.java @@ -36,7 +36,7 @@ public class LookupTest { @Test public void testHostname() { -final ConsoleAppender app = (ConsoleAppender) context.getRequiredAppender("console"); +final ConsoleAppender app = context.getRequiredAppender("console", ConsoleAppender.class); final Layout layout = app.getLayout(); assertNotNull("No Layout", layout); assertTrue("Layout is not a PatternLayout", layout instanceof PatternLayout);
[34/50] logging-log4j2 git commit: LOG4J2-493 AsyncLoggerContextSelector no longer has a singleton context, but manages multiple contexts (max one per classloader)
LOG4J2-493 AsyncLoggerContextSelector no longer has a singleton context, but manages multiple contexts (max one per classloader) Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7e6c1b22 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7e6c1b22 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7e6c1b22 Branch: refs/heads/LOG4J2-1161 Commit: 7e6c1b2270760798f4014e8ea5e1fa84843f26c9 Parents: 2a853aa Author: rpopmaAuthored: Thu Oct 22 10:34:20 2015 +0900 Committer: rpopma Committed: Thu Oct 22 10:34:20 2015 +0900 -- .../core/async/AsyncLoggerContextSelector.java | 24 1 file changed, 15 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7e6c1b22/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java index 83e644c..d2ee058 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelector.java @@ -18,8 +18,9 @@ package org.apache.logging.log4j.core.async; import java.net.URI; import java.util.ArrayList; -import java.util.Collections; import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.selector.ContextSelector; @@ -31,9 +32,7 @@ import org.apache.logging.log4j.util.PropertiesUtil; */ public class AsyncLoggerContextSelector implements ContextSelector { -// LOG4J2-666 ensure unique name across separate instances created by webapp classloaders -private static final AsyncLoggerContext CONTEXT = new AsyncLoggerContext("AsyncLoggerContext@" -+ Integer.toHexString(AsyncLoggerContext.class.hashCode())); +private ConcurrentMap contexts = new ConcurrentHashMap (); /** * Returns {@code true} if the user specified this selector as the Log4jContextSelector, to make all loggers @@ -48,24 +47,31 @@ public class AsyncLoggerContextSelector implements ContextSelector { @Override public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext) { -return CONTEXT; +// LOG4J2-666 ensure unique name across separate instances created by webapp classloaders +final int hash = loader == null ? getClass().getClassLoader().hashCode() : loader.hashCode(); +final String key = "AsyncLoggerContext@" + Integer.toHexString(hash); +AsyncLoggerContext result = contexts.get(key); +if (result == null) { +result = new AsyncLoggerContext(key); +return contexts.putIfAbsent(key, result); +} +return result; } @Override public List getLoggerContexts() { -final List list = new ArrayList<>(); -list.add(CONTEXT); -return Collections.unmodifiableList(list); +return new ArrayList(contexts.values()); } @Override public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext, final URI configLocation) { -return CONTEXT; +return getContext(fqcn, loader, currentContext); } @Override public void removeContext(final LoggerContext context) { +contexts.remove(context.getName()); } }
[07/50] logging-log4j2 git commit: checkstyle.plugin.version 2.16 -> 2.17.
checkstyle.plugin.version 2.16 -> 2.17. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/ffd574d6 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ffd574d6 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ffd574d6 Branch: refs/heads/LOG4J2-1161 Commit: ffd574d69489e82db0c1978528d08ff702cee479 Parents: 2a82643 Author: ggregoryAuthored: Tue Oct 20 15:45:44 2015 -0700 Committer: ggregory Committed: Tue Oct 20 15:45:44 2015 -0700 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffd574d6/pom.xml -- diff --git a/pom.xml b/pom.xml index c38eace..fe9c7fa 100644 --- a/pom.xml +++ b/pom.xml @@ -186,7 +186,7 @@ 2.18.1 2.18.1 -2.16 +2.17 0.11 1.2 2.7
[31/50] logging-log4j2 git commit: Changelog: LOG4J2-1159 Fixed a ThreadLocal memory leak in Tomcat8 that mentions AsyncLoggers when Async Loggers are not used.
Changelog: LOG4J2-1159 Fixed a ThreadLocal memory leak in Tomcat8 that mentions AsyncLoggers when Async Loggers are not used. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/0eb6ddfb Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/0eb6ddfb Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/0eb6ddfb Branch: refs/heads/LOG4J2-1161 Commit: 0eb6ddfbf8d29577c41af5873046d5849a7688d1 Parents: d7b1a02 Author: rpopmaAuthored: Thu Oct 22 00:16:21 2015 +0900 Committer: rpopma Committed: Thu Oct 22 00:16:21 2015 +0900 -- src/changes/changes.xml | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0eb6ddfb/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 9a8b7a9..3f37ffb 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -24,6 +24,9 @@ + +Fixed a ThreadLocal memory leak in Tomcat8 that mentions AsyncLoggers when Async Loggers are not used. + Add support for JSR 223 scripts in filters and the PatternSelector.
[2/3] logging-log4j2 git commit: Merge branch 'master' into LOG4J2-1161
Merge branch 'master' into LOG4J2-1161 Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d3a06415 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d3a06415 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d3a06415 Branch: refs/heads/master Commit: d3a06415095ae3784c3f2034843bdfc874a790f1 Parents: 990a97c 9c3af71 Author: Mikael StåldalAuthored: Fri Oct 23 14:57:19 2015 +0200 Committer: Mikael Ståldal Committed: Fri Oct 23 14:57:19 2015 +0200 -- .../log4j/message/LocalizedMessageFactory.java | 5 +- .../logging/log4j/util/StringBuilders.java | 2 +- .../org/apache/logging/log4j/core/Logger.java | 50 +++- .../logging/log4j/core/LoggerContext.java | 11 +- .../log4j/core/appender/AbstractManager.java| 21 ++ .../log4j/core/appender/FileManager.java| 2 +- .../core/appender/MemoryMappedFileManager.java | 16 +- .../core/appender/OutputStreamManager.java | 8 +- .../core/appender/RandomAccessFileManager.java | 5 +- .../RollingRandomAccessFileAppender.java| 2 +- .../appender/db/AbstractDatabaseManager.java| 6 +- .../appender/db/jdbc/JdbcDatabaseManager.java | 4 +- .../appender/db/jpa/JpaDatabaseManager.java | 2 +- .../appender/rolling/RollingFileManager.java| 12 +- .../rolling/RollingRandomAccessFileManager.java | 8 +- .../core/appender/routing/RoutingAppender.java | 2 +- .../logging/log4j/core/async/AsyncLogger.java | 231 +-- .../log4j/core/async/AsyncLoggerConfig.java | 25 +- .../core/async/AsyncLoggerConfigDelegate.java | 52 + .../core/async/AsyncLoggerConfigHelper.java | 43 ++-- .../log4j/core/async/AsyncLoggerContext.java| 54 - .../core/async/AsyncLoggerContextSelector.java | 48 ++-- .../log4j/core/async/AsyncLoggerHelper.java | 210 + .../apache/logging/log4j/core/async/Info.java | 109 + .../core/config/AbstractConfiguration.java | 20 +- .../log4j/core/config/ConfigurationFactory.java | 3 +- .../logging/log4j/core/config/LoggerConfig.java | 3 +- .../core/config/builder/api/package-info.java | 2 +- .../plugins/convert/TypeConverterRegistry.java | 2 +- .../core/config/plugins/util/PluginBuilder.java | 45 ++-- .../plugins/validation/ConstraintValidator.java | 5 +- .../validators/RequiredValidator.java | 18 +- .../plugins/visitors/PluginElementVisitor.java | 2 +- .../config/plugins/visitors/PluginVisitors.java | 1 - .../logging/log4j/core/impl/Log4jLogEvent.java | 2 + .../apache/logging/log4j/core/jmx/Server.java | 12 +- .../log4j/core/layout/PatternLayout.java| 2 +- .../log4j/core/layout/Rfc5424Layout.java| 2 +- .../logging/log4j/core/net/SmtpManager.java | 8 +- .../ExtendedThrowablePatternConverter.java | 2 +- .../pattern/RootThrowablePatternConverter.java | 2 +- .../selector/ClassLoaderContextSelector.java| 46 ++-- .../logging/log4j/core/util/ClockFactory.java | 10 +- .../logging/log4j/core/util/FileWatcher.java| 2 +- log4j-core/src/site/xdoc/index.xml | 2 +- .../apache/logging/log4j/core/HostNameTest.java | 2 +- .../apache/logging/log4j/core/LogEventTest.java | 3 + .../logging/log4j/core/LoggerDateTest.java | 2 +- .../log4j/core/LoggerSerializationTest.java | 2 - .../apache/logging/log4j/core/LookupTest.java | 2 +- .../log4j/core/appender/AsyncAppenderTest.java | 32 +-- .../appender/JsonCompleteFileAppenderTest.java | 5 +- .../MemoryMappedFileAppenderLocationTest.java | 9 +- .../MemoryMappedFileAppenderRemapTest.java | 9 +- .../MemoryMappedFileAppenderSimpleTest.java | 9 +- .../appender/RandomAccessFileAppenderTests.java | 5 +- .../appender/RandomAccessFileManagerTest.java | 20 +- .../appender/XmlCompactFileAppenderTest.java| 4 +- .../appender/XmlCompleteFileAppenderTest.java | 4 +- .../core/appender/XmlFileAppenderTest.java | 4 +- .../XmlRandomAccessFileAppenderTest.java| 4 +- .../db/jdbc/AbstractJdbcAppenderTest.java | 5 +- .../routing/JsonRoutingAppender2Test.java | 40 +--- .../routing/JsonRoutingAppenderTest.java| 40 +--- .../routing/RoutingAppenderWithJndiTest.java| 4 +- .../routing/RoutingDefaultAppenderTest.java | 2 +- ...ncLoggerContextSelectorInitialStateTest.java | 30 +++ .../async/AsyncLoggerContextSelectorTest.java | 14 +- .../AsyncLoggerThreadNameStrategyTest.java | 24 +- .../AsyncLoggersWithAsyncAppenderTest.java | 37 +-- .../AsyncLoggersWithAsyncLoggerConfigTest.java | 37 +-- .../core/async/perftest/IPerfTestRunner.java| 6 +- .../log4j/core/async/perftest/PerfTest.java | 5 +-
[3/3] logging-log4j2 git commit: Rename withValue to with, add Javadoc
Rename withValue to with, add Javadoc Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/66bbf4dd Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/66bbf4dd Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/66bbf4dd Branch: refs/heads/master Commit: 66bbf4ddfd94834817bf83a6dc06fb89fae37569 Parents: d3a0641 Author: Mikael StåldalAuthored: Fri Oct 23 15:18:16 2015 +0200 Committer: Mikael Ståldal Committed: Fri Oct 23 15:18:16 2015 +0200 -- .../java/org/apache/logging/log4j/message/MapMessage.java | 8 +++- .../apache/logging/log4j/message/StructuredDataMessage.java | 9 - .../org/apache/logging/log4j/message/MapMessageTest.java| 4 ++-- .../logging/log4j/message/StructuredDataMessageTest.java| 6 +++--- 4 files changed, 20 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/66bbf4dd/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java index 1012d0e..b113ed5 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java @@ -109,7 +109,13 @@ public class MapMessage implements MultiformatMessage { data.clear(); } -public MapMessage withValue(final String key, final String value) { +/** + * Add an item to the data Map in fluent style. + * @param key The name of the data item. + * @param value The value of the data item. + * @return {@code this} + */ +public MapMessage with(final String key, final String value) { put(key, value); return this; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/66bbf4dd/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java index abacce2..f29732e 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java @@ -130,7 +130,14 @@ public class StructuredDataMessage extends MapMessage { } -public StructuredDataMessage withValue(final String key, final String value) { +/** + * Add an item to the data Map in fluent style. + * @param key The name of the data item. + * @param value The value of the data item. + * @return {@code this} + */ +@Override +public StructuredDataMessage with(final String key, final String value) { put(key, value); return this; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/66bbf4dd/log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java -- diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java index 7f43027..e7bef75 100644 --- a/log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java +++ b/log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java @@ -40,8 +40,8 @@ public class MapMessageTest { public void testBuilder() { final String testMsg = "Test message {}"; final MapMessage msg = new MapMessage() -.withValue("message", testMsg) -.withValue("project", "Log4j"); +.with("message", testMsg) +.with("project", "Log4j"); final String result = msg.getFormattedMessage(); final String expected = "message=\"Test message {}\" project=\"Log4j\""; assertEquals(expected, result); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/66bbf4dd/log4j-api/src/test/java/org/apache/logging/log4j/message/StructuredDataMessageTest.java -- diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/message/StructuredDataMessageTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/message/StructuredDataMessageTest.java index ce9ad9b..47116f2 100644 --- a/log4j-api/src/test/java/org/apache/logging/log4j/message/StructuredDataMessageTest.java +++
logging-log4j2 git commit: LOG4J2-323 Better web app support for async loggers (when config file contains AsyncRoot/AsyncLogger).
Repository: logging-log4j2 Updated Branches: refs/heads/master d8ede120f -> 0812a6795 LOG4J2-323 Better web app support for async loggers (when config file contains AsyncRoot/AsyncLogger). Fixed a memory leak that occurred when the logging jars are placed in the container's classpath and the configuration file uses AsyncRoot/AsyncLogger. The problem was that the first web application started the Disruptor background thread [AsyncLoggerConfig-1] but did not stop it until all web apps are stopped. Each web application now has its own Disruptor which is stopped/started together with the web app. - AsyncLoggerConfig does not create Helper objects, but instead obtain shared instances from the Configuration - Added method getAsyncLoggerConfigDelegate() to Configuration - AsyncLoggerConfigHelper disruptor is no longer a static field: multiple Helper instances each have their own Disruptor. Start/stop no longer need a reference count. - AbstractConfiguration simplified stop() impl: simply call asyncLoggerConfigHelper.stop(), no need to worry about ref counts (order in which components are stopped still matters) - Fixed tests Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/0812a679 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/0812a679 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/0812a679 Branch: refs/heads/master Commit: 0812a6795743015a9c49440f9d262f378d095186 Parents: d8ede12 Author: rpopmaAuthored: Sat Oct 24 01:37:36 2015 +0900 Committer: rpopma Committed: Sat Oct 24 01:37:36 2015 +0900 -- .../log4j/core/async/AsyncLoggerConfig.java | 9 +- .../core/async/AsyncLoggerConfigDelegate.java | 2 +- .../core/async/AsyncLoggerConfigHelper.java | 171 +-- .../core/config/AbstractConfiguration.java | 124 +++--- .../log4j/core/config/Configuration.java| 15 +- .../core/async/AsyncLoggerLocationTest.java | 6 +- .../log4j/core/async/AsyncLoggerTest.java | 2 +- .../async/AsyncLoggerThreadContextTest.java | 2 +- .../async/AsyncLoggerTimestampMessageTest.java | 2 +- src/changes/changes.xml | 6 + 10 files changed, 174 insertions(+), 165 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0812a679/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfig.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfig.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfig.java index 7be1e8f..b109f49 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfig.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfig.java @@ -79,6 +79,7 @@ public class AsyncLoggerConfig extends LoggerConfig { final boolean includeLocation) { super(name, appenders, filter, level, additive, properties, config, includeLocation); +helper = config.getAsyncLoggerConfigDelegate(); } /** @@ -109,20 +110,12 @@ public class AsyncLoggerConfig extends LoggerConfig { @Override public void start() { LOGGER.trace("AsyncLoggerConfig[{}] starting...", displayName()); -this.setStarting(); -if (helper == null) { -helper = new AsyncLoggerConfigHelper(); -} else { -AsyncLoggerConfigHelper.claim(); // LOG4J2-336 -} super.start(); } @Override public void stop() { LOGGER.trace("AsyncLoggerConfig[{}] stopping...", displayName()); -this.setStopping(); -AsyncLoggerConfigHelper.release(); super.stop(); } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0812a679/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDelegate.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDelegate.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDelegate.java index 229b08e..304626f 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDelegate.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDelegate.java @@ -24,7 +24,7 @@ import org.apache.logging.log4j.core.jmx.RingBufferAdmin; * Encapsulates the mechanism used to log asynchronously. There is one delegate per configuration, which is shared by * all AsyncLoggerConfig objects in the configuration. */ -interface
logging-log4j2 git commit: [LOG4J2-1168] Add getters for source and destination file in file rename action.
Repository: logging-log4j2 Updated Branches: refs/heads/master 7e47aecc8 -> 5a5b7d453 [LOG4J2-1168] Add getters for source and destination file in file rename action. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/5a5b7d45 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/5a5b7d45 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/5a5b7d45 Branch: refs/heads/master Commit: 5a5b7d4536861a32690574bd4044828d211da112 Parents: 7e47aec Author: ggregoryAuthored: Fri Oct 23 18:18:07 2015 -0700 Committer: ggregory Committed: Fri Oct 23 18:18:07 2015 -0700 -- .../rolling/action/FileRenameAction.java| 25 src/changes/changes.xml | 3 +++ 2 files changed, 28 insertions(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5a5b7d45/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/FileRenameAction.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/FileRenameAction.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/FileRenameAction.java index f45cd01..f5f0849 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/FileRenameAction.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/FileRenameAction.java @@ -64,6 +64,30 @@ public class FileRenameAction extends AbstractAction { } /** + * Gets the destination. + * @return the destination. + */ +public File getDestination() { +return this.destination; +} + +/** + * Whether to rename empty files. If true, rename empty files, otherwise delete empty files. + * @return Whether to rename empty files. + */ +public boolean getRenameEmptyFiles() { +return renameEmptyFiles; +} + +/** + * Gets the source. + * @return the source. + */ +public File getSource() { +return this.source; +} + +/** * Rename file. * * @param source current file name. @@ -127,4 +151,5 @@ public class FileRenameAction extends AbstractAction { return FileRenameAction.class.getSimpleName() + '[' + source + " to " + destination // + ", renameEmptyFiles=" + renameEmptyFiles + ']'; } + } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5a5b7d45/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index a5d73c5..f297d2c 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -44,6 +44,9 @@ Add support for JSR 223 scripts in filters and the PatternSelector. + +Add getters for source and destination file in file rename action. + AbstractConfiguration executor should use a DaemonThreadFactory.
[1/3] logging-log4j2 git commit: Update ivar name.
Repository: logging-log4j2 Updated Branches: refs/heads/master 0c44f18d1 -> dea340caf Update ivar 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/b80adfdc Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/b80adfdc Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/b80adfdc Branch: refs/heads/master Commit: b80adfdc8999516492bb088555d9396ba1d1aef7 Parents: 0c44f18 Author: ggregoryAuthored: Fri Oct 23 18:26:31 2015 -0700 Committer: ggregory Committed: Fri Oct 23 18:26:31 2015 -0700 -- .../appender/rolling/CompositeTriggeringPolicy.java | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b80adfdc/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CompositeTriggeringPolicy.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CompositeTriggeringPolicy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CompositeTriggeringPolicy.java index 5781450..0ce04de 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CompositeTriggeringPolicy.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CompositeTriggeringPolicy.java @@ -29,14 +29,14 @@ import org.apache.logging.log4j.core.config.plugins.PluginFactory; @Plugin(name = "Policies", category = "Core", printObject = true) public final class CompositeTriggeringPolicy implements TriggeringPolicy { -private final TriggeringPolicy[] policies; +private final TriggeringPolicy[] triggeringPolicy; private CompositeTriggeringPolicy(final TriggeringPolicy... policies) { -this.policies = policies; +this.triggeringPolicy = policies; } public TriggeringPolicy[] getTriggeringPolicies() { -return policies; +return triggeringPolicy; } /** @@ -45,7 +45,7 @@ public final class CompositeTriggeringPolicy implements TriggeringPolicy { */ @Override public void initialize(final RollingFileManager manager) { -for (final TriggeringPolicy policy : policies) { +for (final TriggeringPolicy policy : triggeringPolicy) { policy.initialize(manager); } } @@ -57,7 +57,7 @@ public final class CompositeTriggeringPolicy implements TriggeringPolicy { */ @Override public boolean isTriggeringEvent(final LogEvent event) { -for (final TriggeringPolicy policy : policies) { +for (final TriggeringPolicy policy : triggeringPolicy) { if (policy.isTriggeringEvent(event)) { return true; } @@ -78,7 +78,7 @@ public final class CompositeTriggeringPolicy implements TriggeringPolicy { @Override public String toString() { -return "CompositeTriggeringPolicy(policies=" + Arrays.toString(policies) + ")"; +return "CompositeTriggeringPolicy(policies=" + Arrays.toString(triggeringPolicy) + ")"; } }
[3/3] logging-log4j2 git commit: [LOG4J2-1175] Add getters for classes in org.apache.logging.log4j.core.appender.rolling.action
[LOG4J2-1175] Add getters for classes in org.apache.logging.log4j.core.appender.rolling.action Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/dea340ca Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/dea340ca Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/dea340ca Branch: refs/heads/master Commit: dea340caf83d7e9995c4803f8d8bcb7bd3b49493 Parents: 48e9793 Author: ggregoryAuthored: Fri Oct 23 18:28:40 2015 -0700 Committer: ggregory Committed: Fri Oct 23 18:28:40 2015 -0700 -- src/changes/changes.xml | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/dea340ca/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index f297d2c..1e509cd 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -47,6 +47,9 @@ Add getters for source and destination file in file rename action. + +Add getters for classes in org.apache.logging.log4j.core.appender.rolling.action. + AbstractConfiguration executor should use a DaemonThreadFactory.
[2/3] logging-log4j2 git commit: [LOG4J2-1175] Add getters for classes in org.apache.logging.log4j.core.appender.rolling.action
[LOG4J2-1175] Add getters for classes in org.apache.logging.log4j.core.appender.rolling.action Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/48e97936 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/48e97936 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/48e97936 Branch: refs/heads/master Commit: 48e979368b7a5a49bafa7ce49ab00f2a66ccf799 Parents: b80adfd Author: ggregoryAuthored: Fri Oct 23 18:26:55 2015 -0700 Committer: ggregory Committed: Fri Oct 23 18:26:55 2015 -0700 -- .../appender/rolling/action/AbstractAction.java | 5 + .../rolling/action/CommonsCompressAction.java | 16 .../appender/rolling/action/CompositeAction.java| 9 + .../appender/rolling/action/GzCompressAction.java | 12 .../appender/rolling/action/ZipCompressAction.java | 16 5 files changed, 58 insertions(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/48e97936/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/AbstractAction.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/AbstractAction.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/AbstractAction.java index c766032..633d4bc 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/AbstractAction.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/AbstractAction.java @@ -91,6 +91,10 @@ public abstract class AbstractAction implements Action { return complete; } +public boolean isInterrupted() { +return interrupted; +} + /** * Captures exception. * @@ -98,4 +102,5 @@ public abstract class AbstractAction implements Action { */ protected void reportException(final Exception ex) { } + } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/48e97936/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CommonsCompressAction.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CommonsCompressAction.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CommonsCompressAction.java index b5a9610..de1fed0 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CommonsCompressAction.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CommonsCompressAction.java @@ -131,4 +131,20 @@ public final class CommonsCompressAction extends AbstractAction { return CommonsCompressAction.class.getSimpleName() + '[' + source + " to " + destination // + ", deleteSource=" + deleteSource + ']'; } + +public String getName() { +return name; +} + +public File getSource() { +return source; +} + +public File getDestination() { +return destination; +} + +public boolean isDeleteSource() { +return deleteSource; +} } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/48e97936/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CompositeAction.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CompositeAction.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CompositeAction.java index 9312d2d..5637144 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CompositeAction.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CompositeAction.java @@ -25,6 +25,7 @@ import java.util.List; * A group of Actions to be executed in sequence. */ public class CompositeAction extends AbstractAction { + /** * Actions to perform. */ @@ -103,4 +104,12 @@ public class CompositeAction extends AbstractAction { public String toString() { return CompositeAction.class.getSimpleName() + Arrays.toString(actions); } + +public Action[] getActions() { +return actions; +} + +public boolean isStopOnError() { +return stopOnError; +} } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/48e97936/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/GzCompressAction.java
logging-log4j2 git commit: Fix typo in example. See https://github.com/apache/logging-log4j2/pull/18/commits
Repository: logging-log4j2 Updated Branches: refs/heads/master dea340caf -> e2a197f3e Fix typo in example. See https://github.com/apache/logging-log4j2/pull/18/commits Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e2a197f3 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e2a197f3 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e2a197f3 Branch: refs/heads/master Commit: e2a197f3e50f4f7ca5ba5b4a97bb2e7c06a1f528 Parents: dea340c Author: ggregoryAuthored: Fri Oct 23 18:31:49 2015 -0700 Committer: ggregory Committed: Fri Oct 23 18:31:49 2015 -0700 -- src/site/xdoc/manual/thread-context.xml | 278 +-- 1 file changed, 139 insertions(+), 139 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e2a197f3/src/site/xdoc/manual/thread-context.xml -- diff --git a/src/site/xdoc/manual/thread-context.xml b/src/site/xdoc/manual/thread-context.xml index 8f2fed3..66ad61c 100644 --- a/src/site/xdoc/manual/thread-context.xml +++ b/src/site/xdoc/manual/thread-context.xml @@ -1,139 +1,139 @@ - - - -http://maven.apache.org/XDOC/2.0; - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; - xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd;> - -Log4j 2 Thread Context -Ralph Goers -Gary Gregory - - - - - - Introduction - Log4j introduced the concept of the Mapped Diagnostic Context or MDC. It has been documented and -discussed in numerous places including -http://veerasundar.com/blog/2009/10/log4j-mdc-mapped-diagnostic-context-what-and-why/;>Log4j MDC: What and Why and -http://blog.f12.no/wp/2004/12/09/log4j-and-the-mapped-diagnostic-context/;>Log4j and the Mapped Diagnostic Context. -In addition, Log4j 1.x provides support for a Nested Diagnostic Context or NDC. It too has been documented -and discussed in various places such as -http://lstierneyltd.com/blog/development/log4j-nested-diagnostic-contexts-ndc/;>Log4j NDC. -SLF4J/Logback followed with its own implementation of the MDC, which is documented very well at -http://logback.qos.ch/manual/mdc.html;>Mapped Diagnostic Context. - - Log4j 2 continues with the idea of the MDC and the NDC but merges them into a single Thread Context. -The Thread Context Map is the equivalent of the MDC and the Thread Context Stack is the equivalent of the -NDC. Although these are frequently used for purposes other than diagnosing problems, they are still -frequently referred to as the MDC and NDC in Log4j 2 since they are already well known by those acronyms. - - Fish Tagging - Most real-world systems have to deal with multiple clients simultaneously. In a typical multithreaded -implementation of such a system, different threads will handle different clients. Logging is -especially well suited to trace and debug complex distributed applications. A common approach to -differentiate the logging output of one client from another is to instantiate a new separate logger for -each client. This promotes the proliferation of loggers and increases the management overhead of logging. - - A lighter technique is to uniquely stamp each log request initiated from the same client interaction. -Neil Harrison described this method in the book "Patterns for Logging Diagnostic Messages," in Pattern -Languages of Program Design 3, edited by R. Martin, D. Riehle, and F. Buschmann -(Addison-Wesley, 1997). Just as a fish can be tagged and have its movement tracked, stamping log -events with a common tag or set of data elements allows the complete flow of a transaction or a request -to be tracked. We call this Fish Tagging. - - Log4j provides two mechanisms for performing Fish Tagging; the Thread Context Map and the Thread -Context Stack. The Thread Context Map allows any number of items to be added and be identified -using key/value pairs. The Thread Context Stack allows one or more items to be pushed on the -Stack and then be identified by their order in the Stack or by the data itself. Since key/value -pairs are more flexible, the Thread Context Map is recommended when data items may be added during -the processing of the request or when there are more than one or
logging-log4j2 git commit: LOG4J2-493 Wrap-up: better web app support for async loggers.
Repository: logging-log4j2 Updated Branches: refs/heads/master 6cfedcf7a -> c705ffdc1 LOG4J2-493 Wrap-up: better web app support for async loggers. It is now possible to place the logging jars in the container's classpath when making all loggers asynchronous by using AsyncLoggerContextSelector. Web apps can be started and stopped. - handle the case where the log4j jars are in container's classpath, but the log4j2.xml config file is in a web app's classpath. In this scenario, the Disruptor should only be started that web app. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/c705ffdc Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c705ffdc Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c705ffdc Branch: refs/heads/master Commit: c705ffdc105172a0ebbaea94caab07ad42de734e Parents: 6cfedcf Author: rpopmaAuthored: Sat Oct 24 00:07:45 2015 +0900 Committer: rpopma Committed: Sat Oct 24 00:07:45 2015 +0900 -- .../log4j/core/async/AsyncLoggerContext.java | 19 --- .../logging/log4j/core/jmx/RingBufferAdmin.java | 8 +++- .../apache/logging/log4j/core/jmx/Server.java| 5 - src/changes/changes.xml | 5 + 4 files changed, 28 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c705ffdc/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java index d5bddb5..f539fc5 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerContext.java @@ -21,8 +21,10 @@ import java.net.URI; import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.Configuration; +import org.apache.logging.log4j.core.config.DefaultConfiguration; import org.apache.logging.log4j.core.jmx.RingBufferAdmin; import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.status.StatusLogger; /** * {@code LoggerContext} that creates {@code AsyncLogger} objects. @@ -60,8 +62,8 @@ public class AsyncLoggerContext extends LoggerContext { @Override public void setName(final String name) { - super.setName("AsyncContext[" + name + "]"); - helper.setContextName(name); +super.setName("AsyncContext[" + name + "]"); +helper.setContextName(name); } /* @@ -82,10 +84,21 @@ public class AsyncLoggerContext extends LoggerContext { */ @Override public void start(Configuration config) { -helper.start(); +maybeStartHelper(config); super.start(config); } +private void maybeStartHelper(Configuration config) { +// If no log4j configuration was found, there are no loggers +// and there is no point in starting the disruptor (which takes up +// significant memory and starts a thread). +if (config instanceof DefaultConfiguration) { +StatusLogger.getLogger().debug("[{}] Not starting Disruptor for DefaultConfiguration.", getName()); +} else { +helper.start(); +} +} + @Override public void stop() { helper.stop(); // first stop Disruptor http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c705ffdc/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/RingBufferAdmin.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/RingBufferAdmin.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/RingBufferAdmin.java index 71c14f7..15a9e56 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/RingBufferAdmin.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/RingBufferAdmin.java @@ -16,8 +16,6 @@ */ package org.apache.logging.log4j.core.jmx; -import java.util.Objects; - import javax.management.ObjectName; import com.lmax.disruptor.RingBuffer; @@ -45,7 +43,7 @@ public class RingBufferAdmin implements RingBufferAdminMBean { } protected RingBufferAdmin(final RingBuffer ringBuffer, final String mbeanName) { -this.ringBuffer = Objects.requireNonNull(ringBuffer, "ringbuffer"); +this.ringBuffer = ringBuffer; try { objectName = new
logging-log4j2 git commit: [LOG4J2-1174] Update Jackson from 2.6.2 to 2.6.3.
Repository: logging-log4j2 Updated Branches: refs/heads/master 0812a6795 -> 7e47aecc8 [LOG4J2-1174] Update Jackson from 2.6.2 to 2.6.3. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7e47aecc Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7e47aecc Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7e47aecc Branch: refs/heads/master Commit: 7e47aecc8180597b505017b297928e629b23b029 Parents: 0812a67 Author: ggregoryAuthored: Fri Oct 23 16:10:28 2015 -0700 Committer: ggregory Committed: Fri Oct 23 16:10:28 2015 -0700 -- pom.xml | 2 +- src/changes/changes.xml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7e47aecc/pom.xml -- diff --git a/pom.xml b/pom.xml index 08c3bf7..b62f935 100644 --- a/pom.xml +++ b/pom.xml @@ -174,7 +174,7 @@ 1.7.12 1.1.3 1.9.13 -2.6.2 +2.6.3 3.2.13.RELEASE 1.6.0 3.3.2 http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7e47aecc/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index cbdada1..a5d73c5 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -59,6 +59,9 @@ org.apache.logging.log4j.core.Logger should be serializable. + +Update Jackson from 2.6.2 to 2.6.3. +