logging-log4j2 git commit: LOG4J-1644 adding locking for clearing registry
Repository: logging-log4j2 Updated Branches: refs/heads/master 6ffcd1e2c -> 5620da723 LOG4J-1644 adding locking for clearing registry Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/5620da72 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/5620da72 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/5620da72 Branch: refs/heads/master Commit: 5620da7237b3b20755b97aefe49037c84095fc5c Parents: 6ffcd1e Author: Mikael StåldalAuthored: Mon Oct 24 15:03:44 2016 +0200 Committer: Mikael Ståldal Committed: Mon Oct 24 15:03:44 2016 +0200 -- .../org/apache/logging/log4j/spi/AbstractLoggerAdapter.java | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5620da72/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java index 33c8745..a3eb31d 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java @@ -124,6 +124,11 @@ public abstract class AbstractLoggerAdapter implements LoggerAdapter { @Override public void close() { -registry.clear(); +lock.writeLock ().lock (); +try { +registry.clear(); +} finally { +lock.writeLock ().unlock (); +} } }
[3/8] logging-log4j2 git commit: Upgrade to Commons Lang 3.5
Upgrade to Commons Lang 3.5 Related to LOG4J2-1647. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/f3e9ea13 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/f3e9ea13 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/f3e9ea13 Branch: refs/heads/LOG4J2-1645 Commit: f3e9ea13fad1de7e2723f73cdf90810f62776ed2 Parents: d5e4578 Author: Matt SickerAuthored: Sun Oct 23 10:22:17 2016 -0500 Committer: Matt Sicker Committed: Sun Oct 23 10:22:17 2016 -0500 -- 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/f3e9ea13/pom.xml -- diff --git a/pom.xml b/pom.xml index 66b3bf7..be4d7e4 100644 --- a/pom.xml +++ b/pom.xml @@ -287,7 +287,7 @@ org.apache.commons commons-lang3 -3.4 +3.5 com.beust http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f3e9ea13/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 1c63572..4e0eb6e 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -39,6 +39,9 @@ Update JeroMQ from 0.3.5 to 0.3.6. + +Update Commons Lang from 3.4 to 4.5. +
[4/8] logging-log4j2 git commit: Migrate unit tests to Mockito 2.x
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/78c6a1fc/log4j-web/src/test/java/org/apache/logging/log4j/web/Log4jServletContainerInitializerTest.java -- diff --git a/log4j-web/src/test/java/org/apache/logging/log4j/web/Log4jServletContainerInitializerTest.java b/log4j-web/src/test/java/org/apache/logging/log4j/web/Log4jServletContainerInitializerTest.java index a4e6a6c..0cd3988 100644 --- a/log4j-web/src/test/java/org/apache/logging/log4j/web/Log4jServletContainerInitializerTest.java +++ b/log4j-web/src/test/java/org/apache/logging/log4j/web/Log4jServletContainerInitializerTest.java @@ -24,156 +24,125 @@ import javax.servlet.FilterRegistration; import javax.servlet.ServletContext; import org.apache.logging.log4j.util.Strings; -import org.easymock.Capture; -import org.easymock.EasyMock; -import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; -import static org.easymock.EasyMock.capture; -import static org.easymock.EasyMock.createStrictMock; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.expectLastCall; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.mock; +@RunWith(MockitoJUnitRunner.class) public class Log4jServletContainerInitializerTest { +@Mock private ServletContext servletContext; +@Mock private Log4jWebLifeCycle initializer; +@Captor +private ArgumentCaptorfilterCaptor; +@Captor +private ArgumentCaptor listenerCaptor; private Log4jServletContainerInitializer containerInitializer; @Before public void setUp() { -this.servletContext = createStrictMock(ServletContext.class); -this.initializer = createStrictMock(Log4jWebLifeCycle.class); - this.containerInitializer = new Log4jServletContainerInitializer(); } -@After -public void tearDown() { -verify(this.servletContext, this.initializer); -} - @Test public void testOnStartupWithServletVersion2_x() throws Exception { -expect(this.servletContext.getMajorVersion()).andReturn(2); - -replay(this.servletContext, this.initializer); +given(servletContext.getMajorVersion()).willReturn(2); this.containerInitializer.onStartup(null, this.servletContext); } @Test public void testOnStartupWithServletVersion3_xEffectiveVersion2_x() throws Exception { -expect(this.servletContext.getMajorVersion()).andReturn(3); -expect(this.servletContext.getEffectiveMajorVersion()).andReturn(2); - -replay(this.servletContext, this.initializer); +given(servletContext.getMajorVersion()).willReturn(3); +given(servletContext.getEffectiveMajorVersion()).willReturn(2); this.containerInitializer.onStartup(null, this.servletContext); } @Test public void testOnStartupWithServletVersion3_xEffectiveVersion3_xDisabledTrue() throws Exception { -expect(this.servletContext.getMajorVersion()).andReturn(3); -expect(this.servletContext.getEffectiveMajorVersion()).andReturn(3); - expect(this.servletContext.getInitParameter(Log4jWebSupport.IS_LOG4J_AUTO_INITIALIZATION_DISABLED)) -.andReturn("true"); - -replay(this.servletContext, this.initializer); +given(servletContext.getMajorVersion()).willReturn(3); +given(servletContext.getEffectiveMajorVersion()).willReturn(3); + given(servletContext.getInitParameter(eq(Log4jWebSupport.IS_LOG4J_AUTO_INITIALIZATION_DISABLED))).willReturn( +"true"); this.containerInitializer.onStartup(null, this.servletContext); } @Test public void testOnStartupWithServletVersion3_xEffectiveVersion3_xDisabledTRUE() throws Exception { -expect(this.servletContext.getMajorVersion()).andReturn(3); -expect(this.servletContext.getEffectiveMajorVersion()).andReturn(3); - expect(this.servletContext.getInitParameter(Log4jWebSupport.IS_LOG4J_AUTO_INITIALIZATION_DISABLED)) -.andReturn("TRUE"); - -replay(this.servletContext, this.initializer); +given(servletContext.getMajorVersion()).willReturn(3); +given(servletContext.getEffectiveMajorVersion()).willReturn(3); + given(servletContext.getInitParameter(eq(Log4jWebSupport.IS_LOG4J_AUTO_INITIALIZATION_DISABLED))).willReturn( +"TRUE");
[5/8] logging-log4j2 git commit: Migrate unit tests to Mockito 2.x
Migrate unit tests to Mockito 2.x This commit completely migrates from EasyMock to Mockito 2.x. Unit tests have been updated to use the BDD-style of Mockito's API (given/when/then). Various test cleanups were also included during the migration. Related to LOG4J2-1646. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/78c6a1fc Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/78c6a1fc Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/78c6a1fc Branch: refs/heads/LOG4J2-1645 Commit: 78c6a1fcae718f5edd177256ab157f555b84f37a Parents: f3e9ea1 Author: Matt SickerAuthored: Sun Oct 23 15:09:35 2016 -0500 Committer: Matt Sicker Committed: Sun Oct 23 15:12:03 2016 -0500 -- log4j-core/pom.xml | 4 +- .../core/appender/ConsoleAppenderTest.java | 27 +- .../db/AbstractDatabaseAppenderTest.java| 145 +++ .../db/AbstractDatabaseManagerTest.java | 356 +++ .../db/jdbc/AbstractJdbcAppenderTest.java | 20 +- .../db/jdbc/DataSourceConnectionSourceTest.java | 17 +- .../jdbc/FactoryMethodConnectionSourceTest.java | 53 +-- .../log4j/core/lookup/Log4jLookupTest.java | 33 +- .../core/lookup/Log4jLookupWithSpacesTest.java | 35 +- log4j-iostreams/pom.xml | 4 +- .../io/AbstractLoggerOutputStreamTest.java | 15 +- .../log4j/io/AbstractLoggerWriterTest.java | 15 +- log4j-nosql/pom.xml | 5 +- .../log4j/nosql/appender/NoSqlAppenderTest.java | 30 +- .../appender/NoSqlDatabaseManagerTest.java | 434 ++- log4j-web/pom.xml | 4 +- .../Log4jServletContainerInitializerTest.java | 164 +++ .../web/Log4jServletContextListenerTest.java| 58 +-- .../log4j/web/Log4jServletFilterTest.java | 114 ++--- .../log4j/web/Log4jWebInitializerImplTest.java | 367 pom.xml | 7 +- src/changes/changes.xml | 3 + 22 files changed, 658 insertions(+), 1252 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/78c6a1fc/log4j-core/pom.xml -- diff --git a/log4j-core/pom.xml b/log4j-core/pom.xml index 2fbc78c..5cda105 100644 --- a/log4j-core/pom.xml +++ b/log4j-core/pom.xml @@ -203,8 +203,8 @@ - org.easymock - easymock + org.mockito + mockito-core test http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/78c6a1fc/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java index 87aef83..c53eb43 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java @@ -27,22 +27,25 @@ import org.apache.logging.log4j.core.impl.Log4jLogEvent; import org.apache.logging.log4j.core.layout.PatternLayout; import org.apache.logging.log4j.message.SimpleMessage; import org.apache.logging.log4j.util.Strings; -import org.easymock.EasyMockSupport; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; -import static org.easymock.EasyMock.anyInt; -import static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.expectLastCall; import static org.junit.Assert.*; - +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.BDDMockito.then; +import static org.mockito.Mockito.atLeastOnce; /** * */ +@RunWith(MockitoJUnitRunner.class) public class ConsoleAppenderTest { private static final String LOG4J_SKIP_JANSI = "log4j.skipJansi"; @@ -59,15 +62,12 @@ public class ConsoleAppenderTest { ByteArrayOutputStream baos; -EasyMockSupport mocks; - +@Mock PrintStream psMock; @Before public void before() { System.setProperty(LOG4J_SKIP_JANSI, "true"); -mocks = new EasyMockSupport(); -psMock = mocks.createMock("psMock", PrintStream.class); baos = new ByteArrayOutputStream(); } @@ -90,12 +90,6 @@ public class ConsoleAppenderTest { private void
[6/8] logging-log4j2 git commit: Fix version number in changelog
Fix version number in changelog Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/6ffcd1e2 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/6ffcd1e2 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/6ffcd1e2 Branch: refs/heads/LOG4J2-1645 Commit: 6ffcd1e2c09c619460779b970c14e15ec5c73cfb Parents: 78c6a1f Author: Matt SickerAuthored: Sun Oct 23 17:07:57 2016 -0500 Committer: Matt Sicker Committed: Sun Oct 23 17:07:57 2016 -0500 -- src/changes/changes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6ffcd1e2/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 56bf22f..d9bb156 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -40,7 +40,7 @@ Update JeroMQ from 0.3.5 to 0.3.6. -Update Commons Lang from 3.4 to 4.5. +Update Commons Lang from 3.4 to 3.5. Migrate to Mockito 2.x in unit tests.
[2/8] logging-log4j2 git commit: Remove extra blank line.
Remove extra blank line. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d5e45785 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d5e45785 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d5e45785 Branch: refs/heads/LOG4J2-1645 Commit: d5e45785dbbae575a67f55db9b1d7bca96774c7e Parents: 7114c91 Author: Gary GregoryAuthored: Fri Oct 21 21:13:43 2016 -0700 Committer: Gary Gregory Committed: Fri Oct 21 21:13:43 2016 -0700 -- pom.xml | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d5e45785/pom.xml -- diff --git a/pom.xml b/pom.xml index fd49ff7..66b3bf7 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,4 @@ -
[8/8] logging-log4j2 git commit: Remove EmptyStringMap class
Remove EmptyStringMap 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/c9bdbb73 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c9bdbb73 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c9bdbb73 Branch: refs/heads/LOG4J2-1645 Commit: c9bdbb73d757e48afa4fb992b52012ff6b6953ec Parents: 8f3dee3 Author: Mikael StåldalAuthored: Mon Oct 24 10:14:45 2016 +0200 Committer: Mikael Ståldal Committed: Mon Oct 24 10:14:45 2016 +0200 -- .../CopyOnWriteSortedArrayThreadContextMap.java | 8 +- .../log4j/util/EmptyFrozenStringMap.java| 105 --- .../log4j/core/impl/ContextDataFactory.java | 10 +- .../org/apache/logging/slf4j/MDCContextMap.java | 8 +- 4 files changed, 18 insertions(+), 113 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c9bdbb73/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java index cd6d707..2530dff 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java @@ -20,7 +20,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.apache.logging.log4j.util.EmptyFrozenStringMap; import org.apache.logging.log4j.util.ReadOnlyStringMap; import org.apache.logging.log4j.util.SortedArrayStringMap; import org.apache.logging.log4j.util.StringMap; @@ -53,6 +52,11 @@ class CopyOnWriteSortedArrayThreadContextMap implements ThreadContextMap2, CopyO */ protected static final String PROPERTY_NAME_INITIAL_CAPACITY = "log4j2.ThreadContext.initial.capacity"; +private static final StringMap EMPTY_CONTEXT_DATA = new SortedArrayStringMap(1); +static { +EMPTY_CONTEXT_DATA.freeze(); +} + private final ThreadLocal localMap; public CopyOnWriteSortedArrayThreadContextMap() { @@ -164,7 +168,7 @@ class CopyOnWriteSortedArrayThreadContextMap implements ThreadContextMap2, CopyO @Override public StringMap getReadOnlyContextData() { final StringMap map = localMap.get(); -return map == null ? EmptyFrozenStringMap.INSTANCE : map; +return map == null ? EMPTY_CONTEXT_DATA : map; } @Override http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c9bdbb73/log4j-api/src/main/java/org/apache/logging/log4j/util/EmptyFrozenStringMap.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/EmptyFrozenStringMap.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/EmptyFrozenStringMap.java deleted file mode 100644 index b0a3ff8..000 --- a/log4j-api/src/main/java/org/apache/logging/log4j/util/EmptyFrozenStringMap.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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.util; - -import java.util.Collections; -import java.util.Map; - -/** - * Consider this class private. - * Empty pre-frozen implementation of the {@link StringMap} interface. - * - * @since 2.7.1 - */ -public class EmptyFrozenStringMap implements StringMap { - -/** - * Singleton instance. - */ -public static final EmptyFrozenStringMap INSTANCE = new EmptyFrozenStringMap(); - -private static final String FROZEN = "Frozen collection cannot be modified"; - -/** - * Private default constructor to enforce singleton. - */ -private EmptyFrozenStringMap() { -} - -@Override -public Map toMap() { -return
[1/8] logging-log4j2 git commit: [LOG4J2-1644] Inefficient locking in AbstractLoggerAdapter.
Repository: logging-log4j2 Updated Branches: refs/heads/LOG4J2-1645 a2a78643b -> c9bdbb73d [LOG4J2-1644] Inefficient locking in AbstractLoggerAdapter. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7114c91c Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7114c91c Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7114c91c Branch: refs/heads/LOG4J2-1645 Commit: 7114c91cc6e974cb5a7627dd9646143143366c81 Parents: 22369cc Author: Tim GokcenAuthored: Fri Oct 21 13:02:59 2016 -0700 Committer: Gary Gregory Committed: Fri Oct 21 13:02:59 2016 -0700 -- .../log4j/spi/AbstractLoggerAdapter.java| 31 - .../logging/log4j/spi/LoggerAdapterTest.java| 126 +++ src/changes/changes.xml | 3 + 3 files changed, 154 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7114c91c/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java index 3c6c84f..33c8745 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java @@ -20,6 +20,8 @@ import java.util.Map; import java.util.WeakHashMap; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.util.LoaderUtil; @@ -37,6 +39,8 @@ public abstract class AbstractLoggerAdapter implements LoggerAdapter { */ protected final Map > registry = new WeakHashMap<>(); +private final ReadWriteLock lock = new ReentrantReadWriteLock (true); + @Override public L getLogger(final String name) { final LoggerContext context = getContext(); @@ -56,13 +60,28 @@ public abstract class AbstractLoggerAdapter implements LoggerAdapter { * @return the map of loggers for the given LoggerContext */ public ConcurrentMap getLoggersInContext(final LoggerContext context) { -synchronized (registry) { -ConcurrentMap loggers = registry.get(context); -if (loggers == null) { -loggers = new ConcurrentHashMap<>(); -registry.put(context, loggers); -} +ConcurrentMap loggers; +lock.readLock ().lock (); +try { +loggers = registry.get (context); +} finally { +lock.readLock ().unlock (); +} + +if (loggers != null) { return loggers; +} else { +lock.writeLock ().lock (); +try { +loggers = registry.get (context); +if (loggers == null) { +loggers = new ConcurrentHashMap<> (); +registry.put (context, loggers); +} +return loggers; +} finally { +lock.writeLock ().unlock (); +} } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7114c91c/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java -- diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java new file mode 100644 index 000..b04fe6f --- /dev/null +++ b/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java @@ -0,0 +1,126 @@ +/* + * 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
[28/50] [abbrv] logging-log4j2 git commit: Javadoc: Use the active voice.
Javadoc: Use the active voice. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/1e322e4f Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/1e322e4f Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/1e322e4f Branch: refs/heads/LOG4J2-1390 Commit: 1e322e4f2b51dc72f12eafea9e12335c65f59e59 Parents: ce86130 Author: Gary GregoryAuthored: Wed Oct 5 11:29:11 2016 -0700 Committer: Gary Gregory Committed: Wed Oct 5 11:29:11 2016 -0700 -- .../java/org/apache/logging/log4j/core/util/CyclicBuffer.java| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/1e322e4f/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CyclicBuffer.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CyclicBuffer.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CyclicBuffer.java index 35b7eb5..0edc65e 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CyclicBuffer.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CyclicBuffer.java @@ -31,7 +31,7 @@ public final class CyclicBuffer { private final Class clazz; /** - * Instantiate a new CyclicBuffer of at most maxSize events. + * Instantiates a new CyclicBuffer of at most maxSize events. * @param clazz The Class associate with the type of object in the buffer. * @param size The number of items in the buffer. * @throws IllegalArgumentException if the size is negative. @@ -50,7 +50,7 @@ public final class CyclicBuffer { } /** - * Add an item as the last event in the buffer. + * Adds an item as the last event in the buffer. * @param item The item to add to the buffer. */ public synchronized void add(final T item) {
[22/50] [abbrv] logging-log4j2 git commit: LOG4J2-1623 Configurable JVM shutdown hook timeout
LOG4J2-1623 Configurable JVM shutdown hook timeout Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/705e2725 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/705e2725 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/705e2725 Branch: refs/heads/LOG4J2-1390 Commit: 705e27253ca14cdf0e50039cada041065e308aee Parents: 3176c96 Author: Mikael StåldalAuthored: Mon Oct 3 18:54:27 2016 +0200 Committer: Mikael Ståldal Committed: Mon Oct 3 18:54:27 2016 +0200 -- .../logging/log4j/core/LoggerContext.java | 9 ++-- .../core/config/AbstractConfiguration.java | 10 + .../log4j/core/config/Configuration.java| 2 + .../builder/api/ConfigurationBuilder.java | 7 .../config/builder/impl/BuiltConfiguration.java | 4 ++ .../impl/DefaultConfigurationBuilder.java | 14 +++ .../composite/CompositeConfiguration.java | 2 + .../core/config/json/JsonConfiguration.java | 9 ++-- .../PropertiesConfigurationBuilder.java | 3 ++ .../log4j/core/config/xml/XmlConfiguration.java | 3 +- .../core/ShutdownTimeoutConfigurationTest.java | 44 .../builder/ConfigurationBuilderTest.java | 5 ++- .../resources/log4j-test-shutdownTimeout.xml| 38 + src/changes/changes.xml | 5 +++ src/site/xdoc/manual/configuration.xml.vm | 8 +++- 15 files changed, 151 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/705e2725/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java index 7e13963..c964965 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java @@ -16,8 +16,6 @@ */ package org.apache.logging.log4j.core; -import static org.apache.logging.log4j.core.util.ShutdownCallbackRegistry.SHUTDOWN_HOOK_MARKER; - import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; @@ -38,7 +36,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.ConfigurationFactory; import org.apache.logging.log4j.core.config.ConfigurationListener; -import org.apache.logging.log4j.core.config.ConfigurationSource; // SUPPRESS CHECKSTYLE +import org.apache.logging.log4j.core.config.ConfigurationSource; import org.apache.logging.log4j.core.config.DefaultConfiguration; import org.apache.logging.log4j.core.config.NullConfiguration; import org.apache.logging.log4j.core.config.Reconfigurable; @@ -56,6 +54,8 @@ import org.apache.logging.log4j.spi.LoggerRegistry; import org.apache.logging.log4j.spi.Terminable; import org.apache.logging.log4j.util.PropertiesUtil; +import static org.apache.logging.log4j.core.util.ShutdownCallbackRegistry.SHUTDOWN_HOOK_MARKER; + /** * The LoggerContext is the anchor for the logging system. It maintains a list of all the loggers requested by * applications and a reference to the Configuration. The Configuration will contain the configured loggers, appenders, @@ -265,6 +265,7 @@ public class LoggerContext extends AbstractLifeCycle if (factory instanceof ShutdownCallbackRegistry) { LOGGER.debug(SHUTDOWN_HOOK_MARKER, "Shutdown hook enabled. Registering a new one."); try { +final long shutdownTimeoutMillis = this.configuration.getShutdownTimeoutMillis(); this.shutdownCallback = ((ShutdownCallbackRegistry) factory).addShutdownCallback(new Runnable() { @Override public void run() { @@ -272,7 +273,7 @@ public class LoggerContext extends AbstractLifeCycle final LoggerContext context = LoggerContext.this; LOGGER.debug(SHUTDOWN_HOOK_MARKER, "Stopping LoggerContext[name={}, {}]", context.getName(), context); -context.stop(); +context.stop(shutdownTimeoutMillis, TimeUnit.MILLISECONDS); } @Override http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/705e2725/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
[47/50] [abbrv] logging-log4j2 git commit: Migrate unit tests to Mockito 2.x
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/78c6a1fc/log4j-web/src/test/java/org/apache/logging/log4j/web/Log4jServletContainerInitializerTest.java -- diff --git a/log4j-web/src/test/java/org/apache/logging/log4j/web/Log4jServletContainerInitializerTest.java b/log4j-web/src/test/java/org/apache/logging/log4j/web/Log4jServletContainerInitializerTest.java index a4e6a6c..0cd3988 100644 --- a/log4j-web/src/test/java/org/apache/logging/log4j/web/Log4jServletContainerInitializerTest.java +++ b/log4j-web/src/test/java/org/apache/logging/log4j/web/Log4jServletContainerInitializerTest.java @@ -24,156 +24,125 @@ import javax.servlet.FilterRegistration; import javax.servlet.ServletContext; import org.apache.logging.log4j.util.Strings; -import org.easymock.Capture; -import org.easymock.EasyMock; -import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; -import static org.easymock.EasyMock.capture; -import static org.easymock.EasyMock.createStrictMock; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.expectLastCall; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.mock; +@RunWith(MockitoJUnitRunner.class) public class Log4jServletContainerInitializerTest { +@Mock private ServletContext servletContext; +@Mock private Log4jWebLifeCycle initializer; +@Captor +private ArgumentCaptorfilterCaptor; +@Captor +private ArgumentCaptor listenerCaptor; private Log4jServletContainerInitializer containerInitializer; @Before public void setUp() { -this.servletContext = createStrictMock(ServletContext.class); -this.initializer = createStrictMock(Log4jWebLifeCycle.class); - this.containerInitializer = new Log4jServletContainerInitializer(); } -@After -public void tearDown() { -verify(this.servletContext, this.initializer); -} - @Test public void testOnStartupWithServletVersion2_x() throws Exception { -expect(this.servletContext.getMajorVersion()).andReturn(2); - -replay(this.servletContext, this.initializer); +given(servletContext.getMajorVersion()).willReturn(2); this.containerInitializer.onStartup(null, this.servletContext); } @Test public void testOnStartupWithServletVersion3_xEffectiveVersion2_x() throws Exception { -expect(this.servletContext.getMajorVersion()).andReturn(3); -expect(this.servletContext.getEffectiveMajorVersion()).andReturn(2); - -replay(this.servletContext, this.initializer); +given(servletContext.getMajorVersion()).willReturn(3); +given(servletContext.getEffectiveMajorVersion()).willReturn(2); this.containerInitializer.onStartup(null, this.servletContext); } @Test public void testOnStartupWithServletVersion3_xEffectiveVersion3_xDisabledTrue() throws Exception { -expect(this.servletContext.getMajorVersion()).andReturn(3); -expect(this.servletContext.getEffectiveMajorVersion()).andReturn(3); - expect(this.servletContext.getInitParameter(Log4jWebSupport.IS_LOG4J_AUTO_INITIALIZATION_DISABLED)) -.andReturn("true"); - -replay(this.servletContext, this.initializer); +given(servletContext.getMajorVersion()).willReturn(3); +given(servletContext.getEffectiveMajorVersion()).willReturn(3); + given(servletContext.getInitParameter(eq(Log4jWebSupport.IS_LOG4J_AUTO_INITIALIZATION_DISABLED))).willReturn( +"true"); this.containerInitializer.onStartup(null, this.servletContext); } @Test public void testOnStartupWithServletVersion3_xEffectiveVersion3_xDisabledTRUE() throws Exception { -expect(this.servletContext.getMajorVersion()).andReturn(3); -expect(this.servletContext.getEffectiveMajorVersion()).andReturn(3); - expect(this.servletContext.getInitParameter(Log4jWebSupport.IS_LOG4J_AUTO_INITIALIZATION_DISABLED)) -.andReturn("TRUE"); - -replay(this.servletContext, this.initializer); +given(servletContext.getMajorVersion()).willReturn(3); +given(servletContext.getEffectiveMajorVersion()).willReturn(3); + given(servletContext.getInitParameter(eq(Log4jWebSupport.IS_LOG4J_AUTO_INITIALIZATION_DISABLED))).willReturn( +"TRUE");
[35/50] [abbrv] logging-log4j2 git commit: Javadoc: Use the active voice.
Javadoc: Use the active voice. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/eed7c071 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/eed7c071 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/eed7c071 Branch: refs/heads/LOG4J2-1390 Commit: eed7c07182384a7530268891d2b26a0368181eaa Parents: 118abf4 Author: Gary GregoryAuthored: Fri Oct 7 15:15:43 2016 -0700 Committer: Gary Gregory Committed: Fri Oct 7 15:15:43 2016 -0700 -- .../java/org/apache/logging/log4j/core/layout/HtmlLayout.java| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/eed7c071/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java index 2acf335..6cd64d3 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java @@ -132,7 +132,7 @@ public final class HtmlLayout extends AbstractStringLayout { } /** - * Format as a String. + * Formats as a String. * * @param event The Logging Event. * @return A String containing the LogEvent as HTML. @@ -325,7 +325,7 @@ public final class HtmlLayout extends AbstractStringLayout { } /** - * Create an HTML Layout. + * Creates an HTML Layout. * @param locationInfo If "true", location information will be included. The default is false. * @param title The title to include in the file header. If none is specified the default title will be used. * @param contentType The content type. Defaults to "text/html".
[21/50] [abbrv] logging-log4j2 git commit: [maven-release-plugin] prepare for next development iteration
[maven-release-plugin] prepare for next development iteration Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3176c96d Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3176c96d Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3176c96d Branch: refs/heads/LOG4J2-1390 Commit: 3176c96d96360d9702751d941f82832d8ff9030a Parents: 29cfc80 Author: rgoersAuthored: Sun Oct 2 11:13:19 2016 -0700 Committer: rgoers Committed: Sun Oct 2 11:13:19 2016 -0700 -- log4j-1.2-api/pom.xml | 2 +- log4j-api-scala_2.10/pom.xml | 2 +- log4j-api-scala_2.11/pom.xml | 2 +- log4j-api/pom.xml | 2 +- log4j-bom/pom.xml | 4 ++-- log4j-core/pom.xml | 2 +- log4j-distribution/pom.xml | 2 +- log4j-flume-ng/pom.xml | 2 +- log4j-iostreams/pom.xml| 2 +- log4j-jcl/pom.xml | 2 +- log4j-jmx-gui/pom.xml | 2 +- log4j-jul/pom.xml | 2 +- log4j-liquibase/pom.xml| 2 +- log4j-nosql/pom.xml| 2 +- log4j-perf/pom.xml | 2 +- log4j-samples/configuration/pom.xml| 2 +- log4j-samples/flume-common/pom.xml | 2 +- log4j-samples/flume-embedded/pom.xml | 2 +- log4j-samples/flume-remote/pom.xml | 2 +- log4j-samples/loggerProperties/pom.xml | 2 +- log4j-samples/pom.xml | 2 +- log4j-samples/scala-api/pom.xml| 2 +- log4j-slf4j-impl/pom.xml | 2 +- log4j-taglib/pom.xml | 2 +- log4j-to-slf4j/pom.xml | 2 +- log4j-web/pom.xml | 2 +- pom.xml| 4 ++-- 27 files changed, 29 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3176c96d/log4j-1.2-api/pom.xml -- diff --git a/log4j-1.2-api/pom.xml b/log4j-1.2-api/pom.xml index 2704c5b..98b6716 100644 --- a/log4j-1.2-api/pom.xml +++ b/log4j-1.2-api/pom.xml @@ -20,7 +20,7 @@ org.apache.logging.log4j log4j -2.7 +2.7.1-SNAPSHOT ../ log4j-1.2-api http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3176c96d/log4j-api-scala_2.10/pom.xml -- diff --git a/log4j-api-scala_2.10/pom.xml b/log4j-api-scala_2.10/pom.xml index c11b66b..46edf74 100644 --- a/log4j-api-scala_2.10/pom.xml +++ b/log4j-api-scala_2.10/pom.xml @@ -20,7 +20,7 @@ org.apache.logging.log4j log4j -2.7 +2.7.1-SNAPSHOT ../ log4j-api-scala_2.10 http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3176c96d/log4j-api-scala_2.11/pom.xml -- diff --git a/log4j-api-scala_2.11/pom.xml b/log4j-api-scala_2.11/pom.xml index f8b5288..4a7ba19 100644 --- a/log4j-api-scala_2.11/pom.xml +++ b/log4j-api-scala_2.11/pom.xml @@ -20,7 +20,7 @@ org.apache.logging.log4j log4j -2.7 +2.7.1-SNAPSHOT ../ log4j-api-scala_2.11 http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3176c96d/log4j-api/pom.xml -- diff --git a/log4j-api/pom.xml b/log4j-api/pom.xml index 9f0b641..debeb2f 100644 --- a/log4j-api/pom.xml +++ b/log4j-api/pom.xml @@ -20,7 +20,7 @@ org.apache.logging.log4j log4j -2.7 +2.7.1-SNAPSHOT ../ log4j-api http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3176c96d/log4j-bom/pom.xml -- diff --git a/log4j-bom/pom.xml b/log4j-bom/pom.xml index f3f8540..34745c4 100644 --- a/log4j-bom/pom.xml +++ b/log4j-bom/pom.xml @@ -26,7 +26,7 @@ Apache Log4j Bill of Materials org.apache.logging.log4j log4j-bom - 2.7 + 2.7.1-SNAPSHOT pom @@ -143,6 +143,6 @@ -log4j-2.7-rc2 +log4j-2.6.1 http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3176c96d/log4j-core/pom.xml -- diff --git a/log4j-core/pom.xml b/log4j-core/pom.xml index 4774f50..2fbc78c 100644 --- a/log4j-core/pom.xml +++ b/log4j-core/pom.xml @@ -20,7 +20,7 @@ org.apache.logging.log4j log4j -2.7 +2.7.1-SNAPSHOT ../ log4j-core http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3176c96d/log4j-distribution/pom.xml -- diff --git a/log4j-distribution/pom.xml
[01/50] [abbrv] logging-log4j2 git commit: Use Appender.ELEMENT_TYPE instead of magic string.
Repository: logging-log4j2 Updated Branches: refs/heads/LOG4J2-1390 3fac1c7e9 -> 39e283369 Use Appender.ELEMENT_TYPE instead of magic string. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/5aa0313d Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/5aa0313d Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/5aa0313d Branch: refs/heads/LOG4J2-1390 Commit: 5aa0313dbf4899c0f2c95bb86e3b9a0c8e2b14e6 Parents: e48898d Author: Gary GregoryAuthored: Wed Sep 28 11:22:53 2016 -0700 Committer: Gary Gregory Committed: Wed Sep 28 11:22:53 2016 -0700 -- .../org/apache/logging/log4j/core/appender/AppenderSet.java | 2 +- .../apache/logging/log4j/core/appender/AsyncAppender.java | 2 +- .../apache/logging/log4j/core/appender/ConsoleAppender.java | 3 ++- .../logging/log4j/core/appender/CountingNoOpAppender.java | 3 ++- .../logging/log4j/core/appender/FailoverAppender.java | 2 +- .../apache/logging/log4j/core/appender/FileAppender.java| 3 ++- .../log4j/core/appender/MemoryMappedFileAppender.java | 3 ++- .../apache/logging/log4j/core/appender/NullAppender.java| 3 ++- .../logging/log4j/core/appender/OutputStreamAppender.java | 3 ++- .../log4j/core/appender/RandomAccessFileAppender.java | 3 ++- .../logging/log4j/core/appender/RollingFileAppender.java| 3 ++- .../core/appender/RollingRandomAccessFileAppender.java | 3 ++- .../logging/log4j/core/appender/ScriptAppenderSelector.java | 2 +- .../apache/logging/log4j/core/appender/SmtpAppender.java| 3 ++- .../apache/logging/log4j/core/appender/SocketAppender.java | 3 ++- .../apache/logging/log4j/core/appender/SyslogAppender.java | 3 ++- .../apache/logging/log4j/core/appender/WriterAppender.java | 3 ++- .../logging/log4j/core/appender/db/jdbc/JdbcAppender.java | 3 ++- .../logging/log4j/core/appender/db/jpa/JpaAppender.java | 3 ++- .../log4j/core/appender/rewrite/RewriteAppender.java| 2 +- .../log4j/core/appender/routing/RoutingAppender.java| 4 ++-- .../config/properties/PropertiesConfigurationBuilder.java | 3 ++- .../apache/logging/log4j/core/appender/HangingAppender.java | 9 + .../logging/log4j/test/appender/AlwaysFailAppender.java | 3 ++- .../logging/log4j/test/appender/BlockingAppender.java | 3 ++- .../logging/log4j/test/appender/DeadlockAppender.java | 3 ++- .../logging/log4j/test/appender/FailOnceAppender.java | 3 ++- .../apache/logging/log4j/test/appender/ListAppender.java| 3 ++- .../logging/log4j/test/appender/UsesLoggingAppender.java| 3 ++- .../apache/logging/log4j/flume/appender/FlumeAppender.java | 3 ++- .../apache/logging/log4j/nosql/appender/NoSqlAppender.java | 3 ++- 31 files changed, 60 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5aa0313d/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderSet.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderSet.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderSet.java index 4eed071..0aa6e35 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderSet.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderSet.java @@ -120,7 +120,7 @@ public class AppenderSet { return null; } node.getAttributes().put("name", actualName); -if (node.getType().getElementName().equals("appender")) { +if (node.getType().getElementName().equals(Appender.ELEMENT_TYPE)) { final Node appNode = new Node(node); configuration.createConfiguration(appNode, null); if (appNode.getObject() instanceof Appender) { http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5aa0313d/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AsyncAppender.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AsyncAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AsyncAppender.java index e6f7039..436664c 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AsyncAppender.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AsyncAppender.java @@ -54,7 +54,7 @@ import org.apache.logging.log4j.core.util.Log4jThread; * Appender to append to if the queue is full. The AsyncAppender does not allow a filter to be specified on the Appender * references. */ -@Plugin(name = "Async", category = "Core",
[41/50] [abbrv] logging-log4j2 git commit: Merge branch 'master' into LOG4J2-1623
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/19418b37/src/changes/changes.xml -- diff --cc src/changes/changes.xml index 6bd144c,d935048..2922511 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@@ -1,3090 -1,3096 +1,3099 @@@ - - - -http://maven.apache.org/changes/1.0.0; - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd;> - -Changes - - - - -Console Appender does not pick up Oracle Java 8's sun.stdout.encoding and sun.stderr.encoding. - - -Fix MemoryMappedFileAppender.createAppender() Javadoc for immediateFlush. - - -Update JeroMQ from 0.3.5 to 0.3.6. - - - - -Fixed ClassCastException when using JUL logging during shutdown. - - -2.7-rc1: RollingFileAppender immediateFlush default value should be true, not false. - - -Improved performance of context data injector for web applications to be on par with standalone applications. - - -Introduced new interface LifeCycle2 with stop(long,TimeUnit) method to avoid breaking backwards compatibility with new Configurator.shutdown(LoggerContext, long, TimeUnit) API. - - -Fixed issue with filters extending AbstractFilter that did not override methods with unrolled varargs. - - -Fixed scrambled log messages triggered by nested logging from toString() method of a logging parameter object. - - -Log4j threads are no longer leaking on Tomcat shutdown. - - -When starting on Google App Engine, Interpolator now suppresses the NoClassDefFoundError stack trace for the jvmrunargs lookup. - - -When initializing on platforms where JMX is not available, Interpolator component no longer prints stack trace for warning messages. - - -Unregistering JMX components no longer prints a stack trace when the MBean has already been unregistered. - - -Support Property values to be specified in configuration as a value attribute as well as an element. - - -(GC) LoggerConfig now stores configuration properties in a List, not a Map to prevent creating temporary Iterator objects. Added method LoggerConfig#getPropertyList(), deprecated method #getProperties(). - - -Fixed class loader deadlock when using async logging and extended stack trace pattern. - - -Fix to prevent Log4j 2.6.2 and higher from losing exceptions when a security manager is present. - - -Fixed issue where LogEvent.getContextStack() returned null. - - -Prevent deadlock in Async Loggers when queue is full and logged Object's toString() logs another message. - - -Prevent ArrayIndexOutOfBoundsException in ParameterizedMessage.formatTo for single-char or empty messages. - - -Fixed issue where AsyncLoggerContextSelector+PropertiesConfigurationBuilder defaulted to includeLocation=true. - - -Prevent SocketAppender memory usage from growing unbounded if it cannot connect to a server. - - -Prevent NPE in Level.isInRange. - - -DynamicThresholdFilter filtered incorrectly when params were passed as individual arguments instead of varargs. - - -[CronTriggeringPolicy] ConfigurationScheduler scheduled the task infinitely after first fire. - - -Log4j should not unregister JMX MBeans when log4j2.disable.jmx property is true. - - -Log4j2 should postpone creating log file until the appender actually receives an event. - - -Support loading custom plugins from jar files and directories whose classpath entries use the "vfs" URL protocol. - - -Fix file handle resource leak in XmlConfiguration.XmlConfiguration(ConfigurationSource). - - -Prevent NPE when dynamically removing filters. - - -Attributes were not merged properly in composite configurations. - - -Attributes were not merged properly in composite configurations. - - -Prevent NPE in RingBufferLogEvent.getFormattedMessage() when used in web applications. - - -Added ability to disable (date) lookup completely for compatibility with other libraries like Camel. - - -Added support for setting StatusLogger destination in ConfigurationBuilder. - - -Allow comma separated agents, host list to be passed to
[15/50] [abbrv] logging-log4j2 git commit: [LOG4J2-1620] .7-rc1: RollingFileAppender immediateFlush default value should be true, not false. Add tests.
[LOG4J2-1620] .7-rc1: RollingFileAppender immediateFlush default value should be true, not false. Add 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/6bedc20e Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/6bedc20e Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/6bedc20e Branch: refs/heads/LOG4J2-1390 Commit: 6bedc20e375a54b7887ebff5b799f0612c314bf2 Parents: 003cada Author: Gary GregoryAuthored: Thu Sep 29 12:17:21 2016 -0700 Committer: Gary Gregory Committed: Thu Sep 29 12:17:21 2016 -0700 -- .../appender/ConsoleAppenderBuilderTest.java| 31 +++ .../core/appender/FileAppenderBuilderTest.java | 31 +++ .../appender/SocketAppenderBuilderTest.java | 32 .../rolling/RollingFileAppenderBuilderTest.java | 32 4 files changed, 126 insertions(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6bedc20e/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderBuilderTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderBuilderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderBuilderTest.java new file mode 100644 index 000..2531a31 --- /dev/null +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderBuilderTest.java @@ -0,0 +1,31 @@ +/* + * 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.appender; + +import org.junit.Assert; +import org.junit.Test; + +public class ConsoleAppenderBuilderTest { + +/** + * Tests https://issues.apache.org/jira/browse/LOG4J2-1620 + */ +@Test +public void testDefaultImmediateFlush() { +Assert.assertTrue(ConsoleAppender.newBuilder().isImmediateFlush()); +} +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6bedc20e/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderBuilderTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderBuilderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderBuilderTest.java new file mode 100644 index 000..8305a07 --- /dev/null +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderBuilderTest.java @@ -0,0 +1,31 @@ +/* + * 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.appender; + +import org.junit.Assert; +import org.junit.Test; + +public class FileAppenderBuilderTest { + +/** + * Tests https://issues.apache.org/jira/browse/LOG4J2-1620 + */ +@Test +public void testDefaultImmediateFlush() { +Assert.assertTrue(FileAppender.newBuilder().isImmediateFlush()); +} +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6bedc20e/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SocketAppenderBuilderTest.java
[32/50] [abbrv] logging-log4j2 git commit: Merge branch 'master' into LOG4J2-1623
Merge branch 'master' into LOG4J2-1623 Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3064471e Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3064471e Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3064471e Branch: refs/heads/LOG4J2-1390 Commit: 3064471eaa1b7f7d3c5e38349281e1ccdd054cfa Parents: c92c327 2da9dfa Author: Mikael StåldalAuthored: Thu Oct 6 13:29:28 2016 +0200 Committer: Mikael Ståldal Committed: Thu Oct 6 13:29:28 2016 +0200 -- log4j-bom/pom.xml| 4 .../main/java/org/apache/logging/log4j/core/LoggerContext.java | 2 +- .../java/org/apache/logging/log4j/core/util/CyclicBuffer.java| 4 ++-- .../org/apache/logging/log4j/core/util/ExecutorServices.java | 4 ++-- src/site/site.xml| 1 + src/site/xdoc/javadoc.xml| 4 6 files changed, 10 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3064471e/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java --
[19/50] [abbrv] logging-log4j2 git commit: Prepare for release
Prepare for release Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d7f1919f Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d7f1919f Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d7f1919f Branch: refs/heads/LOG4J2-1390 Commit: d7f1919f239422dcc494c70a542e3f19c60c00b4 Parents: d5269df Author: rgoersAuthored: Sun Oct 2 10:52:35 2016 -0700 Committer: rgoers Committed: Sun Oct 2 10:52:35 2016 -0700 -- RELEASE-NOTES.txt | 3 +++ src/changes/changes.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d7f1919f/RELEASE-NOTES.txt -- diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index a668cf4..13d7fda 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -69,6 +69,8 @@ o LOG4J2-1540: The Core AbstractManager now tracks its LoggerContext. o LOG4J2-1577: Add a Builder to the RoutingAppender and deprecate factory method. Fixed Bugs: +o LOG4J2-1618: Fixed ClassCastException when using JUL logging during shutdown. Thanks to Raman Gupta. +o LOG4J2-1620: 2.7-rc1: RollingFileAppender immediateFlush default value should be true, not false. Thanks to Sascha Scholz. o LOG4J2-1611: Improved performance of context data injector for web applications to be on par with standalone applications. o LOG4J2-1591: Introduced new interface LifeCycle2 with stop(long,TimeUnit) method to avoid breaking backwards compatibility with new Configurator.shutdown(LoggerContext, long, TimeUnit) API. o LOG4J2-1590: Fixed issue with filters extending AbstractFilter that did not override methods with unrolled varargs. @@ -121,6 +123,7 @@ o LOG4J2-1601: Prevent potential NPE due to org.apache.logging.log4j.core.layou o LOG4J2-1602: Prevent potential NPE in org.apache.logging.log4j.core.util.datetime.FormatCache.MultipartKey.equals(Object) when object is null. o LOG4J2-1603: Redo hashCode() and equals() methods in org.apache.logging.log4j.core.net.ssl classes. o LOG4J2-1610: Add targetNamespace to log4j-config.xsd. GitHub #43. Thanks to Shubhankar. +o LOG4J2-1619: new Log4jLogEvent().toString() throws an NPE. Changes: o LOG4J2-1604: Log4j2 TcpSocketServer in background. Thanks to Colin Hillman. http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d7f1919f/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index a304ac7..cd2f379 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -23,7 +23,7 @@ Changes - + Fixed ClassCastException when using JUL logging during shutdown.
[25/50] [abbrv] logging-log4j2 git commit: Merge branch 'master' into LOG4J2-1623
Merge branch 'master' into LOG4J2-1623 Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/94465257 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/94465257 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/94465257 Branch: refs/heads/LOG4J2-1390 Commit: 94465257cc0e2c3645ce08a72c1dbb64b63ae282 Parents: 2153a26 ce86130 Author: Mikael StåldalAuthored: Wed Oct 5 13:01:28 2016 +0200 Committer: Mikael Ståldal Committed: Wed Oct 5 13:01:28 2016 +0200 -- BUILDING.txt | 4 1 file changed, 4 insertions(+) --
[49/50] [abbrv] logging-log4j2 git commit: Fix version number in changelog
Fix version number in changelog Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/6ffcd1e2 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/6ffcd1e2 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/6ffcd1e2 Branch: refs/heads/LOG4J2-1390 Commit: 6ffcd1e2c09c619460779b970c14e15ec5c73cfb Parents: 78c6a1f Author: Matt SickerAuthored: Sun Oct 23 17:07:57 2016 -0500 Committer: Matt Sicker Committed: Sun Oct 23 17:07:57 2016 -0500 -- src/changes/changes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6ffcd1e2/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 56bf22f..d9bb156 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -40,7 +40,7 @@ Update JeroMQ from 0.3.5 to 0.3.6. -Update Commons Lang from 3.4 to 4.5. +Update Commons Lang from 3.4 to 3.5. Migrate to Mockito 2.x in unit tests.
[42/50] [abbrv] logging-log4j2 git commit: Merge branch 'master' into LOG4J2-1623
Merge branch 'master' into LOG4J2-1623 # Conflicts: # src/changes/changes.xml Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/19418b37 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/19418b37 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/19418b37 Branch: refs/heads/LOG4J2-1390 Commit: 19418b37df948609a8852a17f206076048043f6f Parents: 6482da5 197997a Author: Mikael StåldalAuthored: Mon Oct 17 13:14:16 2016 +0200 Committer: Mikael Ståldal Committed: Mon Oct 17 13:14:16 2016 +0200 -- .../logging/log4j/util/PropertiesUtil.java | 597 ++- .../log4j/core/appender/AbstractAppender.java | 8 + .../log4j/core/appender/ConsoleAppender.java| 23 +- .../core/appender/MemoryMappedFileAppender.java | 2 +- .../logging/log4j/core/layout/HtmlLayout.java | 81 +-- .../logging/log4j/core/lookup/JndiLookup.java | 5 +- .../appender/ConsoleAppenderBuilderTest.java| 80 ++- pom.xml | 2 +- src/changes/changes.xml | 11 +- 9 files changed, 446 insertions(+), 363 deletions(-) --
[08/50] [abbrv] logging-log4j2 git commit: Minor format tweak.
Minor format tweak. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/60e47cb0 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/60e47cb0 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/60e47cb0 Branch: refs/heads/LOG4J2-1390 Commit: 60e47cb0781a4dbe27e6f127447a494bd7208703 Parents: 3a45025 Author: Gary GregoryAuthored: Wed Sep 28 19:39:14 2016 -0700 Committer: Gary Gregory Committed: Wed Sep 28 19:39:14 2016 -0700 -- log4j-jul/src/main/java/org/apache/logging/log4j/jul/Constants.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/60e47cb0/log4j-jul/src/main/java/org/apache/logging/log4j/jul/Constants.java -- diff --git a/log4j-jul/src/main/java/org/apache/logging/log4j/jul/Constants.java b/log4j-jul/src/main/java/org/apache/logging/log4j/jul/Constants.java index ad645b3..bc86410 100644 --- a/log4j-jul/src/main/java/org/apache/logging/log4j/jul/Constants.java +++ b/log4j-jul/src/main/java/org/apache/logging/log4j/jul/Constants.java @@ -29,6 +29,7 @@ public final class Constants { * {@code log4j-core}. */ public static final String LOGGER_ADAPTOR_PROPERTY = "log4j.jul.LoggerAdapter"; + /** * The Log4j property to set to a custom implementation of {@link org.apache.logging.log4j.jul.LevelConverter}. The specified class must have * a default constructor.
[04/50] [abbrv] logging-log4j2 git commit: [LOG4J2-1619] new Log4jLogEvent().toString() throws an NPE.
[LOG4J2-1619] new Log4jLogEvent().toString() throws an NPE. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/83cd00eb Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/83cd00eb Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/83cd00eb Branch: refs/heads/LOG4J2-1390 Commit: 83cd00eb611b9715c3a95961ad44b3ce4c69b5a4 Parents: e6781f5 Author: Gary GregoryAuthored: Wed Sep 28 16:14:15 2016 -0700 Committer: Gary Gregory Committed: Wed Sep 28 16:14:15 2016 -0700 -- .../org/apache/logging/log4j/core/impl/Log4jLogEventTest.java | 6 ++ 1 file changed, 6 insertions(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/83cd00eb/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventTest.java index 0199444..9f079ce 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventTest.java @@ -521,4 +521,10 @@ public class Log4jLogEventTest { assertNotEquals(reason, other, event); assertNotEquals(reason + " hashCode", other.hashCode(), event.hashCode()); } + +@Test +public void testToString() { +// Throws an NPE in 2.6.2 +assertNotNull(new Log4jLogEvent().toString()); +} }
[09/50] [abbrv] logging-log4j2 git commit: Stop the context to make sure all files are compressed and closed. Trying to remedy failures in CI builds.
Stop the context to make sure all files are compressed and closed. Trying to remedy failures in CI builds. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/560120bc Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/560120bc Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/560120bc Branch: refs/heads/LOG4J2-1390 Commit: 560120bc941d7bae6572a17980abbcd886364ba8 Parents: 60e47cb Author: Gary GregoryAuthored: Wed Sep 28 21:59:53 2016 -0700 Committer: Gary Gregory Committed: Wed Sep 28 21:59:53 2016 -0700 -- .../log4j/core/appender/rolling/RollingAppenderSizeTest.java | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/560120bc/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java index 4b28d20..addc42d 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java @@ -34,6 +34,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.Collection; +import java.util.concurrent.TimeUnit; import org.apache.commons.compress.compressors.CompressorException; import org.apache.commons.compress.compressors.CompressorInputStream; @@ -138,6 +139,8 @@ public class RollingAppenderSizeTest { || DefaultRolloverStrategy.FileExtensions.PACK200 == ext) { return; // Apache Commons Compress cannot deflate zip? TODO test decompressing these formats } +// Stop the context to make sure all files are compressed and closed. Trying to remedy failures in CI builds. +loggerContextRule.getLoggerContext().stop(30, TimeUnit.SECONDS); for (final File file : files) { if (file.getName().endsWith(fileExtension)) { CompressorInputStream in = null;
[46/50] [abbrv] logging-log4j2 git commit: Upgrade to Commons Lang 3.5
Upgrade to Commons Lang 3.5 Related to LOG4J2-1647. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/f3e9ea13 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/f3e9ea13 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/f3e9ea13 Branch: refs/heads/LOG4J2-1390 Commit: f3e9ea13fad1de7e2723f73cdf90810f62776ed2 Parents: d5e4578 Author: Matt SickerAuthored: Sun Oct 23 10:22:17 2016 -0500 Committer: Matt Sicker Committed: Sun Oct 23 10:22:17 2016 -0500 -- 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/f3e9ea13/pom.xml -- diff --git a/pom.xml b/pom.xml index 66b3bf7..be4d7e4 100644 --- a/pom.xml +++ b/pom.xml @@ -287,7 +287,7 @@ org.apache.commons commons-lang3 -3.4 +3.5 com.beust http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f3e9ea13/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 1c63572..4e0eb6e 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -39,6 +39,9 @@ Update JeroMQ from 0.3.5 to 0.3.6. + +Update Commons Lang from 3.4 to 4.5. +
[06/50] [abbrv] logging-log4j2 git commit: Refactor magic strings.
Refactor magic strings. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3a45025a Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3a45025a Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3a45025a Branch: refs/heads/LOG4J2-1390 Commit: 3a45025a09dc2ae07a4df4be5df1a767a20a0a34 Parents: 0e15ec3 Author: Gary GregoryAuthored: Wed Sep 28 19:10:43 2016 -0700 Committer: Gary Gregory Committed: Wed Sep 28 19:10:43 2016 -0700 -- --
[38/50] [abbrv] logging-log4j2 git commit: [LOG4J2-1639 ]Fix MemoryMappedFileAppender.createAppender() Javadoc for immediateFlush.
[LOG4J2-1639 ]Fix MemoryMappedFileAppender.createAppender() Javadoc for immediateFlush. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/fc0e07c2 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/fc0e07c2 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/fc0e07c2 Branch: refs/heads/LOG4J2-1390 Commit: fc0e07c23c23a1a12dd379a7c96cadf9d05f7d35 Parents: d65bf73 Author: ggregoryAuthored: Mon Oct 10 13:39:43 2016 -0700 Committer: ggregory Committed: Mon Oct 10 13:39:43 2016 -0700 -- .../logging/log4j/core/appender/MemoryMappedFileAppender.java | 2 +- src/changes/changes.xml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fc0e07c2/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppender.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppender.java index f12e8b2..1c8e0d2 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppender.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppender.java @@ -122,7 +122,7 @@ public final class MemoryMappedFileAppender extends AbstractOutputStreamAppender *"true". * @param name The name of the Appender. * @param immediateFlush "true" if the contents should be flushed on every write, "false" otherwise. The default is - *"true". + *"false". * @param regionLengthStr The buffer size, defaults to {@value MemoryMappedFileManager#DEFAULT_REGION_LENGTH}. * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise they *are propagated to the caller. http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fc0e07c2/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 659440d..3288f97 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -27,6 +27,9 @@ Console Appender does not pick up Oracle Java 8's sun.stdout.encoding and sun.stderr.encoding. + +Fix MemoryMappedFileAppender.createAppender() Javadoc for immediateFlush. +
[29/50] [abbrv] logging-log4j2 git commit: Fix ExecutorServices documentation and usage of timeout = 0
Fix ExecutorServices documentation and usage of timeout = 0 Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4df3a6b0 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4df3a6b0 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4df3a6b0 Branch: refs/heads/LOG4J2-1390 Commit: 4df3a6b051ff1c44b7fcf56cb9f1c63151564510 Parents: 1e322e4 Author: Mikael StåldalAuthored: Thu Oct 6 13:17:10 2016 +0200 Committer: Mikael Ståldal Committed: Thu Oct 6 13:17:10 2016 +0200 -- .../java/org/apache/logging/log4j/core/LoggerContext.java| 8 .../org/apache/logging/log4j/core/util/ExecutorServices.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4df3a6b0/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java index 7e13963..cc9ac38 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java @@ -16,8 +16,6 @@ */ package org.apache.logging.log4j.core; -import static org.apache.logging.log4j.core.util.ShutdownCallbackRegistry.SHUTDOWN_HOOK_MARKER; - import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; @@ -38,7 +36,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.ConfigurationFactory; import org.apache.logging.log4j.core.config.ConfigurationListener; -import org.apache.logging.log4j.core.config.ConfigurationSource; // SUPPRESS CHECKSTYLE +import org.apache.logging.log4j.core.config.ConfigurationSource; import org.apache.logging.log4j.core.config.DefaultConfiguration; import org.apache.logging.log4j.core.config.NullConfiguration; import org.apache.logging.log4j.core.config.Reconfigurable; @@ -56,6 +54,8 @@ import org.apache.logging.log4j.spi.LoggerRegistry; import org.apache.logging.log4j.spi.Terminable; import org.apache.logging.log4j.util.PropertiesUtil; +import static org.apache.logging.log4j.core.util.ShutdownCallbackRegistry.SHUTDOWN_HOOK_MARKER; + /** * The LoggerContext is the anchor for the logging system. It maintains a list of all the loggers requested by * applications and a reference to the Configuration. The Configuration will contain the configured loggers, appenders, @@ -336,7 +336,7 @@ public class LoggerContext extends AbstractLifeCycle final String source = "LoggerContext \'" + getName() + "\'"; shutdownEs = ExecutorServices.shutdown(executorService, timeout, timeUnit, source); // Do not wait for daemon threads -shutdownEsd = ExecutorServices.shutdown(executorServiceDeamons, -1, timeUnit, source); +shutdownEsd = ExecutorServices.shutdown(executorServiceDeamons, 0, timeUnit, source); } finally { configLock.unlock(); this.setStopped(); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4df3a6b0/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ExecutorServices.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ExecutorServices.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ExecutorServices.java index 4214c6f..37a44f5 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ExecutorServices.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ExecutorServices.java @@ -30,13 +30,13 @@ public class ExecutorServices { * Shuts down the given {@link ExecutorService} in an orderly fashion. Disables new tasks from submission and then * waits for existing tasks to terminate. Eventually cancels running tasks if too much time elapses. * - * If the timeout is < 0, then a plain shutdown takes place. + * If the timeout is 0, then a plain shutdown takes place. * * * @param executorService *the pool to shutdown. * @param timeout - *the maximum time to wait + *the maximum time to wait, or 0 to not wait for existing tasks to terminate. * @param timeUnit *the time unit of the timeout argument * @param source
[48/50] [abbrv] logging-log4j2 git commit: Migrate unit tests to Mockito 2.x
Migrate unit tests to Mockito 2.x This commit completely migrates from EasyMock to Mockito 2.x. Unit tests have been updated to use the BDD-style of Mockito's API (given/when/then). Various test cleanups were also included during the migration. Related to LOG4J2-1646. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/78c6a1fc Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/78c6a1fc Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/78c6a1fc Branch: refs/heads/LOG4J2-1390 Commit: 78c6a1fcae718f5edd177256ab157f555b84f37a Parents: f3e9ea1 Author: Matt SickerAuthored: Sun Oct 23 15:09:35 2016 -0500 Committer: Matt Sicker Committed: Sun Oct 23 15:12:03 2016 -0500 -- log4j-core/pom.xml | 4 +- .../core/appender/ConsoleAppenderTest.java | 27 +- .../db/AbstractDatabaseAppenderTest.java| 145 +++ .../db/AbstractDatabaseManagerTest.java | 356 +++ .../db/jdbc/AbstractJdbcAppenderTest.java | 20 +- .../db/jdbc/DataSourceConnectionSourceTest.java | 17 +- .../jdbc/FactoryMethodConnectionSourceTest.java | 53 +-- .../log4j/core/lookup/Log4jLookupTest.java | 33 +- .../core/lookup/Log4jLookupWithSpacesTest.java | 35 +- log4j-iostreams/pom.xml | 4 +- .../io/AbstractLoggerOutputStreamTest.java | 15 +- .../log4j/io/AbstractLoggerWriterTest.java | 15 +- log4j-nosql/pom.xml | 5 +- .../log4j/nosql/appender/NoSqlAppenderTest.java | 30 +- .../appender/NoSqlDatabaseManagerTest.java | 434 ++- log4j-web/pom.xml | 4 +- .../Log4jServletContainerInitializerTest.java | 164 +++ .../web/Log4jServletContextListenerTest.java| 58 +-- .../log4j/web/Log4jServletFilterTest.java | 114 ++--- .../log4j/web/Log4jWebInitializerImplTest.java | 367 pom.xml | 7 +- src/changes/changes.xml | 3 + 22 files changed, 658 insertions(+), 1252 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/78c6a1fc/log4j-core/pom.xml -- diff --git a/log4j-core/pom.xml b/log4j-core/pom.xml index 2fbc78c..5cda105 100644 --- a/log4j-core/pom.xml +++ b/log4j-core/pom.xml @@ -203,8 +203,8 @@ - org.easymock - easymock + org.mockito + mockito-core test http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/78c6a1fc/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java index 87aef83..c53eb43 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java @@ -27,22 +27,25 @@ import org.apache.logging.log4j.core.impl.Log4jLogEvent; import org.apache.logging.log4j.core.layout.PatternLayout; import org.apache.logging.log4j.message.SimpleMessage; import org.apache.logging.log4j.util.Strings; -import org.easymock.EasyMockSupport; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; -import static org.easymock.EasyMock.anyInt; -import static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.expectLastCall; import static org.junit.Assert.*; - +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.BDDMockito.then; +import static org.mockito.Mockito.atLeastOnce; /** * */ +@RunWith(MockitoJUnitRunner.class) public class ConsoleAppenderTest { private static final String LOG4J_SKIP_JANSI = "log4j.skipJansi"; @@ -59,15 +62,12 @@ public class ConsoleAppenderTest { ByteArrayOutputStream baos; -EasyMockSupport mocks; - +@Mock PrintStream psMock; @Before public void before() { System.setProperty(LOG4J_SKIP_JANSI, "true"); -mocks = new EasyMockSupport(); -psMock = mocks.createMock("psMock", PrintStream.class); baos = new ByteArrayOutputStream(); } @@ -90,12 +90,6 @@ public class ConsoleAppenderTest { private void
[34/50] [abbrv] logging-log4j2 git commit: Refactor use of Strings.LINE_SEPARATOR.
Refactor use of Strings.LINE_SEPARATOR. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/118abf47 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/118abf47 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/118abf47 Branch: refs/heads/LOG4J2-1390 Commit: 118abf47142a3a7ea05d980aba8aded96df8d2f2 Parents: 2da9dfa Author: Gary GregoryAuthored: Fri Oct 7 15:15:02 2016 -0700 Committer: Gary Gregory Committed: Fri Oct 7 15:15:02 2016 -0700 -- .../logging/log4j/core/layout/HtmlLayout.java | 77 +++- 1 file changed, 44 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/118abf47/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java index 67593e6..2acf335 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java @@ -258,6 +258,16 @@ public final class HtmlLayout extends AbstractStringLayout { } } +private StringBuilder appendLs(StringBuilder sbuilder, String s) { +sbuilder.append(s).append(Strings.LINE_SEPARATOR); +return sbuilder; +} + +private StringBuilder append(StringBuilder sbuilder, String s) { +sbuilder.append(s); +return sbuilder; +} + /** * Returns appropriate HTML headers. * @return The header as a byte array. @@ -265,38 +275,39 @@ public final class HtmlLayout extends AbstractStringLayout { @Override public byte[] getHeader() { final StringBuilder sbuf = new StringBuilder(); -sbuf.append("http://www.w3.org/TR/html4/loose.dtd\;>"); -sbuf.append(Strings.LINE_SEPARATOR); -sbuf.append("").append(Strings.LINE_SEPARATOR); -sbuf.append("").append(Strings.LINE_SEPARATOR); -sbuf.append("").append(Strings.LINE_SEPARATOR); - sbuf.append("").append(title).append("").append(Strings.LINE_SEPARATOR); -sbuf.append("").append(Strings.LINE_SEPARATOR); -sbuf.append("").append(Strings.LINE_SEPARATOR); -sbuf.append("").append(Strings.LINE_SEPARATOR); -sbuf.append("").append(Strings.LINE_SEPARATOR); -sbuf.append("").append(Strings.LINE_SEPARATOR); -sbuf.append("").append(Strings.LINE_SEPARATOR); -sbuf.append("Log session start time " + new java.util.Date() + "").append(Strings.LINE_SEPARATOR); -sbuf.append("").append(Strings.LINE_SEPARATOR); -sbuf.append( -""); -sbuf.append(Strings.LINE_SEPARATOR); -sbuf.append("").append(Strings.LINE_SEPARATOR); -sbuf.append("Time").append(Strings.LINE_SEPARATOR); -sbuf.append("Thread").append(Strings.LINE_SEPARATOR); -sbuf.append("Level").append(Strings.LINE_SEPARATOR); -sbuf.append("Logger").append(Strings.LINE_SEPARATOR); +append(sbuf, "http://www.w3.org/TR/html4/loose.dtd\;>"); +appendLs(sbuf, ""); +appendLs(sbuf, ""); +append(sbuf, ""); +append(sbuf, "").append(title); +appendLs(sbuf, ""); +appendLs(sbuf, ""); +appendLs(sbuf, ""); +appendLs(sbuf, ""); +appendLs(sbuf, ""); +appendLs(sbuf, ""); +appendLs(sbuf, ""); +appendLs(sbuf, "Log session start time " + new java.util.Date() + ""); +appendLs(sbuf, ""); +appendLs(sbuf, +""); +appendLs(sbuf, ""); +appendLs(sbuf, "Time"); +appendLs(sbuf, "Thread"); +appendLs(sbuf, "Level"); +appendLs(sbuf, "Logger"); if (locationInfo) { -sbuf.append("File:Line").append(Strings.LINE_SEPARATOR); +appendLs(sbuf, "File:Line"); } -sbuf.append("Message").append(Strings.LINE_SEPARATOR); -
[12/50] [abbrv] logging-log4j2 git commit: Make sure to not use zero timeout for FlumePersistentManager shutdown
Make sure to not use zero timeout for FlumePersistentManager shutdown Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/81eeff13 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/81eeff13 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/81eeff13 Branch: refs/heads/LOG4J2-1390 Commit: 81eeff13e83b98aec8338b8461322df5a71d78d9 Parents: 78cbb44 Author: Mikael StåldalAuthored: Thu Sep 29 18:25:02 2016 +0200 Committer: Mikael Ståldal Committed: Thu Sep 29 18:25:02 2016 +0200 -- .../flume/appender/FlumePersistentManager.java | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/81eeff13/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java -- diff --git a/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java b/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java index 4711ae0..82fede1 100644 --- a/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java +++ b/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java @@ -31,10 +31,21 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; - import javax.crypto.Cipher; import javax.crypto.SecretKey; +import com.sleepycat.je.Cursor; +import com.sleepycat.je.CursorConfig; +import com.sleepycat.je.Database; +import com.sleepycat.je.DatabaseConfig; +import com.sleepycat.je.DatabaseEntry; +import com.sleepycat.je.Environment; +import com.sleepycat.je.EnvironmentConfig; +import com.sleepycat.je.LockConflictException; +import com.sleepycat.je.LockMode; +import com.sleepycat.je.OperationStatus; +import com.sleepycat.je.StatsConfig; +import com.sleepycat.je.Transaction; import org.apache.flume.Event; import org.apache.flume.event.SimpleEvent; import org.apache.logging.log4j.LoggingException; @@ -49,19 +60,6 @@ import org.apache.logging.log4j.core.util.Log4jThreadFactory; import org.apache.logging.log4j.core.util.SecretKeyProvider; import org.apache.logging.log4j.util.Strings; -import com.sleepycat.je.Cursor; -import com.sleepycat.je.CursorConfig; -import com.sleepycat.je.Database; -import com.sleepycat.je.DatabaseConfig; -import com.sleepycat.je.DatabaseEntry; -import com.sleepycat.je.Environment; -import com.sleepycat.je.EnvironmentConfig; -import com.sleepycat.je.LockConflictException; -import com.sleepycat.je.LockMode; -import com.sleepycat.je.OperationStatus; -import com.sleepycat.je.StatsConfig; -import com.sleepycat.je.Transaction; - /** * Manager that persists data to Berkeley DB before passing it on to Flume. */ @@ -220,7 +218,7 @@ public class FlumePersistentManager extends FlumeAvroManager { LOGGER.debug("Shutting down FlumePersistentManager"); worker.shutdown(); final long requestedTimeoutMillis = timeUnit.toMillis(timeout); -final long shutdownWaitMillis = requestedTimeoutMillis < 0 ? SHUTDOWN_WAIT_MILLIS : requestedTimeoutMillis; +final long shutdownWaitMillis = requestedTimeoutMillis > 0 ? requestedTimeoutMillis : SHUTDOWN_WAIT_MILLIS; try { worker.join(shutdownWaitMillis); } catch (final InterruptedException ie) {
[40/50] [abbrv] 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/197997ac Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/197997ac Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/197997ac Branch: refs/heads/LOG4J2-1390 Commit: 197997ac35217369cdcc881c258cfcbd5db6a258 Parents: 8245e54 Author: ggregoryAuthored: Mon Oct 10 14:21:49 2016 -0700 Committer: ggregory Committed: Mon Oct 10 14:21:49 2016 -0700 -- .../java/org/apache/logging/log4j/core/lookup/JndiLookup.java | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/197997ac/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java index 35c4f9d..3dbef43 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java @@ -50,15 +50,12 @@ public class JndiLookup extends AbstractLookup { return null; } final String jndiName = convertJndiName(key); -final JndiManager jndiManager = JndiManager.getDefaultManager(); -try { +try (final JndiManager jndiManager = JndiManager.getDefaultManager()) { final Object value = jndiManager.lookup(jndiName); return value == null ? null : String.valueOf(value); } catch (final NamingException e) { LOGGER.warn(LOOKUP, "Error looking up JNDI resource [{}].", jndiName, e); return null; -} finally { -jndiManager.close(); } }
[05/50] [abbrv] logging-log4j2 git commit: [LOG4J2-1506] Unregister JMX ignores log4j2.disable.jmx property. For JMX and GAE, catch (LinkageError and Exception) instead of Throwable.
[LOG4J2-1506] Unregister JMX ignores log4j2.disable.jmx property. For JMX and GAE, catch (LinkageError and Exception) instead of Throwable. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/baea9914 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/baea9914 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/baea9914 Branch: refs/heads/LOG4J2-1390 Commit: baea9914fa5aa32706e62bb52109df5837a9bcbd Parents: 83cd00e Author: Gary GregoryAuthored: Wed Sep 28 16:41:12 2016 -0700 Committer: Gary Gregory Committed: Wed Sep 28 16:41:12 2016 -0700 -- .../java/org/apache/logging/log4j/core/LoggerContext.java | 9 + .../org/apache/logging/log4j/core/lookup/Interpolator.java | 8 .../org/apache/logging/log4j/core/util/ReflectionUtil.java | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/baea9914/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java index 104a921..7e13963 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java @@ -315,8 +315,9 @@ public class LoggerContext extends AbstractLifeCycle this.setStopping(); try { Server.unregisterLoggerContext(getName()); // LOG4J2-406, LOG4J2-500 -} catch (final Throwable t) { -LOGGER.error("Unable to unregister MBeans", t); +} catch (final LinkageError | Exception e) { +// LOG4J2-1506 Hello Android, GAE +LOGGER.error("Unable to unregister MBeans", e); } if (shutdownCallback != null) { shutdownCallback.cancel(); @@ -538,9 +539,9 @@ public class LoggerContext extends AbstractLifeCycle try { Server.reregisterMBeansAfterReconfigure(); -} catch (final Throwable t) { +} catch (final LinkageError | Exception e) { // LOG4J2-716: Android has no java.lang.management -LOGGER.error("Could not reconfigure JMX", t); +LOGGER.error("Could not reconfigure JMX", e); } // AsyncLoggers update their nanoClock when the configuration changes Log4jLogEvent.setNanoClock(configuration.getNanoClock()); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/baea9914/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java index b480fa0..ba50ca7 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java @@ -100,8 +100,8 @@ public class Interpolator extends AbstractConfigurationAwareLookup { // [LOG4J2-703] We might be on Android lookups.put(LOOKUP_KEY_JNDI, Loader.newCheckedInstanceOf("org.apache.logging.log4j.core.lookup.JndiLookup", StrLookup.class)); -} catch (final Throwable t) { -handleError(LOOKUP_KEY_JNDI, t); +} catch (final LinkageError | Exception e) { +handleError(LOOKUP_KEY_JNDI, e); } // JMX input args try { @@ -109,8 +109,8 @@ public class Interpolator extends AbstractConfigurationAwareLookup { lookups.put(LOOKUP_KEY_JVMRUNARGS, Loader.newCheckedInstanceOf("org.apache.logging.log4j.core.lookup.JmxRuntimeInputArgumentsLookup", StrLookup.class)); -} catch (final Throwable t) { -handleError(LOOKUP_KEY_JVMRUNARGS, t); +} catch (final LinkageError | Exception e) { +handleError(LOOKUP_KEY_JVMRUNARGS, e); } lookups.put("date", new DateLookup()); lookups.put("ctx", new ContextMapLookup()); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/baea9914/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ReflectionUtil.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ReflectionUtil.java
[31/50] [abbrv] logging-log4j2 git commit: Adding links to Scaladoc
Adding links to Scaladoc Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2da9dfa6 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2da9dfa6 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2da9dfa6 Branch: refs/heads/LOG4J2-1390 Commit: 2da9dfa67e478c8ceb9c0362bad388576e05859b Parents: aa037d3 Author: Mikael StåldalAuthored: Thu Oct 6 13:29:05 2016 +0200 Committer: Mikael Ståldal Committed: Thu Oct 6 13:29:05 2016 +0200 -- src/site/site.xml | 1 + src/site/xdoc/javadoc.xml | 4 2 files changed, 5 insertions(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2da9dfa6/src/site/site.xml -- diff --git a/src/site/site.xml b/src/site/site.xml index cd23f6e..b99af21 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -40,6 +40,7 @@ + http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2da9dfa6/src/site/xdoc/javadoc.xml -- diff --git a/src/site/xdoc/javadoc.xml b/src/site/xdoc/javadoc.xml index 7708c14..32b6b7c 100644 --- a/src/site/xdoc/javadoc.xml +++ b/src/site/xdoc/javadoc.xml @@ -55,6 +55,10 @@ JSP Tag Library (TLD Doc) The special Javadoc-like Tag Library Documentation for the Log4j 2 JSP Tag Library. + + Scala API (Scaladoc) + The Scala wrapper for the Log4j API. +
[18/50] [abbrv] logging-log4j2 git commit: LOG4J2-1504 document default value of on-demand RollingFileAppender attribute in Appenders manual page
LOG4J2-1504 document default value of on-demand RollingFileAppender attribute in Appenders manual page Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d5269df3 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d5269df3 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d5269df3 Branch: refs/heads/LOG4J2-1390 Commit: d5269df3aea20489df4b48e66e31071e126a67dc Parents: a1cd9dd Author: rpopmaAuthored: Sun Oct 2 15:24:45 2016 +0900 Committer: rpopma Committed: Sun Oct 2 15:24:45 2016 +0900 -- src/site/xdoc/manual/appenders.xml | 54 - 1 file changed, 27 insertions(+), 27 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d5269df3/src/site/xdoc/manual/appenders.xml -- diff --git a/src/site/xdoc/manual/appenders.xml b/src/site/xdoc/manual/appenders.xml index 30eb0dc..54c554c 100644 --- a/src/site/xdoc/manual/appenders.xml +++ b/src/site/xdoc/manual/appenders.xml @@ -429,7 +429,7 @@ createOnDemand boolean - The appender creates the file on-demand. The appender only creates the file when a log event + The appender creates the file on-demand. The appender only creates the file when a log event passes all filters and is routed to this appender. Defaults to false. @@ -1342,7 +1342,7 @@ public class JpaLogEntity extends AbstractLogEventWrapperEntity { -The KafkaAppender logs events to an https://kafka.apache.org/;>Apache Kafka topic. +The KafkaAppender logs events to an https://kafka.apache.org/;>Apache Kafka topic. Each log event is sent as a Kafka record with no key. @@ -2210,8 +2210,8 @@ public class JpaLogEntity extends AbstractLogEventWrapperEntity { createOnDemand boolean - The appender creates the file on-demand. The appender only creates the file when a log event -passes all filters and is routed to this appender. + The appender creates the file on-demand. The appender only creates the file when a log event +passes all filters and is routed to this appender. Defaults to false. filter @@ -3284,8 +3284,8 @@ public class JpaLogEntity extends AbstractLogEventWrapperEntity { Appenders it references to allow it to shut down properly. - You can also configure a RoutingAppender with scripts: you can run a script when the appender starts - and when a route is chosen for an log event. + You can also configure a RoutingAppender with scripts: you can run a script when the appender starts + and when a route is chosen for an log event. RoutingAppender Parameters @@ -3320,7 +3320,7 @@ public class JpaLogEntity extends AbstractLogEventWrapperEntity { Script - This Script runs when Log4j starts the RoutingAppender and returns a String Route key to + This Script runs when Log4j starts the RoutingAppender and returns a String Route key to determine the default Route. @@ -3343,7 +3343,7 @@ public class JpaLogEntity extends AbstractLogEventWrapperEntity { Map A Map shared between all script invocations for this appender instance. This is - the same map passed to the Routes Script. + the same map passed to the Routes Script. @@ -3359,9 +3359,9 @@ public class JpaLogEntity extends AbstractLogEventWrapperEntity { -In this example, the script causes the "ServiceWindows" route to be the default route on Windows and -"ServiceOther" on all other operating systems. Note that the List Appender is one of our test appenders, -any appender can be used, it is only used as a shorthand. +In this example, the script causes the "ServiceWindows" route to be the default route on Windows and +"ServiceOther" on all other operating systems. Note that the List Appender is one of our test appenders, +any appender can be used, it is only used as a shorthand. +]]> Purge Policy The
[02/50] [abbrv] logging-log4j2 git commit: Remove unneeded ()'s.
Remove unneeded ()'s. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/10a34436 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/10a34436 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/10a34436 Branch: refs/heads/LOG4J2-1390 Commit: 10a34436f4c455d08078e0e52392f92eb90c0b9b Parents: 5aa0313 Author: Gary GregoryAuthored: Wed Sep 28 14:45:49 2016 -0700 Committer: Gary Gregory Committed: Wed Sep 28 14:45:49 2016 -0700 -- .../apache/logging/log4j/core/appender/SyslogAppenderTestBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10a34436/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java index c1e1023..11a8275 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java @@ -49,7 +49,7 @@ public class SyslogAppenderTestBase { @BeforeClass public static void setupClass() throws Exception { -(LoggerContext.getContext()).reconfigure(); +LoggerContext.getContext().reconfigure(); } protected void sendAndCheckLegacyBSDMessages(final List messagesToSend) throws InterruptedException {
[33/50] [abbrv] logging-log4j2 git commit: LOG4J2-1623 Fix Javadoc
LOG4J2-1623 Fix 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/6482da5b Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/6482da5b Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/6482da5b Branch: refs/heads/LOG4J2-1390 Commit: 6482da5b325a8d42bc79ade754a1d5b904c6dcea Parents: 3064471 Author: Mikael StåldalAuthored: Thu Oct 6 13:42:17 2016 +0200 Committer: Mikael Ståldal Committed: Thu Oct 6 13:42:17 2016 +0200 -- .../log4j/core/config/builder/api/ConfigurationBuilder.java | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6482da5b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/api/ConfigurationBuilder.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/api/ConfigurationBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/api/ConfigurationBuilder.java index b115651..8141c25 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/api/ConfigurationBuilder.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/api/ConfigurationBuilder.java @@ -369,9 +369,14 @@ public interface ConfigurationBuilder extends Builder setShutdownHook(String flag); /** - * Specifies how long time appenders and other plugins will get to shutdown when the JVM shuts down. - * Default is zero. (Not used if {@link #setShutdownHook(String)} is set to "disable".) + * How long appenders and background tasks will get to shutdown when the JVM shuts down. + * Default is zero which mean that each appender uses its default timeout, and don't wait for background + * tasks. Not all appenders will honor this, it is a hint and not an absolute guarantee that the shutdown + * procedure will not take longer. Setting this too low increase the risk of losing outstanding log events + * not yet written to the final destination. (Not used if {@link #setShutdownHook(String)} is set to "disable".) * @return this builder instance. + * + * @see LoggerContext#stop(long, TimeUnit) */ ConfigurationBuilder setShutdownTimeout(long timeout, TimeUnit timeUnit);
[03/50] [abbrv] logging-log4j2 git commit: [LOG4J2-1619] new Log4jLogEvent().toString() throws an NPE.
[LOG4J2-1619] new Log4jLogEvent().toString() throws an NPE. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e6781f5e Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e6781f5e Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e6781f5e Branch: refs/heads/LOG4J2-1390 Commit: e6781f5e5789fed20fc4b0cbc3edb6c30dc012c5 Parents: 10a3443 Author: Gary GregoryAuthored: Wed Sep 28 16:12:13 2016 -0700 Committer: Gary Gregory Committed: Wed Sep 28 16:12:13 2016 -0700 -- .../java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java| 2 +- src/changes/changes.xml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e6781f5e/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java index 291687a..4759976 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java @@ -741,7 +741,7 @@ public class Log4jLogEvent implements LogEvent { final String n = loggerName.isEmpty() ? LoggerConfig.ROOT : loggerName; sb.append("Logger=").append(n); sb.append(" Level=").append(level.name()); -sb.append(" Message=").append(message.getFormattedMessage()); +sb.append(" Message=").append(message == null ? null : message.getFormattedMessage()); return sb.toString(); } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e6781f5e/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 553f101..6c5d2cd 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -180,6 +180,9 @@ Add targetNamespace to log4j-config.xsd. GitHub #43. + +new Log4jLogEvent().toString() throws an NPE. + RoutingAppender can be configured with scripts. Add Script in a Routes element.
[20/50] [abbrv] logging-log4j2 git commit: [maven-release-plugin] prepare release log4j-2.7-rc2
[maven-release-plugin] prepare release log4j-2.7-rc2 Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/29cfc80d Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/29cfc80d Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/29cfc80d Branch: refs/heads/LOG4J2-1390 Commit: 29cfc80dcddd468c1c5d4ef2c7c4435f90792628 Parents: d7f1919 Author: rgoersAuthored: Sun Oct 2 11:13:11 2016 -0700 Committer: rgoers Committed: Sun Oct 2 11:13:11 2016 -0700 -- log4j-1.2-api/pom.xml | 2 +- log4j-api-scala_2.10/pom.xml | 2 +- log4j-api-scala_2.11/pom.xml | 2 +- log4j-api/pom.xml | 2 +- log4j-bom/pom.xml | 4 ++-- log4j-core/pom.xml | 2 +- log4j-distribution/pom.xml | 2 +- log4j-flume-ng/pom.xml | 2 +- log4j-iostreams/pom.xml| 2 +- log4j-jcl/pom.xml | 2 +- log4j-jmx-gui/pom.xml | 2 +- log4j-jul/pom.xml | 2 +- log4j-liquibase/pom.xml| 2 +- log4j-nosql/pom.xml| 2 +- log4j-perf/pom.xml | 2 +- log4j-samples/configuration/pom.xml| 2 +- log4j-samples/flume-common/pom.xml | 2 +- log4j-samples/flume-embedded/pom.xml | 2 +- log4j-samples/flume-remote/pom.xml | 2 +- log4j-samples/loggerProperties/pom.xml | 2 +- log4j-samples/pom.xml | 2 +- log4j-samples/scala-api/pom.xml| 2 +- log4j-slf4j-impl/pom.xml | 2 +- log4j-taglib/pom.xml | 2 +- log4j-to-slf4j/pom.xml | 2 +- log4j-web/pom.xml | 2 +- pom.xml| 4 ++-- 27 files changed, 29 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/29cfc80d/log4j-1.2-api/pom.xml -- diff --git a/log4j-1.2-api/pom.xml b/log4j-1.2-api/pom.xml index 98b6716..2704c5b 100644 --- a/log4j-1.2-api/pom.xml +++ b/log4j-1.2-api/pom.xml @@ -20,7 +20,7 @@ org.apache.logging.log4j log4j -2.7.1-SNAPSHOT +2.7 ../ log4j-1.2-api http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/29cfc80d/log4j-api-scala_2.10/pom.xml -- diff --git a/log4j-api-scala_2.10/pom.xml b/log4j-api-scala_2.10/pom.xml index 46edf74..c11b66b 100644 --- a/log4j-api-scala_2.10/pom.xml +++ b/log4j-api-scala_2.10/pom.xml @@ -20,7 +20,7 @@ org.apache.logging.log4j log4j -2.7.1-SNAPSHOT +2.7 ../ log4j-api-scala_2.10 http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/29cfc80d/log4j-api-scala_2.11/pom.xml -- diff --git a/log4j-api-scala_2.11/pom.xml b/log4j-api-scala_2.11/pom.xml index 4a7ba19..f8b5288 100644 --- a/log4j-api-scala_2.11/pom.xml +++ b/log4j-api-scala_2.11/pom.xml @@ -20,7 +20,7 @@ org.apache.logging.log4j log4j -2.7.1-SNAPSHOT +2.7 ../ log4j-api-scala_2.11 http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/29cfc80d/log4j-api/pom.xml -- diff --git a/log4j-api/pom.xml b/log4j-api/pom.xml index debeb2f..9f0b641 100644 --- a/log4j-api/pom.xml +++ b/log4j-api/pom.xml @@ -20,7 +20,7 @@ org.apache.logging.log4j log4j -2.7.1-SNAPSHOT +2.7 ../ log4j-api http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/29cfc80d/log4j-bom/pom.xml -- diff --git a/log4j-bom/pom.xml b/log4j-bom/pom.xml index 34745c4..f3f8540 100644 --- a/log4j-bom/pom.xml +++ b/log4j-bom/pom.xml @@ -26,7 +26,7 @@ Apache Log4j Bill of Materials org.apache.logging.log4j log4j-bom - 2.7.1-SNAPSHOT + 2.7 pom @@ -143,6 +143,6 @@ -log4j-2.6.1 +log4j-2.7-rc2 http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/29cfc80d/log4j-core/pom.xml -- diff --git a/log4j-core/pom.xml b/log4j-core/pom.xml index 2fbc78c..4774f50 100644 --- a/log4j-core/pom.xml +++ b/log4j-core/pom.xml @@ -20,7 +20,7 @@ org.apache.logging.log4j log4j -2.7.1-SNAPSHOT +2.7 ../ log4j-core http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/29cfc80d/log4j-distribution/pom.xml -- diff --git a/log4j-distribution/pom.xml
[30/50] [abbrv] logging-log4j2 git commit: Removing bogus scm tag element from POM
Removing bogus scm tag element from POM Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/aa037d30 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/aa037d30 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/aa037d30 Branch: refs/heads/LOG4J2-1390 Commit: aa037d30861db44208bc89bb87899fdc3a7d7fba Parents: 4df3a6b Author: Mikael StåldalAuthored: Thu Oct 6 13:18:13 2016 +0200 Committer: Mikael Ståldal Committed: Thu Oct 6 13:18:13 2016 +0200 -- log4j-bom/pom.xml | 4 1 file changed, 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/aa037d30/log4j-bom/pom.xml -- diff --git a/log4j-bom/pom.xml b/log4j-bom/pom.xml index 34745c4..6dee82f 100644 --- a/log4j-bom/pom.xml +++ b/log4j-bom/pom.xml @@ -141,8 +141,4 @@ - - -log4j-2.6.1 -
[10/50] [abbrv] logging-log4j2 git commit: Stop the context to make sure all files are compressed and closed. Trying to remedy failures in CI builds.
Stop the context to make sure all files are compressed and closed. Trying to remedy failures in CI builds. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/166d3fab Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/166d3fab Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/166d3fab Branch: refs/heads/LOG4J2-1390 Commit: 166d3fab4376125aa30e7b0c63d64eef99a02eb9 Parents: 560120b Author: Gary GregoryAuthored: Wed Sep 28 22:00:57 2016 -0700 Committer: Gary Gregory Committed: Wed Sep 28 22:00:57 2016 -0700 -- .../log4j/core/appender/rolling/RollingAppenderSizeTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/166d3fab/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java -- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java index addc42d..cb3bc98 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java @@ -140,7 +140,9 @@ public class RollingAppenderSizeTest { return; // Apache Commons Compress cannot deflate zip? TODO test decompressing these formats } // Stop the context to make sure all files are compressed and closed. Trying to remedy failures in CI builds. -loggerContextRule.getLoggerContext().stop(30, TimeUnit.SECONDS); +if (loggerContextRule.getLoggerContext().stop(30, TimeUnit.SECONDS)) { +System.err.println("Could not stop cleanly " + loggerContextRule + " for " + this); +} for (final File file : files) { if (file.getName().endsWith(fileExtension)) { CompressorInputStream in = null;
[39/50] [abbrv] logging-log4j2 git commit: [LOG4J2-1641] Update JeroMQ from 0.3.5 to 0.3.6.
[LOG4J2-1641] Update JeroMQ from 0.3.5 to 0.3.6. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8245e544 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8245e544 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8245e544 Branch: refs/heads/LOG4J2-1390 Commit: 8245e544be9e44b907dbfa7ebda7fa928d4c51a5 Parents: fc0e07c Author: ggregoryAuthored: Mon Oct 10 14:12:39 2016 -0700 Committer: ggregory Committed: Mon Oct 10 14:12:39 2016 -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/8245e544/pom.xml -- diff --git a/pom.xml b/pom.xml index a32f984..fd49ff7 100644 --- a/pom.xml +++ b/pom.xml @@ -612,7 +612,7 @@ org.zeromq jeromq -0.3.5 +0.3.6 javax.servlet http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8245e544/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 3288f97..d935048 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -30,6 +30,9 @@ Fix MemoryMappedFileAppender.createAppender() Javadoc for immediateFlush. + +Update JeroMQ from 0.3.5 to 0.3.6. +
[26/50] [abbrv] logging-log4j2 git commit: LOG4J2-1623 Update documentation
LOG4J2-1623 Update documentation Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/5564556c Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/5564556c Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/5564556c Branch: refs/heads/LOG4J2-1390 Commit: 5564556cd81be70926d6f35a2ff323f623728f5a Parents: 9446525 Author: Mikael StåldalAuthored: Wed Oct 5 13:35:41 2016 +0200 Committer: Mikael Ståldal Committed: Wed Oct 5 13:35:41 2016 +0200 -- .../org/apache/logging/log4j/core/LoggerContext.java| 12 src/site/xdoc/manual/configuration.xml.vm | 9 +++-- 2 files changed, 19 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5564556c/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java index c964965..2681485 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java @@ -302,6 +302,18 @@ public class LoggerContext extends AbstractLifeCycle stop(); } +/** + * How many milliseconds appenders and other plugins will get to shutdown. + * + * Not all plugins will honor this, it is a hint and not an absolute guarantee that the this method not block longer. + * Setting timeout too low increase the risk of losing outstanding log events not yet written to the final + * destination. + * + * @param timeout the maximum time to wait, or 0 which mean that each plugin uses its default timeout + * @param timeUnit the time unit of the timeout argument + * @return true if the context was stopped cleanly and normally, false otherwise. + * @since 2.7 + */ @Override public boolean stop(final long timeout, final TimeUnit timeUnit) { LOGGER.debug("Stopping LoggerContext[name={}, {}]...", getName(), this); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5564556c/src/site/xdoc/manual/configuration.xml.vm -- diff --git a/src/site/xdoc/manual/configuration.xml.vm b/src/site/xdoc/manual/configuration.xml.vm index acd41fd..2b59e8d 100644 --- a/src/site/xdoc/manual/configuration.xml.vm +++ b/src/site/xdoc/manual/configuration.xml.vm @@ -409,8 +409,13 @@ public class Bar { shutdownTimeout - Specifies how many milliseconds appenders and other plugins will get to shutdown when the JVM shuts down. - Default is zero. (Not used if shutdownHook is set to "disable".) + Specifies how many milliseconds appenders and other plugins will get to shutdown when the JVM shuts + down. Default is zero which mean that each plugin uses its default timeout. Not all plugins will honor + this, it is a hint and not an absolute guarantee that the shutdown procedure will not take longer. + Setting this too low increase the risk of losing outstanding log events not yet written to the final + destination. See LoggerContext.stop(long, java.util.concurrent.TimeUnit). + (Not used if shutdownHook is set to "disable".) status The level of internal Log4j events that should be logged to the console.
[23/50] [abbrv] logging-log4j2 git commit: Update BUILDING.txt file for building the site and out of memory problems.
Update BUILDING.txt file for building the site and out of memory problems. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/ce861303 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ce861303 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ce861303 Branch: refs/heads/LOG4J2-1390 Commit: ce861303981bc6a2630800b2d9449b3eebd7acb2 Parents: 3176c96 Author: Gary GregoryAuthored: Mon Oct 3 18:37:13 2016 -0700 Committer: Gary Gregory Committed: Mon Oct 3 18:37:13 2016 -0700 -- BUILDING.txt | 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ce861303/BUILDING.txt -- diff --git a/BUILDING.txt b/BUILDING.txt index bce02f7..9d5f3f8 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -26,6 +26,10 @@ mvn clirr:check -pl log4j-1.2-api Next, to build the site: +If Java 7 runs out of memory building the site, you will need: + +set MAVEN_OPTS=-Xmx2000m -XX:MaxPermSize=384m + mvn site On Windows, use a local staging directory, for example:
[27/50] [abbrv] logging-log4j2 git commit: LOG4J2-1623 Update documentation
LOG4J2-1623 Update documentation Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/c92c327c Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c92c327c Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c92c327c Branch: refs/heads/LOG4J2-1390 Commit: c92c327c3db50ff18d01234c0a427d3ad9869588 Parents: 5564556 Author: Mikael StåldalAuthored: Wed Oct 5 15:07:55 2016 +0200 Committer: Mikael Ståldal Committed: Wed Oct 5 15:07:55 2016 +0200 -- .../logging/log4j/core/LoggerContext.java | 21 +--- .../logging/log4j/core/config/Configurator.java | 13 +++- src/site/xdoc/manual/configuration.xml.vm | 10 +- 3 files changed, 27 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c92c327c/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java index 2681485..4c759c0 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java @@ -303,15 +303,22 @@ public class LoggerContext extends AbstractLifeCycle } /** - * How many milliseconds appenders and other plugins will get to shutdown. - * - * Not all plugins will honor this, it is a hint and not an absolute guarantee that the this method not block longer. + * Blocks until all Log4j tasks have completed execution after a shutdown request and all appenders have shut down, + * or the timeout occurs, or the current thread is interrupted, whichever happens first. + * + * Not all appenders will honor this, it is a hint and not an absolute guarantee that the this method not block longer. * Setting timeout too low increase the risk of losing outstanding log events not yet written to the final * destination. - * - * @param timeout the maximum time to wait, or 0 which mean that each plugin uses its default timeout - * @param timeUnit the time unit of the timeout argument - * @return true if the context was stopped cleanly and normally, false otherwise. + * + * Log4j can start threads to perform certain actions like file rollovers, calling this method with a positive timeout will + * block until the rollover thread is done. + * + * @param timeout the maximum time to wait, or 0 which mean that each apppender uses its default timeout, and don't wait for background +tasks + * @param timeUnit + *the time unit of the timeout argument + * @return {@code true} if the logger context terminated and {@code false} if the timeout elapsed before + * termination. * @since 2.7 */ @Override http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c92c327c/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java index 3da469d..28dd85f 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java @@ -346,13 +346,12 @@ public final class Configurator { } /** - * Blocks until all Log4j tasks have completed execution after a shutdown request, or the timeout occurs, or the - * current thread is interrupted, whichever happens first. + * Shuts down the given logger context. * - * Log4j can start threads to perform certain actions like file rollovers, calling this method with a timeout will - * block until the rollover thread is done. + * Log4j can start threads to perform certain actions like file rollovers; calling this method with a positive + * timeout will block until the rollover thread is done. * - * + * * @param ctx *the logger context to shut down, may be null. * @param timeout @@ -361,6 +360,10 @@ public final class Configurator { *the time unit of the timeout argument * @return {@code true} if the logger context terminated and {@code false} if the timeout elapsed before * termination. + * + * @see LoggerContext#stop(long, TimeUnit) + * + * @since 2.7 */
[50/50] [abbrv] logging-log4j2 git commit: Merge branch 'master' into LOG4J2-1390
Merge branch 'master' into LOG4J2-1390 # Conflicts: # log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/39e28336 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/39e28336 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/39e28336 Branch: refs/heads/LOG4J2-1390 Commit: 39e2833698ddea21e10cb9a57e1638f40cdda0a1 Parents: 3fac1c7 6ffcd1e Author: Mikael StåldalAuthored: Mon Oct 24 10:07:38 2016 +0200 Committer: Mikael Ståldal Committed: Mon Oct 24 10:07:38 2016 +0200 -- .gitignore | 14 +- BUILDING.txt| 100 +- README.md |8 + RELEASE-NOTES.txt | 200 ++-- log4j-1.2-api/.gitignore|5 - log4j-1.2-api/pom.xml |9 +- .../src/main/java/org/apache/log4j/Layout.java |4 +- .../apache/log4j/config/InputStreamWrapper.java | 92 ++ .../config/Log4j1ConfigurationConverter.java| 211 .../config/Log4j1ConfigurationFactory.java | 278 + .../log4j/config/Log4j1ConfigurationParser.java | 446 .../apache/log4j/layout/Log4j1XmlLayout.java| 162 +++ .../pattern/Log4j1MdcPatternConverter.java | 88 ++ .../pattern/Log4j1NdcPatternConverter.java | 63 ++ .../apache/log4j/BasicConfigurationFactory.java | 13 +- .../java/org/apache/log4j/CategoryTest.java |3 +- .../java/org/apache/log4j/LogWithMDCTest.java |6 +- .../java/org/apache/log4j/LogWithRouteTest.java |6 +- ...bstractLog4j1ConfigurationConverterTest.java | 69 ++ .../Log4j1ConfigurationConverterHadoopTest.java | 39 + .../Log4j1ConfigurationConverterSparkTest.java | 39 + .../config/Log4j1ConfigurationFactoryTest.java | 237 +++- .../log4j/layout/Log4j1XmlLayoutTest.java | 84 ++ .../pattern/Log4j1MdcPatternConverterTest.java | 79 ++ .../pattern/Log4j1NdcPatternConverterTest.java | 74 ++ .../src/main/resources/log4j.properties | 19 + .../src/main/conf/log4j.properties | 323 ++ .../src/test/resources/log4j.properties | 18 + .../src/test/resources/log4j.properties | 31 + .../src/main/resources/log4j.properties | 31 + .../src/test/resources/log4j.properties | 18 + .../src/test/resources/log4j.properties | 49 + .../src/test/resources/log4j.properties | 55 + .../src/test/resources/log4j.properties | 49 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 23 + .../src/test/resources/log4j.properties | 25 + .../src/test/resources/log4j.properties | 42 + .../src/main/sample-conf/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 37 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 63 ++ .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../src/test/resources/log4j.properties | 19 + .../log4j-DailyRollingFileAppender.properties | 26 + .../config-1.2/log4j-NullAppender.properties|9 + ...4j-RollingFileAppender-with-props.properties | 27 + .../log4j-RollingFileAppender.properties| 22 + ...g4j-console-EnhancedPatternLayout.properties |3 +- .../log4j-console-HtmlLayout.properties |3 +- .../log4j-console-PatternLayout.properties |1 - .../log4j-console-SimpleLayout.properties |1 - .../log4j-console-TTCCLayout.properties |3 +- .../log4j-console-XmlLayout.properties |5 +- .../log4j-file-SimpleLayout.properties | 17 + .../log4j-system-properties-1.properties| 14 + .../log4j-system-properties-2.properties| 15 + .../config-1.2/spark/R/log4j.properties | 28 + .../src/test/resources/log4j.properties | 27 + .../src/test/resources/log4j.properties | 24 +
[16/50] [abbrv] logging-log4j2 git commit: [LOG4J2-1501] FileAppender should be able to create files on-demand. Document default in site docs.
[LOG4J2-1501] FileAppender should be able to create files on-demand. Document default in site docs. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/a36d1110 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/a36d1110 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/a36d1110 Branch: refs/heads/LOG4J2-1390 Commit: a36d1110a10f401120372a9a92df3dd9bd74f9f2 Parents: 6bedc20 Author: Gary GregoryAuthored: Fri Sep 30 16:16:37 2016 -0700 Committer: Gary Gregory Committed: Fri Sep 30 16:16:37 2016 -0700 -- src/site/xdoc/manual/appenders.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a36d1110/src/site/xdoc/manual/appenders.xml -- diff --git a/src/site/xdoc/manual/appenders.xml b/src/site/xdoc/manual/appenders.xml index 7c114c9..30eb0dc 100644 --- a/src/site/xdoc/manual/appenders.xml +++ b/src/site/xdoc/manual/appenders.xml @@ -430,7 +430,7 @@ createOnDemand boolean The appender creates the file on-demand. The appender only creates the file when a log event -passes all filters and is routed to this appender. +passes all filters and is routed to this appender. Defaults to false. filter
[07/50] [abbrv] logging-log4j2 git commit: Refactor magic strings.
Refactor magic strings. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/0e15ec3e Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/0e15ec3e Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/0e15ec3e Branch: refs/heads/LOG4J2-1390 Commit: 0e15ec3e8b6ef68a34310b1b5aeb97a898960fd2 Parents: baea991 Author: Gary GregoryAuthored: Wed Sep 28 19:10:43 2016 -0700 Committer: Gary Gregory Committed: Wed Sep 28 19:10:43 2016 -0700 -- .../apache/logging/log4j/simple/SimpleLoggerContext.java | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0e15ec3e/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java b/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java index 3fe637f..fe460c6 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java @@ -33,6 +33,10 @@ import org.apache.logging.log4j.util.PropertiesUtil; */ public class SimpleLoggerContext implements LoggerContext { +private static final String SYSTEM_OUT = "system.out"; + +private static final String SYSTEM_ERR = "system.err"; + /** The default format to use when formatting dates */ protected static final String DEFAULT_DATE_TIME_FORMAT = "/MM/dd HH:mm:ss:SSS zzz"; @@ -75,11 +79,11 @@ public class SimpleLoggerContext implements LoggerContext { dateTimeFormat = showDateTime ? props.getStringProperty(SimpleLoggerContext.SYSTEM_PREFIX + "dateTimeFormat", DEFAULT_DATE_TIME_FORMAT) : null; -final String fileName = props.getStringProperty(SYSTEM_PREFIX + "logFile", "system.err"); +final String fileName = props.getStringProperty(SYSTEM_PREFIX + "logFile", SYSTEM_ERR); PrintStream ps; -if ("system.err".equalsIgnoreCase(fileName)) { +if (SYSTEM_ERR.equalsIgnoreCase(fileName)) { ps = System.err; -} else if ("system.out".equalsIgnoreCase(fileName)) { +} else if (SYSTEM_OUT.equalsIgnoreCase(fileName)) { ps = System.out; } else { try {
[43/50] [abbrv] logging-log4j2 git commit: Fix Javadoc
Fix 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/22369ccf Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/22369ccf Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/22369ccf Branch: refs/heads/LOG4J2-1390 Commit: 22369ccf073f1a27c5ba858f39161194693bda0f Parents: 19418b3 Author: Mikael StåldalAuthored: Thu Oct 20 15:13:48 2016 +0200 Committer: Mikael Ståldal Committed: Thu Oct 20 15:13:48 2016 +0200 -- .../java/org/apache/logging/log4j/core/ContextDataInjector.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/22369ccf/log4j-core/src/main/java/org/apache/logging/log4j/core/ContextDataInjector.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/ContextDataInjector.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/ContextDataInjector.java index 65b9a76..5351245 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/ContextDataInjector.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/ContextDataInjector.java @@ -76,7 +76,7 @@ public interface ContextDataInjector { * ThreadContextDataInjector.copyProperties(properties, reusable); * * // then copy context data key-value pairs (may overwrite configuration properties) - * reusable.addAll(rawContextData()); + * reusable.putAll(rawContextData()); * return reusable; * } * @@ -102,7 +102,7 @@ public interface ContextDataInjector { * underlying context may or may not be reflected in the returned object, depending on the context data source and * the implementation of this method. It is not safe to pass the returned object to another thread. * - * @return a {@code ReadOnlyStringMap} object reflecting the current state of the context + * @return a {@code ReadOnlyStringMap} object reflecting the current state of the context, may not return {@code null} */ ReadOnlyStringMap rawContextData(); }
[14/50] [abbrv] logging-log4j2 git commit: Don't need to nest else clause.
Don't need to nest else clause. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/003cada5 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/003cada5 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/003cada5 Branch: refs/heads/LOG4J2-1390 Commit: 003cada5de1188de6bc9879a599ae625d4a4e240 Parents: d7d1cf7 Author: Gary GregoryAuthored: Thu Sep 29 12:15:59 2016 -0700 Committer: Gary Gregory Committed: Thu Sep 29 12:15:59 2016 -0700 -- .../log4j/core/appender/SocketAppender.java | 33 ++-- 1 file changed, 16 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/003cada5/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java index c9d9c2f..8178ca0 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java @@ -301,27 +301,26 @@ public class SocketAppender extends AbstractOutputStreamAppender
[45/50] [abbrv] logging-log4j2 git commit: Remove extra blank line.
Remove extra blank line. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d5e45785 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d5e45785 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d5e45785 Branch: refs/heads/LOG4J2-1390 Commit: d5e45785dbbae575a67f55db9b1d7bca96774c7e Parents: 7114c91 Author: Gary GregoryAuthored: Fri Oct 21 21:13:43 2016 -0700 Committer: Gary Gregory Committed: Fri Oct 21 21:13:43 2016 -0700 -- pom.xml | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d5e45785/pom.xml -- diff --git a/pom.xml b/pom.xml index fd49ff7..66b3bf7 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,4 @@ -
[37/50] [abbrv] logging-log4j2 git commit: [LOG4J2-1636] Console Appender does not pick up Oracle Java 8's sun.stdout.encoding and sun.stderr.encoding. This is a partial fix. See discussion in Jira.
[LOG4J2-1636] Console Appender does not pick up Oracle Java 8's sun.stdout.encoding and sun.stderr.encoding. This is a partial fix. See discussion in Jira. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d65bf73c Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d65bf73c Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d65bf73c Branch: refs/heads/LOG4J2-1390 Commit: d65bf73c02adbf7e82bd2dc66649bad512b944f2 Parents: eed7c07 Author: Gary GregoryAuthored: Mon Oct 10 11:20:32 2016 -0700 Committer: Gary Gregory Committed: Mon Oct 10 11:20:32 2016 -0700 -- .../logging/log4j/util/PropertiesUtil.java | 597 +- .../log4j/core/appender/AbstractAppender.java |8 + .../log4j/core/appender/ConsoleAppender.java| 23 +- .../appender/ConsoleAppenderBuilderTest.java| 80 +- src/changes/changes.xml | 6175 +- 5 files changed, 3477 insertions(+), 3406 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d65bf73c/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java index 1bc4e43..af0b29e 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java @@ -1,287 +1,310 @@ -/* - * 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.util; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Consider this class private. - * - * Helps access properties. This utility provides a method to override system properties by specifying properties in a - * properties file. - * - */ -public final class PropertiesUtil { - -private static final PropertiesUtil LOG4J_PROPERTIES = new PropertiesUtil("log4j2.component.properties"); - -private final Properties props; - -/** - * Constructs a PropertiesUtil using a given Properties object as its source of defined properties. - * - * @param props the Properties to use by default - */ -public PropertiesUtil(final Properties props) { -this.props = props; -} - -/** - * Constructs a PropertiesUtil for a given properties file name on the classpath. The properties specified in this - * file are used by default. If a property is not defined in this file, then the equivalent system property is used. - * - * @param propertiesFileName the location of properties file to load - */ -public PropertiesUtil(final String propertiesFileName) { -final Properties properties = new Properties(); -for (final URL url : LoaderUtil.findResources(propertiesFileName)) { -try (final InputStream in = url.openStream()) { -properties.load(in); -} catch (final IOException ioe) { -LowLevelLogUtil.logException("Unable to read " + url.toString(), ioe); -} -} -this.props = properties; -} - -/** - * Loads and closes the given property input stream. If an error occurs, log to the status logger. - * - * @param in a property input stream. - * @param source a source object describing the source, like a resource string or a URL. - * @return a new Properties object - */ -static Properties loadClose(final InputStream in, final Object source) { -final Properties props = new Properties(); -if (null != in) { -try { -props.load(in); -} catch (final IOException e) { -
[24/50] [abbrv] logging-log4j2 git commit: LOG4J2-1623 Fix XML schema for configuration file
LOG4J2-1623 Fix XML schema for configuration file Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2153a262 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2153a262 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2153a262 Branch: refs/heads/LOG4J2-1390 Commit: 2153a2621a7ccfa8e9eb006ae8482e8d8dfbc6bc Parents: 705e272 Author: Mikael StåldalAuthored: Tue Oct 4 12:04:15 2016 +0200 Committer: Mikael Ståldal Committed: Tue Oct 4 12:04:15 2016 +0200 -- log4j-core/src/main/resources/Log4j-config.xsd | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2153a262/log4j-core/src/main/resources/Log4j-config.xsd -- diff --git a/log4j-core/src/main/resources/Log4j-config.xsd b/log4j-core/src/main/resources/Log4j-config.xsd index af13d71..e75cb9e 100644 --- a/log4j-core/src/main/resources/Log4j-config.xsd +++ b/log4j-core/src/main/resources/Log4j-config.xsd @@ -38,6 +38,7 @@ +
[44/50] [abbrv] logging-log4j2 git commit: [LOG4J2-1644] Inefficient locking in AbstractLoggerAdapter.
[LOG4J2-1644] Inefficient locking in AbstractLoggerAdapter. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7114c91c Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7114c91c Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7114c91c Branch: refs/heads/LOG4J2-1390 Commit: 7114c91cc6e974cb5a7627dd9646143143366c81 Parents: 22369cc Author: Tim GokcenAuthored: Fri Oct 21 13:02:59 2016 -0700 Committer: Gary Gregory Committed: Fri Oct 21 13:02:59 2016 -0700 -- .../log4j/spi/AbstractLoggerAdapter.java| 31 - .../logging/log4j/spi/LoggerAdapterTest.java| 126 +++ src/changes/changes.xml | 3 + 3 files changed, 154 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7114c91c/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java -- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java index 3c6c84f..33c8745 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerAdapter.java @@ -20,6 +20,8 @@ import java.util.Map; import java.util.WeakHashMap; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.util.LoaderUtil; @@ -37,6 +39,8 @@ public abstract class AbstractLoggerAdapter implements LoggerAdapter { */ protected final Map > registry = new WeakHashMap<>(); +private final ReadWriteLock lock = new ReentrantReadWriteLock (true); + @Override public L getLogger(final String name) { final LoggerContext context = getContext(); @@ -56,13 +60,28 @@ public abstract class AbstractLoggerAdapter implements LoggerAdapter { * @return the map of loggers for the given LoggerContext */ public ConcurrentMap getLoggersInContext(final LoggerContext context) { -synchronized (registry) { -ConcurrentMap loggers = registry.get(context); -if (loggers == null) { -loggers = new ConcurrentHashMap<>(); -registry.put(context, loggers); -} +ConcurrentMap loggers; +lock.readLock ().lock (); +try { +loggers = registry.get (context); +} finally { +lock.readLock ().unlock (); +} + +if (loggers != null) { return loggers; +} else { +lock.writeLock ().lock (); +try { +loggers = registry.get (context); +if (loggers == null) { +loggers = new ConcurrentHashMap<> (); +registry.put (context, loggers); +} +return loggers; +} finally { +lock.writeLock ().unlock (); +} } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7114c91c/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java -- diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java new file mode 100644 index 000..b04fe6f --- /dev/null +++ b/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java @@ -0,0 +1,126 @@ +/* + * 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.spi;
[11/50] [abbrv] logging-log4j2 git commit: Make sure to not use zero timeout for KafkaManager shutdown
Make sure to not use zero timeout for KafkaManager shutdown Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/78cbb44d Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/78cbb44d Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/78cbb44d Branch: refs/heads/LOG4J2-1390 Commit: 78cbb44ddbbf9f7a80156b555041e41414fa8b1b Parents: 166d3fa Author: Mikael StåldalAuthored: Thu Sep 29 14:04:36 2016 +0200 Committer: Mikael Ståldal Committed: Thu Sep 29 14:04:36 2016 +0200 -- .../log4j/core/appender/mom/kafka/KafkaManager.java | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/78cbb44d/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java -- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java index 9302beb..ded641c 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java @@ -57,6 +57,15 @@ public class KafkaManager extends AbstractManager { @Override public boolean releaseSub(final long timeout, final TimeUnit timeUnit) { +if (timeout > 0) { +closeProducer(timeout, timeUnit); +} else { +closeProducer(timeoutMillis, TimeUnit.MILLISECONDS); +} +return true; +} + +private void closeProducer(final long timeout, final TimeUnit timeUnit) { if (producer != null) { // This thread is a workaround for this Kafka issue: https://issues.apache.org/jira/browse/KAFKA-1660 final Runnable task = new Runnable() { @@ -73,7 +82,6 @@ public class KafkaManager extends AbstractManager { // ignore } } -return true; } public void send(final byte[] msg) throws ExecutionException, InterruptedException, TimeoutException {
[36/50] [abbrv] logging-log4j2 git commit: [LOG4J2-1636] Console Appender does not pick up Oracle Java 8's sun.stdout.encoding and sun.stderr.encoding. This is a partial fix. See discussion in Jira.
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d65bf73c/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index cd2f379..659440d 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -1,3085 +1,3090 @@ - - - -http://maven.apache.org/changes/1.0.0; - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd;> - -Changes - - - - -Fixed ClassCastException when using JUL logging during shutdown. - - -2.7-rc1: RollingFileAppender immediateFlush default value should be true, not false. - - -Improved performance of context data injector for web applications to be on par with standalone applications. - - -Introduced new interface LifeCycle2 with stop(long,TimeUnit) method to avoid breaking backwards compatibility with new Configurator.shutdown(LoggerContext, long, TimeUnit) API. - - -Fixed issue with filters extending AbstractFilter that did not override methods with unrolled varargs. - - -Fixed scrambled log messages triggered by nested logging from toString() method of a logging parameter object. - - -Log4j threads are no longer leaking on Tomcat shutdown. - - -When starting on Google App Engine, Interpolator now suppresses the NoClassDefFoundError stack trace for the jvmrunargs lookup. - - -When initializing on platforms where JMX is not available, Interpolator component no longer prints stack trace for warning messages. - - -Unregistering JMX components no longer prints a stack trace when the MBean has already been unregistered. - - -Support Property values to be specified in configuration as a value attribute as well as an element. - - -(GC) LoggerConfig now stores configuration properties in a List, not a Map to prevent creating temporary Iterator objects. Added method LoggerConfig#getPropertyList(), deprecated method #getProperties(). - - -Fixed class loader deadlock when using async logging and extended stack trace pattern. - - -Fix to prevent Log4j 2.6.2 and higher from losing exceptions when a security manager is present. - - -Fixed issue where LogEvent.getContextStack() returned null. - - -Prevent deadlock in Async Loggers when queue is full and logged Object's toString() logs another message. - - -Prevent ArrayIndexOutOfBoundsException in ParameterizedMessage.formatTo for single-char or empty messages. - - -Fixed issue where AsyncLoggerContextSelector+PropertiesConfigurationBuilder defaulted to includeLocation=true. - - -Prevent SocketAppender memory usage from growing unbounded if it cannot connect to a server. - - -Prevent NPE in Level.isInRange. - - -DynamicThresholdFilter filtered incorrectly when params were passed as individual arguments instead of varargs. - - -[CronTriggeringPolicy] ConfigurationScheduler scheduled the task infinitely after first fire. - - -Log4j should not unregister JMX MBeans when log4j2.disable.jmx property is true. - - -Log4j2 should postpone creating log file until the appender actually receives an event. - - -Support loading custom plugins from jar files and directories whose classpath entries use the "vfs" URL protocol. - - -Fix file handle resource leak in XmlConfiguration.XmlConfiguration(ConfigurationSource). - - -Prevent NPE when dynamically removing filters. - - -Attributes were not merged properly in composite configurations. - - -Attributes were not merged properly in composite configurations. - - -Prevent NPE in RingBufferLogEvent.getFormattedMessage() when used in web applications. - - -Added ability to disable (date) lookup completely for compatibility with other libraries like Camel. - - -Added support for setting StatusLogger destination in ConfigurationBuilder. - - -Allow comma separated agents, host list to be passed to FlumeAppender. - - -Merging configurations failed with an NPE when comparing Nodes with different attributes. - - -Fixed improper header in CsvParameterLayout. - - -Documented that JVM Input Arguments Lookup (JMX) is not available on Google App Engine. - - -(GC) Added method getParameter() to ObjectMessage (and