Return-Path: X-Original-To: apmail-logging-commits-archive@minotaur.apache.org Delivered-To: apmail-logging-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BC11B1063F for ; Tue, 28 Jan 2014 05:03:57 +0000 (UTC) Received: (qmail 73819 invoked by uid 500); 28 Jan 2014 05:03:57 -0000 Delivered-To: apmail-logging-commits-archive@logging.apache.org Received: (qmail 71594 invoked by uid 500); 28 Jan 2014 05:03:50 -0000 Mailing-List: contact commits-help@logging.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@logging.apache.org Delivered-To: mailing list commits@logging.apache.org Received: (qmail 71587 invoked by uid 99); 28 Jan 2014 05:03:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jan 2014 05:03:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jan 2014 05:03:48 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 753BF2388868; Tue, 28 Jan 2014 05:03:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1561937 - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/web/ log4j-core/src/test/java/org/apache/logging/log4j/core/web/ src/changes/ Date: Tue, 28 Jan 2014 05:03:28 -0000 To: commits@logging.apache.org From: nickwilliams@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140128050328.753BF2388868@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nickwilliams Date: Tue Jan 28 05:03:27 2014 New Revision: 1561937 URL: http://svn.apache.org/r1561937 Log: Fixed LOG4J2-344: Changed the Servlet 3.0 auto-initializer to add the filter by class to get around a WebLogic bug. Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/web/Log4jServletContainerInitializer.java logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/web/Log4jServletContainerInitializerTest.java logging/log4j/log4j2/trunk/src/changes/changes.xml Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/web/Log4jServletContainerInitializer.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/web/Log4jServletContainerInitializer.java?rev=1561937&r1=1561936&r2=1561937&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/web/Log4jServletContainerInitializer.java (original) +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/web/Log4jServletContainerInitializer.java Tue Jan 28 05:03:27 2014 @@ -41,7 +41,7 @@ public class Log4jServletContainerInitia servletContext.log("Log4jServletContainerInitializer starting up Log4j in Servlet 3.0+ environment."); final FilterRegistration.Dynamic filter = - servletContext.addFilter("log4jServletFilter", new Log4jServletFilter()); + servletContext.addFilter("log4jServletFilter", Log4jServletFilter.class); if (filter == null) { servletContext.log("WARNING: In a Servlet 3.0+ application, you should not define a " + "log4jServletFilter in web.xml. Log4j 2 normally does this for you automatically. Log4j 2 " + Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/web/Log4jServletContainerInitializerTest.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/web/Log4jServletContainerInitializerTest.java?rev=1561937&r1=1561936&r2=1561937&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/web/Log4jServletContainerInitializerTest.java (original) +++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/web/Log4jServletContainerInitializerTest.java Tue Jan 28 05:03:27 2014 @@ -75,7 +75,7 @@ public class Log4jServletContainerInitia final FilterRegistration.Dynamic registration = createStrictMock(FilterRegistration.Dynamic.class); final Capture listenerCapture = new Capture(); - final Capture filterCapture = new Capture(); + final Capture> filterCapture = new Capture>(); expect(this.servletContext.getMajorVersion()).andReturn(3); expect(this.servletContext.getEffectiveMajorVersion()).andReturn(3); @@ -101,14 +101,14 @@ public class Log4jServletContainerInitia listenerCapture.getValue().getClass()); assertNotNull("The filter should not be null.", filterCapture.getValue()); - assertSame("The filter is not correct.", Log4jServletFilter.class, filterCapture.getValue().getClass()); + assertSame("The filter is not correct.", Log4jServletFilter.class, filterCapture.getValue()); verify(registration); } @Test public void testOnStartupCanceledDueToPreExistingFilter() throws Exception { - final Capture filterCapture = new Capture(); + final Capture> filterCapture = new Capture>(); final Capture logCapture = new Capture(); expect(this.servletContext.getMajorVersion()).andReturn(3); @@ -123,7 +123,7 @@ public class Log4jServletContainerInitia this.containerInitializer.onStartup(null, this.servletContext); assertNotNull("The filter should not be null.", filterCapture.getValue()); - assertSame("The filter is not correct.", Log4jServletFilter.class, filterCapture.getValue().getClass()); + assertSame("The filter is not correct.", Log4jServletFilter.class, filterCapture.getValue()); assertNotNull("The second log message should not be null.", logCapture.getValue()); assertTrue("The second log message (" + logCapture.getValue() + ") is not correct.", @@ -134,7 +134,7 @@ public class Log4jServletContainerInitia public void testOnStartupFailedDueToInitializerFailure() throws Exception { final FilterRegistration.Dynamic registration = createStrictMock(FilterRegistration.Dynamic.class); - final Capture filterCapture = new Capture(); + final Capture> filterCapture = new Capture>(); final UnavailableException exception = new UnavailableException(""); expect(this.servletContext.getMajorVersion()).andReturn(3); @@ -156,7 +156,7 @@ public class Log4jServletContainerInitia } assertNotNull("The filter should not be null.", filterCapture.getValue()); - assertSame("The filter is not correct.", Log4jServletFilter.class, filterCapture.getValue().getClass()); + assertSame("The filter is not correct.", Log4jServletFilter.class, filterCapture.getValue()); verify(registration); } Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1561937&r1=1561936&r2=1561937&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/src/changes/changes.xml (original) +++ logging/log4j/log4j2/trunk/src/changes/changes.xml Tue Jan 28 05:03:27 2014 @@ -163,6 +163,9 @@ ensures behavioral consistency across containers. This includes additional fixes to abort initialization if a duplicate filter already exists and to check the actual Servlet EFFECTIVE version. + + Changed the Servlet 3.0 auto-initializer to add the filter by class to get around a WebLogic bug. +