diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000000..22e41d0717 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,97 @@ +name: Maven CI Build + +on: [push] + +jobs: + JDK6Toolchain: + name: Toolchain 1.6, JDK 11, OS ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-18.04, ubuntu-20.04, windows-2019, windows-2022] + fail-fast: true + max-parallel: 2 + steps: + - uses: actions/checkout@v1 + - name: Install Toolchain JDK + uses: battila7/jdk-via-jabba@v1 + with: + jdk: zulu@1.6.119 + javaHomeEnvironmentVariable: TOOLCHAIN_JDK + addBinDirectoryToPath: false + - name: Configure Maven for Toolchain + shell: bash + run: | + mkdir -p $HOME/.m2 && cat >$HOME/.m2/toolchains.xml < + + + jdk + + 1.6 + oracle + + + ${{ env.TOOLCHAIN_JDK }} + + + + EOF + - name: Set up Modern JDK for Maven + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Run maven build + run: mvn clean verify site assembly:single -B + JDK7Toolchain: + name: Toolchain 1.7, JDK 11, OS ubuntu-18.04 + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v1 + - name: Install Toolchain JDK + uses: battila7/jdk-via-jabba@v1 + with: + jdk: zulu@1.7.292 + javaHomeEnvironmentVariable: TOOLCHAIN_JDK + addBinDirectoryToPath: false + - name: Configure Maven for Toolchain + shell: bash + run: | + mkdir -p $HOME/.m2 && cat >$HOME/.m2/toolchains.xml < + + + jdk + + 1.6 + oracle + + + ${{ env.TOOLCHAIN_JDK }} + + + + EOF + - name: Set up Modern JDK for Maven + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Run maven build + run: mvn clean verify -B + Modern: + name: JDK ${{ matrix.jdk }}, OS ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-18.04, ubuntu-20.04, windows-2019, windows-2022] + jdk: [8, 11, 17] + fail-fast: true + max-parallel: 4 + steps: + - uses: actions/checkout@v1 + - name: Set up Modern JDK for Maven + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.jdk }} + - name: Run maven build + run: mvn clean verify -B -P no-toolchain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..02ccb9d20b --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +target/ +tests/output/ +tests/temp +.idea/ diff --git a/INSTALL b/INSTALL index fecdc441f7..bd3f0dad96 100644 --- a/INSTALL +++ b/INSTALL @@ -1,19 +1,3 @@ - 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. - - =========== Using log4j =========== @@ -73,32 +57,49 @@ except test cases and classes from the "examples" and Building log4j ============== -log4j (as of 1.2.15) is built with Maven 2. To rebuild log4j, -place Maven 2 on the PATH and execute "mvn package". The resulting -jar will be placed in the target subdirectory. +log4j (as of 1.2.18) is built with Maven 3 and JDK 8 or higher. + +To build for compatibility with older JDKs (1.4/5/7), set up a Maven +toolchain JDK with version=1.6 and vendor=oracle. For example set up +the following configuration in ~/.m2/toolchains.xml: + + + + + jdk + + 1.6 + oracle + + + /usr/lib/jvm/java-1.6.0-openjdk-amd64 + + + + + +See https://maven.apache.org/guides/mini/guide-using-toolchains.html +for more information about maven toolchains. + +After setting up a toolchain you can then build using the default +profile: + + mvn verify + +If you do not care about compatibility with old JDKs, you can use a +build without a toolchain and execute -If building with JDK 1.4, one dependency will need to be manually -installed since its license does not allow it to be placed in the -online maven repositories. If not already installed, a build attempt will -describe where to download and how to install the dependency. To -install the dependency: + mvn verify -P no-toolchain -Download JMX 1.2.1 from http://java.sun.com/products/JavaManagement/download.html. +Build results can be found in the target/ subdirectory. -$ jar xf jmx-1_2_1-ri.zip -$ mvn install:install-file -DgroupId=com.sun.jmx -DartifactId=jmxri \ - -Dversion=1.2.1 -Dpackaging=jar -Dfile=jmx-1_2_1-bin/lib/jmxri.jar +================== +NTEventLogAppender +================== +The maven build uses prebuilt NTEventLogAppender.dll and +NTEventLogAppender.amd64.dll binaries. To rebuild these, see -The build script will attempt to build NTEventLogAppender.dll if -MinGW is available on the path. If the unit tests are run on Windows -without NTEventLogAppender.dll, many warnings of the missing DLL -will be generated. An installer for MinGW on Windows is -available for download at http://sourceforge.net/project/showfiles.php?group_id=2435. -MinGW is also available through the package managers of many Linux distributions. + src/ntdll -In case of problems send an e-mail note to -log4j-user@logging.apache.org. Please do not directly e-mail any -log4j developers. The answer to your question might be useful to other -users. Moreover, there are many knowledgeable users on the log4j-user -mailing lists who can quickly answer your questions. +for more information. diff --git a/NOTICE b/NOTICE index d697542317..8a493edeb0 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Apache log4j -Copyright 2010 The Apache Software Foundation +Copyright 2000-2021 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff --git a/NTEventLogAppender.dll b/NTEventLogAppender.dll new file mode 100644 index 0000000000..dab03ac621 Binary files /dev/null and b/NTEventLogAppender.dll differ diff --git a/README.md b/README.md new file mode 100644 index 0000000000..d0d98ee414 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# End Of Life + +On August 5, 2015 the Logging Services Project Management Committee announced that Log4j 1.x had reached end of life. For complete text of the announcement please see the [Apache Blog](https://blogs.apache.org/foundation/entry/apache_logging_services_project_announces). Users of Log4j 1 are recommended to upgrade to [Apache Log4j 2](https://logging.apache.org/log4j/2.x/index.html). + +# Security release 1.2.18 + +Several security vulnerabilities have been identified in Log4J 1 up to and including 1.2.17. All users should upgrade to Log4J 2. For users that cannot upgrade, certain fixes are made available here. Please note Log4J 1 remains End Of Life. + +See [the log4j 1.2 website](https://logging.apache.org/log4j/1.2/) for more information. + +## Changes in 1.2.18 + +See the [Changes Report](https://logging.apache.org/log4j/1.2/changes-report.html) for a detailed list of changes. This file is generated from [changes.xml](src/changes/changes.xml). diff --git a/build.properties.sample b/build.properties.sample deleted file mode 100644 index 101a6c49eb..0000000000 --- a/build.properties.sample +++ /dev/null @@ -1,71 +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. -# -# - -# -# Providing a build.properties file is no longer -# necessary for an Ant build as long as one Maven build -# has previously been performed. -# - - -# base location of support directories -# -lib.home.dir=/java - -# The jaxp interface and a jaxp parser are required -# to build the DOMConfigurator. -# -# modern equivalent is xml-commons-apis.jar -# -jaxp.home=${lib.home.dir}/crimson-1.1.3 -jaxp.jaxp.jar=${jaxp.home}/crimson.jar - -# JavaMail API Required to build the SMTPAppender -javamail.jar=${lib.home.dir}/javamail-1.3.2/mail.jar - -# and JavaBeans Activation Framework -# http://java.sun.com/products/javabeans/jaf/index.jsp -activation.jar=${lib.home.dir}/jaf-1.0.2/activation.jar - - -# JMS interfaces are required to be on the classpath -# in order to build the JMSAppender. -jms.jar=${lib.home.dir}/jms1.1/lib/jms.jar - -# Required to build the org.apache.log4j.jmx package. -jmx.home.dir=${lib.home.dir}/jmx-1_2_1-bin -jmx.jar=${jmx.home.dir}/lib/jmxri.jar -jndi.jar=${lib.home.dir}/jndi-1_2_1/lib/jndi.jar - -# Required to run Checkstyle. Available from http://checkstyle.sf.net -checkstyle.jar=${lib.home.dir}/checkstyle-2.2/checkstyle-all-2.2.jar - -# Velocity's Anakia task is used in the generation of the documentation -# download from http://jakarta.apache.org -velocity.jar=${lib.home.dir}/velocity-1.4/velocity-dep-1.4.jar -# Velocity's Anakia task requires JDOM, -# but Velocity 1.4 is not compatible with JDOM 1.0, but beta 8 works okay -# download for http://www.jdom.org/dist/binary/archive -jdom.jar=${lib.home.dir}/jdom-b8/build/jdom.jar - - -# -# CLIRR binary compatibility checker -# http://clirr.sourceforge.net -clirr-core.jar=${lib.home.dir}/clirr-0.6/clirr-core-0.6.jar -# bcel 5.1 will throw NullPointerExceptions -bcel.jar=${lib.home.dir}/bcel-5.2/bcel-5.2.jar diff --git a/build.xml b/build.xml deleted file mode 100644 index 4fbda3d6dd..0000000000 --- a/build.xml +++ /dev/null @@ -1,804 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - These are the targets supported by this ANT build scpript: - - build - compile all project files, if a certain library is missing, - then the compilation of its dependents are skipped. - - javadoc - build project javadoc files - - jar - build log4j-core and log4j jar files - - dist - will create a complete distribution in dist/ - Setting the env variable NO_JAVADOC will build the distribution - without running the javadoc target. - - release - will create a complete distribution in dist/ - using stricter settings for public distribution. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- -
-
- - - - - - - - - - - - - -
- - - -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - clirr-core-${clirr.version}.jar not in maven repo. Run mvn clirr:check to download. - - - - bcel-${bcel.version}.jar not in maven repo. Run mvn clirr:check to download. - - - - log4j-${reference.version}.jar not in maven repo. Run mvn clirr:check to download. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- diff --git a/pom.xml b/pom.xml index 93881cd3a3..1de0d47945 100644 --- a/pom.xml +++ b/pom.xml @@ -15,34 +15,20 @@ limitations under the License. --> - - + 4.0.0 log4j log4j bundle Apache Log4j - 1.2.17 - Apache Log4j 1.2 + 1.2.18-SNAPSHOT + Apache Log4j 1.2 (UNMAINTAINED) http://logging.apache.org/log4j/1.2/ - Bugzilla - https://issues.apache.org/bugzilla/describecomponents.cgi?product=Log4j + GitHub + https://github.com/apache/log4j/issues - - Gump - http://vmgump.apache.org/gump/public/logging-log4j-12/logging-log4j-12/index.html - 1999 @@ -50,122 +36,99 @@ target platform and specify -Dntdll_target=msbuild on the mvn command line. log4j-user-subscribe@logging.apache.org log4j-user-unsubscribe@logging.apache.org log4j-user@logging.apache.org - http://mail-archives.apache.org/mod_mbox/logging-log4j-user/ - - http://marc.info/?l=log4j-user - http://dir.gmane.org/gmane.comp.jakarta.log4j.user - + https://lists.apache.org/list.html?log4j-user@logging.apache.org log4j-dev - log4j-dev-subscribe@logging.apache.org - log4j-dev-unsubscribe@logging.apache.org - log4j-dev@logging.apache.org - http://mail-archives.apache.org/mod_mbox/logging-log4j-dev/ - - http://marc.info/?l=log4j-dev - http://dir.gmane.org/gmane.comp.jakarta.log4j.devel - + dev-subscribe@logging.apache.org + dev-unsubscribe@logging.apache.org + dev@logging.apache.org + https://lists.apache.org/list.html?dev@logging.apache.org - The Apache Software License, Version 2.0 + Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt repo - scm:svn:http://svn.apache.org/repos/asf/logging/log4j/tags/v1_2_17_rc3 - scm:svn:https://svn.apache.org/repos/asf/logging/log4j/tags/v1_2_17_rc3 - http://svn.apache.org/viewvc/logging/log4j/tags/v1_2_17_rc3 + scm:git:https://github.com/apache/log4j + scm:git:https://github.com/apache/log4j + https://github.com/apache/log4j Apache Software Foundation http://www.apache.org + + UTF-8 + UTF-8 + org.apache.maven.plugins maven-resources-plugin + 3.2.0 UTF-8 - - - maven-surefire-plugin - 2.5 - - tests - plain - pertest - true - - org/apache/log4j/LevelTest.java - org/apache/log4j/PriorityTest.java - org/apache/log4j/CategoryTest.java - org/apache/log4j/FileAppenderTest.java - org/apache/log4j/LogManagerTest.java - org/apache/log4j/helpers.LogLogTest.java - org/apache/log4j/LayoutTest.java - org/apache/log4j/helpers.DateLayoutTest.java - org/apache/log4j/TTCCLayoutTest.java - org/apache/log4j/xml.XMLLayoutTest.java - org/apache/log4j/HTMLLayoutTest.java - org/apache/log4j/PatternLayoutTest.java - org/apache/log4j/spi.LoggingEventTest.java - org/apache/log4j/spi.ThrowableInformationTest.java - org/apache/log4j/spi.LocationInfoTest.java - org/apache/log4j/PropertyConfiguratorTest.java - org/apache/log4j/MinimumTestCase.java - org/apache/log4j/LoggerTestCase.java - org/apache/log4j/PatternLayoutTestCase.java - org/apache/log4j/HierarchyThresholdTestCase.java - org/apache/log4j/xml/DOMTestCase.java - org/apache/log4j/xml/CustomLevelTestCase.java - org/apache/log4j/customLogger/XLoggerTestCase.java - - - org/apache/log4j/xml/XMLLayoutTestCase.java - org/apache/log4j/xml/AsyncAppenderTestCase.java - org/apache/log4j/varia/LevelMatchFilterTestCase.java - - - org/apache/log4j/helpers/BoundedFIFOTestCase.java - org/apache/log4j/helpers/CyclicBufferTestCase.java - org/apache/log4j/helpers/PatternParserTestCase.java - org/apache/log4j/or/ORTestCase.java - org/apache/log4j/DRFATestCase.java - org/apache/log4j/RFATestCase.java - org/apache/log4j/varia/ERFATestCase.java - org/apache/log4j/net/SyslogAppenderTest - org/apache/log4j/nt/NTEventLogAppenderTest - org/apache/log4j/net/SocketAppenderTest - - - - - maven-compiler-plugin - 2.1 - - 1.4 - 1.4 - UTF-8 - + + + javadoc.resources + pre-site + + copy-resources + + + ${project.build.directory}/apidocs/META-INF + + + ${project.basedir} + false + + LICENSE + NOTICE + README.md + + + + + + + ntdll.resources + process-resources + + copy-resources + + + ${project.build.directory} + + + ${project.basedir} + false + + NTEventLogAppender.dll + NTEventLogAppender.amd64.dll + + + + + + maven-jar-plugin - 2.3 + 3.2.0 - org.apache.log4j + org/apache/log4j/ - * + * log4j ${project.version} "Apache Software Foundation" @@ -177,195 +140,55 @@ target platform and specify -Dntdll_target=msbuild on the mvn command line. maven-antrun-plugin - 1.2 + 3.0.0 - - - process-classes - ntdll - - - - - - - - - - - - run - - - - - test-compile - mkdir_tests_output - - - - - - - run - - - - clean - rmdir_tests_output - - - - - - - - run - - - - test - runAll - - - - - - - - - - - run - - - site untag-site - + - - + run - - post-site - post-site - - - - - - - run - - - - site-deploy - site-deploy - - - - - - - run - - - - javadoc.resources - generate-sources - - run - - - - - - - - - - - - - - - ant - ant-nodeps - 1.6.5 - - - ant-contrib - ant-contrib - 1.0b2 - - - ant - ant-junit - 1.6.5 - - - junit - junit - 3.8.1 - compile - - - sun.jdk - tools - 1.4.2 - system - ${tools.jar} - - maven-assembly-plugin - 2.2-beta-5 + 3.3.0 src/assembly/bin.xml false - - - - assembly - - - - maven-javadoc-plugin - 2.7 + 3.3.1 true .svn UTF-8 - UTF-8 + javadoc-package + pre-package jar javadoc - site - pre-site + javadoc-site + pre-site javadoc @@ -374,18 +197,14 @@ target platform and specify -Dntdll_target=msbuild on the mvn command line. maven-release-plugin - 2.0-beta-9 - + 3.0.0-M4 - package site-deploy assembly:attached deploy + package site-deploy deploy maven-source-plugin - 2.1.1 + 3.2.0 @@ -394,74 +213,130 @@ target platform and specify -Dntdll_target=msbuild on the mvn command line. - - org.codehaus.mojo - clirr-maven-plugin - 2.2.2 + + com.github.siom79.japicmp + japicmp-maven-plugin + 0.15.4 - 1.2.15 + + + log4j + log4j + 1.2.17 + jar + + + + + ${project.build.directory}/${project.artifactId}-${project.version}.jar + + + + true + true + true + true + false + + javax\.mail\..* + + + + + japicmp-verify + verify + + cmp + + + - org.codehaus.mojo - rat-maven-plugin - 1.0-alpha-3 + org.apache.rat + apache-rat-plugin + 0.13 - - tests/witness/** - tests/output/** - tests/classes/** - + + tests/witness/** + tests/output/** + tests/classes/** + + + org.apache.felix + maven-bundle-plugin + 5.1.3 + true + + + org.apache.log4j + + + !org.apache.log4j.lf5.*, + !org.apache.log4j.chainsaw.*, + org.apache.log4j.*;version=${project.version};-noimport:=true + + + + !javax.swing.*, + !com.ibm.uvm.tools.*, + !com.sun.jdmk.comm.*, + javax.jmdns.*;resolution:=optional, + javax.jms.*;resolution:=optional, + javax.mail.*;resolution:=optional, + * + + http://logging.apache.org/log4j/1.2 + registered + J2SE-1.4 + + + - org.apache.felix - maven-bundle-plugin - 2.1.0 - true + maven-site-plugin + 3.9.1 - - - !org.apache.log4j.lf5.*, - !org.apache.log4j.chainsaw.*, - org.apache.log4j.*;version=1.2.17;-noimport:=true - - !javax.swing.*, - !com.ibm.uvm.tools.*, - !com.sun.jdmk.comm.*, - javax.jmdns.*;resolution:=optional, - javax.jms.*;resolution:=optional, - javax.mail.*;resolution:=optional, - * - http://logging.apache.org/log4j/1.2 - + ${basedir}/src/site/site-template.vm - maven-site-plugin - 3.1 + maven-clean-plugin + 3.1.0 - ${basedir}/src/site/maven-site.vm - true + + + ${basedir}/tests/output + false + + + ${basedir}/tests + false + + temp + + + - - - package - - site - - - tests/src/java + + + ${project.basedir}/src/main/resources + + + META-INF + false + ${project.basedir} + + LICENSE + NOTICE + + + tests/resources @@ -470,79 +345,43 @@ target platform and specify -Dntdll_target=msbuild on the mvn command line. - + maven-project-info-reports-plugin - 2.4 + 3.1.2 - + - scm - dependencies - cim - issue-tracking - mailing-list - license + scm + dependencies + mailing-lists - + - - + + maven-jxr-plugin - 2.1 - - + 3.1.1 + + maven-changes-plugin - 2.7 + 2.12.1 - + - changes-report + changes-report - + - + - - - mac - - - mac - - - - ${java.home}/../Classes/classes.jar - ${user.home}/.m2/repository - build - - - - default - - true - - - ${java.home}/../lib/tools.jar - ${user.home}/.m2/repository - build - - - - - - maven2-repository.dev.java.net - Java.net Repository for Maven - http://download.java.net/maven/2/ - default - - javax.mail mail 1.4.3 true + provided org.apache.openejb @@ -551,14 +390,6 @@ target platform and specify -Dntdll_target=msbuild on the mvn command line. jar provided - oro oro @@ -577,7 +408,7 @@ target platform and specify -Dntdll_target=msbuild on the mvn command line. 1.0 true - + logging.repo @@ -588,5 +419,130 @@ target platform and specify -Dntdll_target=msbuild on the mvn command line. scp://localhost/${user.dir}/target/site-deploy + + + no-toolchain + + + + maven-compiler-plugin + 3.8.1 + + 7 + 7 + UTF-8 + + + + maven-surefire-plugin + 2.22.2 + + tests + plain + pertest + false + -Djava.library.path=${project.basedir} + + **/AsyncAppenderTestCase.java + **/DRFATestCase.java + **/EnhancedPatternLayoutTestCase.java + **/MinimumTestCase.java + **/PatternLayoutTestCase.java + **/TestLogMF.java + **/XLoggerTestCase.java + **/ErrorHandlerTestCase.java + **/DOMTestCase.java + **/XMLLayoutTestCase.java + + + + + com.soebes.maven.plugins + echo-maven-plugin + 0.4.0 + + + echo-toolchain-warning + validate + + echo + + + + WARNING: + WARNING: + WARNING: + WARNING: ========================================================= + WARNING: You are using a modern JDK without the toolchain profile. + WARNING: Resulting jar files will not work with old JDKs! + WARNING: ========================================================= + WARNING: + WARNING: + WARNING: + + + + + + + maven-javadoc-plugin + + false + false + + + + + + + toolchain + + true + + + + + org.apache.maven.plugins + maven-toolchains-plugin + 1.1 + + + + toolchain + + + + + + + 1.6 + oracle + + + + + + maven-compiler-plugin + 3.8.1 + + 1.4 + 1.4 + UTF-8 + + + + maven-surefire-plugin + 2.22.2 + + tests + plain + pertest + false + -Djava.library.path=${project.basedir} + + + + + + - diff --git a/src/assembly/bin.xml b/src/assembly/bin.xml index e0d085f516..1e2e9990c9 100644 --- a/src/assembly/bin.xml +++ b/src/assembly/bin.xml @@ -29,6 +29,7 @@ *.txt *.sample *.xml + README.md INSTALL KEYS LICENSE @@ -57,7 +58,7 @@ target/log4j-${project.version}.jar - target/NTEventLogAppender.dll + NTEventLogAppender.dll 0755 diff --git a/src/main/java/org/apache/log4j/MDC.java b/src/main/java/org/apache/log4j/MDC.java index a654b48e9f..b6b89960ee 100644 --- a/src/main/java/org/apache/log4j/MDC.java +++ b/src/main/java/org/apache/log4j/MDC.java @@ -58,9 +58,7 @@ public class MDC { private MDC() { java1 = Loader.isJava1(); - if(!java1) { - tlm = new ThreadLocalMap(); - } + tlm = new ThreadLocalMap(); try { removeMethod = ThreadLocal.class.getMethod("remove", null); diff --git a/src/main/java/org/apache/log4j/chainsaw/Main.java b/src/main/java/org/apache/log4j/chainsaw/Main.java index c0c9aad71a..f4dfd79393 100644 --- a/src/main/java/org/apache/log4j/chainsaw/Main.java +++ b/src/main/java/org/apache/log4j/chainsaw/Main.java @@ -44,6 +44,8 @@ public class Main extends JFrame { + private static final long serialVersionUID = 6679218458268861656L; + /** the default port number to listen on **/ private static final int DEFAULT_PORT = 4445; diff --git a/src/main/java/org/apache/log4j/helpers/Loader.java b/src/main/java/org/apache/log4j/helpers/Loader.java index 207bfdf90e..209bc04fbb 100644 --- a/src/main/java/org/apache/log4j/helpers/Loader.java +++ b/src/main/java/org/apache/log4j/helpers/Loader.java @@ -33,21 +33,12 @@ public class Loader { static final String TSTR = "Caught Exception while in Loader.getResource. This may be innocuous."; - // We conservatively assume that we are running under Java 1.x - static private boolean java1 = true; + // We are on java 1.2+ since we compile with source/target >1.4 + static private boolean java1 = false; static private boolean ignoreTCL = false; static { - String prop = OptionConverter.getSystemProperty("java.version", null); - - if(prop != null) { - int i = prop.indexOf('.'); - if(i != -1) { - if(prop.charAt(i+1) != '1') - java1 = false; - } - } String ignoreTCLProp = OptionConverter.getSystemProperty("log4j.ignoreTCL", null); if(ignoreTCLProp != null) { ignoreTCL = OptionConverter.toBoolean(ignoreTCLProp, true); diff --git a/src/main/java/org/apache/log4j/helpers/SyslogWriter.java b/src/main/java/org/apache/log4j/helpers/SyslogWriter.java index d6ce4bf6de..a949fef026 100644 --- a/src/main/java/org/apache/log4j/helpers/SyslogWriter.java +++ b/src/main/java/org/apache/log4j/helpers/SyslogWriter.java @@ -92,6 +92,10 @@ public class SyslogWriter extends Writer { try { this.address = InetAddress.getByName(host); + if(!this.address.isLoopbackAddress()) { + LogLog.warn("WARN-LOG4J-NETWORKING-REMOTE-SYSLOG: logging to remote syslog host '" + + syslogHost + "'! Syslog is an unencrypted protocol."); + } } catch (UnknownHostException e) { LogLog.error("Could not find " + host + diff --git a/src/main/java/org/apache/log4j/jdbc/JDBCAppender.java b/src/main/java/org/apache/log4j/jdbc/JDBCAppender.java index ad35f657b9..da841d372b 100644 --- a/src/main/java/org/apache/log4j/jdbc/JDBCAppender.java +++ b/src/main/java/org/apache/log4j/jdbc/JDBCAppender.java @@ -17,382 +17,127 @@ package org.apache.log4j.jdbc; import java.sql.Connection; -import java.sql.DriverManager; import java.sql.SQLException; -import java.sql.Statement; import java.util.ArrayList; -import java.util.Iterator; -import org.apache.log4j.PatternLayout; -import org.apache.log4j.spi.ErrorCode; +import org.apache.log4j.helpers.LogLog; import org.apache.log4j.spi.LoggingEvent; /** - The JDBCAppender provides for sending log events to a database. - -

WARNING: This version of JDBCAppender - is very likely to be completely replaced in the future. Moreoever, - it does not log exceptions. - -

Each append call adds to an ArrayList buffer. When - the buffer is filled each log event is placed in a sql statement - (configurable) and executed. - - BufferSize, db URL, User, & Password are - configurable options in the standard log4j ways. - -

The setSql(String sql) sets the SQL statement to be - used for logging -- this statement is sent to a - PatternLayout (either created automaticly by the - appender or added by the user). Therefore by default all the - conversion patterns in PatternLayout can be used - inside of the statement. (see the test cases for examples) - -

Overriding the {@link #getLogStatement} method allows more - explicit control of the statement used for logging. - -

For use as a base class: - -

    - -
  • Override getConnection() to pass any connection - you want. Typically this is used to enable application wide - connection pooling. - -
  • Override closeConnection(Connection con) -- if - you override getConnection make sure to implement - closeConnection to handle the connection you - generated. Typically this would return the connection to the - pool it came from. + The JDBCAppender provides for sending log events to a database + in Log4j up to 1.2.17. -
  • Override getLogStatement(LoggingEvent event) to - produce specialized or dynamic statements. The default uses the - sql option value. - -
- - @author Kevin Steppe (ksteppe@pacbell.net) + Changed in 1.2.18+ to complain about its use and do nothing else. + See the log4j 1.2 homepage + for more information on why this class is disabled since 1.2.18. + @author Kevin Steppe (ksteppe@pacbell.net) + @deprecated */ -public class JDBCAppender extends org.apache.log4j.AppenderSkeleton - implements org.apache.log4j.Appender { +public class JDBCAppender extends org.apache.log4j.AppenderSkeleton { + + static final String JDBC_UNSUPPORTED = + "ERROR-LOG4J-NETWORKING-UNSUPPORTED: JDBC unsupported!" + + " This is a breaking change in Log4J 1 >=1.2.18. Change your config to stop using JDBC!"; - /** - * URL of the DB for default connection handling - */ protected String databaseURL = "jdbc:odbc:myDB"; - /** - * User to connect as for default connection handling - */ protected String databaseUser = "me"; - /** - * User to use for default connection handling - */ protected String databasePassword = "mypassword"; - /** - * Connection used by default. The connection is opened the first time it - * is needed and then held open until the appender is closed (usually at - * garbage collection). This behavior is best modified by creating a - * sub-class and overriding the getConnection and - * closeConnection methods. - */ protected Connection connection = null; - /** - * Stores the string given to the pattern layout for conversion into a SQL - * statement, eg: insert into LogTable (Thread, Class, Message) values - * ("%t", "%c", "%m"). - * - * Be careful of quotes in your messages! - * - * Also see PatternLayout. - */ protected String sqlStatement = ""; - /** - * size of LoggingEvent buffer before writting to the database. - * Default is 1. - */ protected int bufferSize = 1; - /** - * ArrayList holding the buffer of Logging Events. - */ protected ArrayList buffer; - /** - * Helper object for clearing out the buffer - */ protected ArrayList removes; - private boolean locationInfo = false; - public JDBCAppender() { - super(); - buffer = new ArrayList(bufferSize); - removes = new ArrayList(bufferSize); + LogLog.error(JDBC_UNSUPPORTED); } - /** - * Gets whether the location of the logging request call - * should be captured. - * - * @since 1.2.16 - * @return the current value of the LocationInfo option. - */ public boolean getLocationInfo() { - return locationInfo; + return false; } - /** - * The LocationInfo option takes a boolean value. By default, it is - * set to false which means there will be no effort to extract the location - * information related to the event. As a result, the event that will be - * ultimately logged will likely to contain the wrong location information - * (if present in the log format). - *

- *

- * Location information extraction is comparatively very slow and should be - * avoided unless performance is not a concern. - *

- * @since 1.2.16 - * @param flag true if location information should be extracted. - */ public void setLocationInfo(final boolean flag) { - locationInfo = flag; } - - /** - * Adds the event to the buffer. When full the buffer is flushed. - */ public void append(LoggingEvent event) { - event.getNDC(); - event.getThreadName(); - // Get a copy of this thread's MDC. - event.getMDCCopy(); - if (locationInfo) { - event.getLocationInformation(); - } - event.getRenderedMessage(); - event.getThrowableStrRep(); - buffer.add(event); - - if (buffer.size() >= bufferSize) - flushBuffer(); + errorHandler.error(JDBC_UNSUPPORTED); } - /** - * By default getLogStatement sends the event to the required Layout object. - * The layout will format the given pattern into a workable SQL string. - * - * Overriding this provides direct access to the LoggingEvent - * when constructing the logging statement. - * - */ protected String getLogStatement(LoggingEvent event) { - return getLayout().format(event); + throw new IllegalStateException(JDBC_UNSUPPORTED); } - /** - * - * Override this to provide an alertnate method of getting - * connections (such as caching). One method to fix this is to open - * connections at the start of flushBuffer() and close them at the - * end. I use a connection pool outside of JDBCAppender which is - * accessed in an override of this method. - * */ protected void execute(String sql) throws SQLException { - - Connection con = null; - Statement stmt = null; - - try { - con = getConnection(); - - stmt = con.createStatement(); - stmt.executeUpdate(sql); - } finally { - if(stmt != null) { - stmt.close(); - } - closeConnection(con); - } - - //System.out.println("Execute: " + sql); + throw new IllegalStateException(JDBC_UNSUPPORTED); } - - /** - * Override this to return the connection to a pool, or to clean up the - * resource. - * - * The default behavior holds a single connection open until the appender - * is closed (typically when garbage collected). - */ protected void closeConnection(Connection con) { } - /** - * Override this to link with your connection pooling system. - * - * By default this creates a single connection which is held open - * until the object is garbage collected. - */ protected Connection getConnection() throws SQLException { - if (!DriverManager.getDrivers().hasMoreElements()) - setDriver("sun.jdbc.odbc.JdbcOdbcDriver"); - - if (connection == null) { - connection = DriverManager.getConnection(databaseURL, databaseUser, - databasePassword); - } - - return connection; + throw new SQLException(JDBC_UNSUPPORTED); } - /** - * Closes the appender, flushing the buffer first then closing the default - * connection if it is open. - */ public void close() { - flushBuffer(); - - try { - if (connection != null && !connection.isClosed()) - connection.close(); - } catch (SQLException e) { - errorHandler.error("Error closing connection", e, ErrorCode.GENERIC_FAILURE); - } - this.closed = true; } - /** - * loops through the buffer of LoggingEvents, gets a - * sql string from getLogStatement() and sends it to execute(). - * Errors are sent to the errorHandler. - * - * If a statement fails the LoggingEvent stays in the buffer! - */ public void flushBuffer() { - //Do the actual logging - removes.ensureCapacity(buffer.size()); - for (Iterator i = buffer.iterator(); i.hasNext();) { - LoggingEvent logEvent = (LoggingEvent)i.next(); - try { - String sql = getLogStatement(logEvent); - execute(sql); - } - catch (SQLException e) { - errorHandler.error("Failed to excute sql", e, - ErrorCode.FLUSH_FAILURE); - } finally { - removes.add(logEvent); - } - } - - // remove from the buffer any events that were reported - buffer.removeAll(removes); - - // clear the buffer of reported events - removes.clear(); } - - /** closes the appender before disposal */ public void finalize() { - close(); } - - /** - * JDBCAppender requires a layout. - * */ public boolean requiresLayout() { return true; } - - /** - * - */ - public void setSql(String s) { - sqlStatement = s; - if (getLayout() == null) { - this.setLayout(new PatternLayout(s)); - } - else { - ((PatternLayout)getLayout()).setConversionPattern(s); - } + public void setSql(String sql) { } - - /** - * Returns pre-formated statement eg: insert into LogTable (msg) values ("%m") - */ public String getSql() { - return sqlStatement; + return null; } - public void setUser(String user) { - databaseUser = user; } public void setURL(String url) { - databaseURL = url; } public void setPassword(String password) { - databasePassword = password; } - public void setBufferSize(int newBufferSize) { - bufferSize = newBufferSize; - buffer.ensureCapacity(bufferSize); - removes.ensureCapacity(bufferSize); } - public String getUser() { - return databaseUser; + return null; } - public String getURL() { - return databaseURL; + return null; } - public String getPassword() { - return databasePassword; + return null; } - public int getBufferSize() { - return bufferSize; + return 0; } - - /** - * Ensures that the given driver class has been loaded for sql connection - * creation. - */ public void setDriver(String driverClass) { - try { - Class.forName(driverClass); - } catch (Exception e) { - errorHandler.error("Failed to load driver", e, - ErrorCode.GENERIC_FAILURE); - } } } - diff --git a/src/main/java/org/apache/log4j/jmx/Agent.java b/src/main/java/org/apache/log4j/jmx/Agent.java index 9bf3c1a898..58d5542fef 100644 --- a/src/main/java/org/apache/log4j/jmx/Agent.java +++ b/src/main/java/org/apache/log4j/jmx/Agent.java @@ -28,11 +28,11 @@ /** - * Manages an instance of com.sun.jdmk.comm.HtmlAdapterServer which - * was provided for demonstration purposes in the - * Java Management Extensions Reference Implementation 1.2.1. - * This class is provided to maintain compatibility with earlier - * versions of log4j and use in new code is discouraged. + * Manages an instance of com.sun.jdmk.comm.HtmlAdapterServer in Log4j up to 1.2.17. + * + * Changed in 1.2.18+ to complain about its use and do nothing else. + * See the log4j 1.2 homepage + * for more information on why this class is disabled since 1.2.18. * * @deprecated */ @@ -57,20 +57,10 @@ public Agent() { * * @since 1.2.16 * @return new instance. + * @deprecated */ private static Object createServer() { - Object newInstance = null; - try { - newInstance = Class.forName( - "com.sun.jdmk.comm.HtmlAdapterServer").newInstance(); - } catch (ClassNotFoundException ex) { - throw new RuntimeException(ex.toString()); - } catch (InstantiationException ex) { - throw new RuntimeException(ex.toString()); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex.toString()); - } - return newInstance; + throw new RuntimeException("JMX / HtmlAdapterServer no longer supported"); } /** @@ -78,54 +68,18 @@ private static Object createServer() { * * @since 1.2.16 * @param server instance of com.sun.jdmk.comm.HtmlAdapterServer. + * @deprecated */ private static void startServer(final Object server) { - try { - server.getClass().getMethod("start", new Class[0]). - invoke(server, new Object[0]); - } catch(InvocationTargetException ex) { - Throwable cause = ex.getTargetException(); - if (cause instanceof RuntimeException) { - throw (RuntimeException) cause; - } else if (cause != null) { - if (cause instanceof InterruptedException - || cause instanceof InterruptedIOException) { - Thread.currentThread().interrupt(); - } - throw new RuntimeException(cause.toString()); - } else { - throw new RuntimeException(); - } - } catch(NoSuchMethodException ex) { - throw new RuntimeException(ex.toString()); - } catch(IllegalAccessException ex) { - throw new RuntimeException(ex.toString()); - } + throw new RuntimeException("JMX / HtmlAdapterServer no longer supported"); } /** * Starts instance of HtmlAdapterServer. * @deprecated - */ + */ public void start() { - - MBeanServer server = MBeanServerFactory.createMBeanServer(); - Object html = createServer(); - - try { - log.info("Registering HtmlAdaptorServer instance."); - server.registerMBean(html, new ObjectName("Adaptor:name=html,port=8082")); - log.info("Registering HierarchyDynamicMBean instance."); - HierarchyDynamicMBean hdm = new HierarchyDynamicMBean(); - server.registerMBean(hdm, new ObjectName("log4j:hiearchy=default")); - } catch(JMException e) { - log.error("Problem while registering MBeans instances.", e); - return; - } catch(RuntimeException e) { - log.error("Problem while registering MBeans instances.", e); - return; - } - startServer(html); + throw new RuntimeException("JMX / HtmlAdapterServer no longer supported"); } } diff --git a/src/main/java/org/apache/log4j/net/JMSAppender.java b/src/main/java/org/apache/log4j/net/JMSAppender.java index 3482702d4f..a555796191 100644 --- a/src/main/java/org/apache/log4j/net/JMSAppender.java +++ b/src/main/java/org/apache/log4j/net/JMSAppender.java @@ -19,425 +19,151 @@ import org.apache.log4j.AppenderSkeleton; import org.apache.log4j.helpers.LogLog; -import org.apache.log4j.spi.ErrorCode; import org.apache.log4j.spi.LoggingEvent; -import javax.jms.JMSException; -import javax.jms.ObjectMessage; -import javax.jms.Session; -import javax.jms.Topic; import javax.jms.TopicConnection; -import javax.jms.TopicConnectionFactory; import javax.jms.TopicPublisher; import javax.jms.TopicSession; import javax.naming.Context; -import javax.naming.InitialContext; import javax.naming.NameNotFoundException; import javax.naming.NamingException; -import java.util.Properties; /** - * A simple appender that publishes events to a JMS Topic. The events - * are serialized and transmitted as JMS message type {@link - * ObjectMessage}. - - *

JMS {@link Topic topics} and {@link TopicConnectionFactory topic - * connection factories} are administered objects that are retrieved - * using JNDI messaging which in turn requires the retrieval of a JNDI - * {@link Context}. - - *

There are two common methods for retrieving a JNDI {@link - * Context}. If a file resource named jndi.properties is - * available to the JNDI API, it will use the information found - * therein to retrieve an initial JNDI context. To obtain an initial - * context, your code will simply call: - -

-   InitialContext jndiContext = new InitialContext();
-   
- - *

Calling the no-argument InitialContext() method - * will also work from within Enterprise Java Beans (EJBs) because it - * is part of the EJB contract for application servers to provide each - * bean an environment naming context (ENC). - - *

In the second approach, several predetermined properties are set - * and these properties are passed to the InitialContext - * constructor to connect to the naming service provider. For example, - * to connect to JBoss naming service one would write: - -

-   Properties env = new Properties( );
-   env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
-   env.put(Context.PROVIDER_URL, "jnp://hostname:1099");
-   env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
-   InitialContext jndiContext = new InitialContext(env);
-
- - * where hostname is the host where the JBoss application - * server is running. - * - *

To connect to the the naming service of Weblogic application - * server one would write: - -

-   Properties env = new Properties( );
-   env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
-   env.put(Context.PROVIDER_URL, "t3://localhost:7001");
-   InitialContext jndiContext = new InitialContext(env);
-
- - *

Other JMS providers will obviously require different values. - * - * The initial JNDI context can be obtained by calling the - * no-argument InitialContext() method in EJBs. Only - * clients running in a separate JVM need to be concerned about the - * jndi.properties file and calling {@link - * InitialContext#InitialContext()} or alternatively correctly - * setting the different properties before calling {@link - * InitialContext#InitialContext(java.util.Hashtable)} method. - - - @author Ceki Gülcü */ + * A simple appender that used to publish to a JMS Topic in Log4j up to 1.2.17. + * + * Changed in 1.2.18+ to complain about its use and do nothing else. + * See the log4j 1.2 homepage + * for more information on why this class is disabled since 1.2.18. + * + * @author Ceki Gülcü + * @deprecated + * @noinspection unused + */ public class JMSAppender extends AppenderSkeleton { - String securityPrincipalName; - String securityCredentials; - String initialContextFactoryName; - String urlPkgPrefixes; - String providerURL; - String topicBindingName; - String tcfBindingName; - String userName; - String password; - boolean locationInfo; - - TopicConnection topicConnection; - TopicSession topicSession; - TopicPublisher topicPublisher; + static final String JMS_UNSUPPORTED = + "ERROR-LOG4J-NETWORKING-UNSUPPORTED: JMS unsupported!" + + " This is a breaking change in Log4J 1 >=1.2.18. Change your config to stop using JMS!"; public JMSAppender() { + LogLog.error(JMS_UNSUPPORTED); } - /** - The TopicConnectionFactoryBindingName option takes a - string value. Its value will be used to lookup the appropriate - TopicConnectionFactory from the JNDI context. - */ public void setTopicConnectionFactoryBindingName(String tcfBindingName) { - this.tcfBindingName = tcfBindingName; } - /** - Returns the value of the TopicConnectionFactoryBindingName option. - */ public String getTopicConnectionFactoryBindingName() { - return tcfBindingName; + return null; } - /** - The TopicBindingName option takes a - string value. Its value will be used to lookup the appropriate - Topic from the JNDI context. - */ public void setTopicBindingName(String topicBindingName) { - this.topicBindingName = topicBindingName; } - /** - Returns the value of the TopicBindingName option. - */ public String getTopicBindingName() { - return topicBindingName; + return null; } - - /** - Returns value of the LocationInfo property which - determines whether location (stack) info is sent to the remote - subscriber. */ public boolean getLocationInfo() { - return locationInfo; + return false; } - /** - * Options are activated and become effective only after calling - * this method.*/ public void activateOptions() { - TopicConnectionFactory topicConnectionFactory; - - try { - Context jndi; - - LogLog.debug("Getting initial context."); - if(initialContextFactoryName != null) { - Properties env = new Properties( ); - env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName); - if(providerURL != null) { - env.put(Context.PROVIDER_URL, providerURL); - } else { - LogLog.warn("You have set InitialContextFactoryName option but not the " - +"ProviderURL. This is likely to cause problems."); - } - if(urlPkgPrefixes != null) { - env.put(Context.URL_PKG_PREFIXES, urlPkgPrefixes); - } - - if(securityPrincipalName != null) { - env.put(Context.SECURITY_PRINCIPAL, securityPrincipalName); - if(securityCredentials != null) { - env.put(Context.SECURITY_CREDENTIALS, securityCredentials); - } else { - LogLog.warn("You have set SecurityPrincipalName option but not the " - +"SecurityCredentials. This is likely to cause problems."); - } - } - jndi = new InitialContext(env); - } else { - jndi = new InitialContext(); - } - - LogLog.debug("Looking up ["+tcfBindingName+"]"); - topicConnectionFactory = (TopicConnectionFactory) lookup(jndi, tcfBindingName); - LogLog.debug("About to create TopicConnection."); - if(userName != null) { - topicConnection = topicConnectionFactory.createTopicConnection(userName, - password); - } else { - topicConnection = topicConnectionFactory.createTopicConnection(); - } - - LogLog.debug("Creating TopicSession, non-transactional, " - +"in AUTO_ACKNOWLEDGE mode."); - topicSession = topicConnection.createTopicSession(false, - Session.AUTO_ACKNOWLEDGE); - - LogLog.debug("Looking up topic name ["+topicBindingName+"]."); - Topic topic = (Topic) lookup(jndi, topicBindingName); - - LogLog.debug("Creating TopicPublisher."); - topicPublisher = topicSession.createPublisher(topic); - - LogLog.debug("Starting TopicConnection."); - topicConnection.start(); - - jndi.close(); - } catch(JMSException e) { - errorHandler.error("Error while activating options for appender named ["+name+ - "].", e, ErrorCode.GENERIC_FAILURE); - } catch(NamingException e) { - errorHandler.error("Error while activating options for appender named ["+name+ - "].", e, ErrorCode.GENERIC_FAILURE); - } catch(RuntimeException e) { - errorHandler.error("Error while activating options for appender named ["+name+ - "].", e, ErrorCode.GENERIC_FAILURE); - } } protected Object lookup(Context ctx, String name) throws NamingException { - try { - return ctx.lookup(name); - } catch(NameNotFoundException e) { - LogLog.error("Could not find name ["+name+"]."); - throw e; - } + LogLog.error(JMS_UNSUPPORTED); + throw new NameNotFoundException(JMS_UNSUPPORTED); } + /** @noinspection UnusedReturnValue*/ protected boolean checkEntryConditions() { - String fail = null; - - if(this.topicConnection == null) { - fail = "No TopicConnection"; - } else if(this.topicSession == null) { - fail = "No TopicSession"; - } else if(this.topicPublisher == null) { - fail = "No TopicPublisher"; - } - - if(fail != null) { - errorHandler.error(fail +" for JMSAppender named ["+name+"]."); - return false; - } else { - return true; - } + errorHandler.error(JMS_UNSUPPORTED); + return false; } - /** - Close this JMSAppender. Closing releases all resources used by the - appender. A closed appender cannot be re-opened. */ public synchronized void close() { - // The synchronized modifier avoids concurrent append and close operations - - if(this.closed) - return; + if(this.closed) { + return; + } LogLog.debug("Closing appender ["+name+"]."); this.closed = true; - - try { - if(topicSession != null) - topicSession.close(); - if(topicConnection != null) - topicConnection.close(); - } catch(JMSException e) { - LogLog.error("Error while closing JMSAppender ["+name+"].", e); - } catch(RuntimeException e) { - LogLog.error("Error while closing JMSAppender ["+name+"].", e); - } - // Help garbage collection - topicPublisher = null; - topicSession = null; - topicConnection = null; } - /** - This method called by {@link AppenderSkeleton#doAppend} method to - do most of the real appending work. */ public void append(LoggingEvent event) { - if(!checkEntryConditions()) { - return; - } - - try { - ObjectMessage msg = topicSession.createObjectMessage(); - if(locationInfo) { - event.getLocationInformation(); - } - msg.setObject(event); - topicPublisher.publish(msg); - } catch(JMSException e) { - errorHandler.error("Could not publish message in JMSAppender ["+name+"].", e, - ErrorCode.GENERIC_FAILURE); - } catch(RuntimeException e) { - errorHandler.error("Could not publish message in JMSAppender ["+name+"].", e, - ErrorCode.GENERIC_FAILURE); - } + checkEntryConditions(); } - /** - * Returns the value of the InitialContextFactoryName option. - * See {@link #setInitialContextFactoryName} for more details on the - * meaning of this option. - * */ public String getInitialContextFactoryName() { - return initialContextFactoryName; + return null; } - /** - * Setting the InitialContextFactoryName method will cause - * this JMSAppender instance to use the {@link - * InitialContext#InitialContext(Hashtable)} method instead of the - * no-argument constructor. If you set this option, you should also - * at least set the ProviderURL option. - * - *

See also {@link #setProviderURL(String)}. - * */ public void setInitialContextFactoryName(String initialContextFactoryName) { - this.initialContextFactoryName = initialContextFactoryName; } public String getProviderURL() { - return providerURL; + return null; } public void setProviderURL(String providerURL) { - this.providerURL = providerURL; } String getURLPkgPrefixes( ) { - return urlPkgPrefixes; + return null; } public void setURLPkgPrefixes(String urlPkgPrefixes ) { - this.urlPkgPrefixes = urlPkgPrefixes; } public String getSecurityCredentials() { - return securityCredentials; + return null; } public void setSecurityCredentials(String securityCredentials) { - this.securityCredentials = securityCredentials; } - - + public String getSecurityPrincipalName() { - return securityPrincipalName; + return null; } public void setSecurityPrincipalName(String securityPrincipalName) { - this.securityPrincipalName = securityPrincipalName; } public String getUserName() { - return userName; + return null; } - /** - * The user name to use when {@link - * TopicConnectionFactory#createTopicConnection(String, String) - * creating a topic session}. If you set this option, you should - * also set the Password option. See {@link - * #setPassword(String)}. - * */ public void setUserName(String userName) { - this.userName = userName; } public String getPassword() { - return password; + return null; } - /** - * The paswword to use when creating a topic session. - */ public void setPassword(String password) { - this.password = password; } - - /** - If true, the information sent to the remote subscriber will - include caller's location information. By default no location - information is sent to the subscriber. */ public void setLocationInfo(boolean locationInfo) { - this.locationInfo = locationInfo; } - /** - * Returns the TopicConnection used for this appender. Only valid after - * activateOptions() method has been invoked. - */ protected TopicConnection getTopicConnection() { - return topicConnection; + throw new IllegalStateException(JMS_UNSUPPORTED); } - /** - * Returns the TopicSession used for this appender. Only valid after - * activateOptions() method has been invoked. - */ protected TopicSession getTopicSession() { - return topicSession; + throw new IllegalStateException(JMS_UNSUPPORTED); } - /** - * Returns the TopicPublisher used for this appender. Only valid after - * activateOptions() method has been invoked. - */ protected TopicPublisher getTopicPublisher() { - return topicPublisher; + throw new IllegalStateException(JMS_UNSUPPORTED); } - /** - * The JMSAppender sends serialized events and consequently does not - * require a layout. - */ public boolean requiresLayout() { return false; } diff --git a/src/main/java/org/apache/log4j/net/JMSSink.java b/src/main/java/org/apache/log4j/net/JMSSink.java index 6a02831e1a..e64e4debd8 100644 --- a/src/main/java/org/apache/log4j/net/JMSSink.java +++ b/src/main/java/org/apache/log4j/net/JMSSink.java @@ -17,137 +17,45 @@ package org.apache.log4j.net; -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.spi.LoggingEvent; -import org.apache.log4j.xml.DOMConfigurator; +import org.apache.log4j.helpers.LogLog; -import javax.jms.JMSException; -import javax.jms.ObjectMessage; -import javax.jms.Session; -import javax.jms.Topic; -import javax.jms.TopicConnection; -import javax.jms.TopicConnectionFactory; -import javax.jms.TopicSession; -import javax.jms.TopicSubscriber; import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NameNotFoundException; import javax.naming.NamingException; -import java.io.BufferedReader; -import java.io.InputStreamReader; /** * A simple application that consumes logging events sent by a {@link - * JMSAppender}. + * JMSAppender} in Log4j up to 1.2.17. * + * Changed in 1.2.18+ to complain about its use and do nothing else. + * See the log4j 1.2 homepage + * for more information on why this class is disabled since 1.2.18. * * @author Ceki Gülcü - * */ + */ public class JMSSink implements javax.jms.MessageListener { - static Logger logger = Logger.getLogger(JMSSink.class); - static public void main(String[] args) throws Exception { - if(args.length != 5) { - usage("Wrong number of arguments."); - } - - String tcfBindingName = args[0]; - String topicBindingName = args[1]; - String username = args[2]; - String password = args[3]; - - - String configFile = args[4]; - - if(configFile.endsWith(".xml")) { - DOMConfigurator.configure(configFile); - } else { - PropertyConfigurator.configure(configFile); - } - - new JMSSink(tcfBindingName, topicBindingName, username, password); - - BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); - // Loop until the word "exit" is typed - System.out.println("Type \"exit\" to quit JMSSink."); - while(true){ - String s = stdin.readLine( ); - if (s.equalsIgnoreCase("exit")) { - System.out.println("Exiting. Kill the application if it does not exit " - + "due to daemon threads."); - return; - } - } + usage(); } - public JMSSink( String tcfBindingName, String topicBindingName, String username, - String password) { - - try { - Context ctx = new InitialContext(); - TopicConnectionFactory topicConnectionFactory; - topicConnectionFactory = (TopicConnectionFactory) lookup(ctx, - tcfBindingName); - - TopicConnection topicConnection = - topicConnectionFactory.createTopicConnection(username, - password); - topicConnection.start(); - - TopicSession topicSession = topicConnection.createTopicSession(false, - Session.AUTO_ACKNOWLEDGE); - - Topic topic = (Topic)ctx.lookup(topicBindingName); - - TopicSubscriber topicSubscriber = topicSession.createSubscriber(topic); - - topicSubscriber.setMessageListener(this); - - } catch(JMSException e) { - logger.error("Could not read JMS message.", e); - } catch(NamingException e) { - logger.error("Could not read JMS message.", e); - } catch(RuntimeException e) { - logger.error("Could not read JMS message.", e); - } + /** @noinspection unused*/ + public JMSSink(String tcfBindingName, String topicBindingName, String username, + String password) { + LogLog.error(JMSAppender.JMS_UNSUPPORTED); } public void onMessage(javax.jms.Message message) { - LoggingEvent event; - Logger remoteLogger; - - try { - if(message instanceof ObjectMessage) { - ObjectMessage objectMessage = (ObjectMessage) message; - event = (LoggingEvent) objectMessage.getObject(); - remoteLogger = Logger.getLogger(event.getLoggerName()); - remoteLogger.callAppenders(event); - } else { - logger.warn("Received message is of type "+message.getJMSType() - +", was expecting ObjectMessage."); - } - } catch(JMSException jmse) { - logger.error("Exception thrown while processing incoming message.", - jmse); - } + LogLog.error(JMSAppender.JMS_UNSUPPORTED); } - + /** @noinspection unused, UnusedReturnValue, SameParameterValue */ protected static Object lookup(Context ctx, String name) throws NamingException { - try { - return ctx.lookup(name); - } catch(NameNotFoundException e) { - logger.error("Could not find name ["+name+"]."); - throw e; - } + LogLog.error(JMSAppender.JMS_UNSUPPORTED); + throw new NamingException(JMSAppender.JMS_UNSUPPORTED); } - static void usage(String msg) { - System.err.println(msg); - System.err.println("Usage: java " + JMSSink.class.getName() - + " TopicConnectionFactoryBindingName TopicBindingName username password configFile"); + static void usage() { + System.err.println(JMSAppender.JMS_UNSUPPORTED); System.exit(1); } } diff --git a/src/main/java/org/apache/log4j/net/SMTPAppender.java b/src/main/java/org/apache/log4j/net/SMTPAppender.java index 7350474738..f6add1def5 100644 --- a/src/main/java/org/apache/log4j/net/SMTPAppender.java +++ b/src/main/java/org/apache/log4j/net/SMTPAppender.java @@ -48,6 +48,8 @@ import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.Date; import java.util.Properties; @@ -74,6 +76,8 @@ class implements TriggeringEventEvaluator. Since 1.2.16, SMTP over SSL is supported by setting SMTPProtocol to "smpts". + Since 1.2.18, warns when using an smtp host that is not the local loopback. + @author Ceki Gülcü @since 1.0 */ public class SMTPAppender extends AppenderSkeleton @@ -134,6 +138,8 @@ public class SMTPAppender extends AppenderSkeleton recipient, from, etc. */ public void activateOptions() { + warnInCaseOfInsecureSMTP(); + Session session = createSession(); msg = new MimeMessage(session); @@ -154,7 +160,29 @@ void activateOptions() { ((OptionHandler) evaluator).activateOptions(); } } - + + void warnInCaseOfInsecureSMTP() { + boolean local = false; + if (smtpHost != null) { + try { + if (InetAddress.getByName(smtpHost).isLoopbackAddress()) { + local = true; + } + } catch (UnknownHostException e) { + // hope it'll work out later + } + } + if (!local) { + if ("smtps".equals(smtpProtocol)) { + LogLog.warn("WARN-LOG4J-NETWORKING-REMOTE-SMTPS: logging to remote SMTPS host '" + + smtpHost + "'! Log4J 1.2 cannot verify the host, upgrade to Log4J 2!"); + } else { + LogLog.warn("WARN-LOG4J-NETWORKING-REMOTE-SMTP: logging to remote SMTP host '" + + smtpHost + "'! SMTP is an unencrypted protocol."); + } + } + } + /** * Address message. * @param msg message, may not be null. @@ -342,8 +370,9 @@ protected String formatBody() { StringBuffer sbuf = new StringBuffer(); String t = layout.getHeader(); - if(t != null) - sbuf.append(t); + if(t != null) { + sbuf.append(t); + } int len = cb.length(); for(int i = 0; i < len; i++) { //sbuf.append(MimeUtility.encodeText(layout.format(cb.get()))); diff --git a/src/main/java/org/apache/log4j/net/SimpleSocketServer.java b/src/main/java/org/apache/log4j/net/SimpleSocketServer.java index c15aa3cca2..fc51b7a65f 100644 --- a/src/main/java/org/apache/log4j/net/SimpleSocketServer.java +++ b/src/main/java/org/apache/log4j/net/SimpleSocketServer.java @@ -17,81 +17,31 @@ package org.apache.log4j.net; -import java.net.ServerSocket; -import java.net.Socket; - -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.xml.DOMConfigurator; - - /** - * A simple {@link SocketNode} based server. + * A simple {@link SocketNode} based server in Log4j up to 1.2.17. * -

-   Usage: java org.apache.log4j.net.SimpleSocketServer port configFile
-
-   where port is a part number where the server listens and
-   configFile is a configuration file fed to the {@link
-   PropertyConfigurator} or to {@link DOMConfigurator} if an XML file.
-   
- * - * @author Ceki Gülcü - * - * @since 0.8.4 - * */ + * Changed in 1.2.18+ to complain about its use and do nothing else. + * See the log4j 1.2 homepage + * for more information on why this class is disabled since 1.2.18. + * + * @author Ceki Gülcü + * @since 0.8.4 + */ public class SimpleSocketServer { - static Logger cat = Logger.getLogger(SimpleSocketServer.class); - - static int port; + static final String SOCKET_SERVER_UNSUPPORTED = + "ERROR-LOG4J-NETWORKING-UNSUPPORTED: SimpleSocketServer unsupported!" + + " This is a breaking change in Log4J 1 >=1.2.18. Stop using this class!"; public static void main(String argv[]) { - if(argv.length == 2) { - init(argv[0], argv[1]); - } else { - usage("Wrong number of arguments."); - } - - try { - cat.info("Listening on port " + port); - ServerSocket serverSocket = new ServerSocket(port); - while(true) { - cat.info("Waiting to accept a new client."); - Socket socket = serverSocket.accept(); - cat.info("Connected to client at " + socket.getInetAddress()); - cat.info("Starting new socket node."); - new Thread(new SocketNode(socket, - LogManager.getLoggerRepository()),"SimpleSocketServer-" + port).start(); - } - } catch(Exception e) { - e.printStackTrace(); - } + usage(); } - - static void usage(String msg) { - System.err.println(msg); - System.err.println( - "Usage: java " +SimpleSocketServer.class.getName() + " port configFile"); + static void usage() { + System.err.println(SOCKET_SERVER_UNSUPPORTED); System.exit(1); } - static void init(String portStr, String configFile) { - try { - port = Integer.parseInt(portStr); - } catch(java.lang.NumberFormatException e) { - e.printStackTrace(); - usage("Could not interpret port number ["+ portStr +"]."); - } - - if(configFile.endsWith(".xml")) { - DOMConfigurator.configure(configFile); - } else { - PropertyConfigurator.configure(configFile); - } - } } diff --git a/src/main/java/org/apache/log4j/net/SocketAppender.java b/src/main/java/org/apache/log4j/net/SocketAppender.java index 855b057931..8f305e6ff6 100644 --- a/src/main/java/org/apache/log4j/net/SocketAppender.java +++ b/src/main/java/org/apache/log4j/net/SocketAppender.java @@ -97,6 +97,10 @@ is slow but still faster than the rate of (log) event production @author Ceki Gülcü + @deprecated + The server side of the log4j socket protocol has been disabled + in Log4j >= 1.2.18. Change your config to ship logs using a + modern and secure protocol! @since 0.8.4 */ public class SocketAppender extends AppenderSkeleton { @@ -181,8 +185,9 @@ public void activateOptions() { * #cleanUp} method. * */ synchronized public void close() { - if(closed) - return; + if(closed) { + return; + } this.closed = true; if (advertiseViaMulticastDNS) { @@ -216,8 +221,9 @@ public void cleanUp() { } void connect(InetAddress address, int port) { - if(this.address == null) - return; + if(this.address == null) { + return; + } try { // First, close the previous connection if any. cleanUp(); @@ -241,8 +247,9 @@ void connect(InetAddress address, int port) { public void append(LoggingEvent event) { - if(event == null) - return; + if(event == null) { + return; + } if(address==null) { errorHandler.error("No remote host is set for SocketAppender named \""+ diff --git a/src/main/java/org/apache/log4j/net/SocketHubAppender.java b/src/main/java/org/apache/log4j/net/SocketHubAppender.java index 7c69acdf28..d8ba449b60 100644 --- a/src/main/java/org/apache/log4j/net/SocketHubAppender.java +++ b/src/main/java/org/apache/log4j/net/SocketHubAppender.java @@ -18,250 +18,63 @@ package org.apache.log4j.net; import java.io.IOException; -import java.io.InterruptedIOException; -import java.io.ObjectOutputStream; -import java.net.InetAddress; import java.net.ServerSocket; -import java.net.Socket; -import java.net.SocketException; -import java.util.Vector; import org.apache.log4j.AppenderSkeleton; -import org.apache.log4j.helpers.CyclicBuffer; import org.apache.log4j.helpers.LogLog; import org.apache.log4j.spi.LoggingEvent; /** Sends {@link LoggingEvent} objects to a set of remote log servers, - usually a {@link SocketNode SocketNodes}. - -

Acts just like {@link SocketAppender} except that instead of - connecting to a given remote log server, - SocketHubAppender accepts connections from the remote - log servers as clients. It can accept more than one connection. - When a log event is received, the event is sent to the set of - currently connected remote log servers. Implemented this way it does - not require any update to the configuration file to send data to - another remote log server. The remote log server simply connects to - the host and port the SocketHubAppender is running on. - -

The SocketHubAppender does not store events such - that the remote side will events that arrived after the - establishment of its connection. Once connected, events arrive in - order as guaranteed by the TCP protocol. + usually a {@link SocketNode SocketNodes} in Log4j up to 1.2.17. -

This implementation borrows heavily from the {@link - SocketAppender}. - -

The SocketHubAppender has the following characteristics: - -

    - -

  • If sent to a {@link SocketNode}, logging is non-intrusive as - far as the log event is concerned. In other words, the event will be - logged with the same time stamp, {@link org.apache.log4j.NDC}, - location info as if it were logged locally. - -

  • SocketHubAppender does not use a layout. It - ships a serialized {@link LoggingEvent} object to the remote side. - -

  • SocketHubAppender relies on the TCP - protocol. Consequently, if the remote side is reachable, then log - events will eventually arrive at remote client. - -

  • If no remote clients are attached, the logging requests are - simply dropped. - -

  • Logging events are automatically buffered by the - native TCP implementation. This means that if the link to remote - client is slow but still faster than the rate of (log) event - production, the application will not be affected by the slow network - connection. However, if the network connection is slower then the - rate of event production, then the local application can only - progress at the network rate. In particular, if the network link to - the the remote client is down, the application will be blocked. - -

    On the other hand, if the network link is up, but the remote - client is down, the client will not be blocked when making log - requests but the log events will be lost due to client - unavailability. - -

    The single remote client case extends to multiple clients - connections. The rate of logging will be determined by the slowest - link. - -

  • If the JVM hosting the SocketHubAppender exits - before the SocketHubAppender is closed either - explicitly or subsequent to garbage collection, then there might - be untransmitted data in the pipe which might be lost. This is a - common problem on Windows based systems. - -

    To avoid lost data, it is usually sufficient to {@link #close} - the SocketHubAppender either explicitly or by calling - the {@link org.apache.log4j.LogManager#shutdown} method before - exiting the application. - -

- - @author Mark Womack */ + Changed in 1.2.18+ to complain about its use and do nothing else. + See the log4j 1.2 homepage + for more information on why this class is disabled since 1.2.18.. + @author Mark Womack + @deprecated + @noinspection unused +*/ public class SocketHubAppender extends AppenderSkeleton { + static final String SOCKET_HUB_UNSUPPORTED = + "ERROR-LOG4J-NETWORKING-UNSUPPORTED: SocketHubAppender unsupported!" + + " This is a breaking change in Log4J 1 >=1.2.18. Stop using this class!"; + /** The default port number of the ServerSocket will be created on. */ static final int DEFAULT_PORT = 4560; - private int port = DEFAULT_PORT; - private Vector oosList = new Vector(); - private ServerMonitor serverMonitor = null; - private boolean locationInfo = false; - private CyclicBuffer buffer = null; - private String application; - private boolean advertiseViaMulticastDNS; - private ZeroConfSupport zeroConf; - /** * The MulticastDNS zone advertised by a SocketHubAppender */ public static final String ZONE = "_log4j_obj_tcpaccept_appender.local."; - private ServerSocket serverSocket; - - public SocketHubAppender() { } + public SocketHubAppender() { + LogLog.error(SOCKET_HUB_UNSUPPORTED); + } - /** - Connects to remote server at address and port. */ public SocketHubAppender(int _port) { - port = _port; - startServer(); + LogLog.error(SOCKET_HUB_UNSUPPORTED); } - /** - Set up the socket server on the specified port. */ public void activateOptions() { - if (advertiseViaMulticastDNS) { - zeroConf = new ZeroConfSupport(ZONE, port, getName()); - zeroConf.advertise(); - } - startServer(); } - /** - Close this appender. -

This will mark the appender as closed and - call then {@link #cleanUp} method. */ synchronized public void close() { - if(closed) - return; - - LogLog.debug("closing SocketHubAppender " + getName()); - this.closed = true; - if (advertiseViaMulticastDNS) { - zeroConf.unadvertise(); - } - cleanUp(); - - LogLog.debug("SocketHubAppender " + getName() + " closed"); } - /** - Release the underlying ServerMonitor thread, and drop the connections - to all connected remote servers. */ - public + public void cleanUp() { - // stop the monitor thread - LogLog.debug("stopping ServerSocket"); - serverMonitor.stopMonitor(); - serverMonitor = null; - - // close all of the connections - LogLog.debug("closing client connections"); - while (oosList.size() != 0) { - ObjectOutputStream oos = (ObjectOutputStream)oosList.elementAt(0); - if(oos != null) { - try { - oos.close(); - } catch(InterruptedIOException e) { - Thread.currentThread().interrupt(); - LogLog.error("could not close oos.", e); - } catch(IOException e) { - LogLog.error("could not close oos.", e); - } - - oosList.removeElementAt(0); - } - } } - /** - Append an event to all of current connections. */ public void append(LoggingEvent event) { - if (event != null) { - // set up location info if requested - if (locationInfo) { - event.getLocationInformation(); - } - if (application != null) { - event.setProperty("application", application); - } - event.getNDC(); - event.getThreadName(); - event.getMDCCopy(); - event.getRenderedMessage(); - event.getThrowableStrRep(); - - if (buffer != null) { - buffer.add(event); - } - } - - // if no event or no open connections, exit now - if ((event == null) || (oosList.size() == 0)) { - return; - } - - // loop through the current set of open connections, appending the event to each - for (int streamCount = 0; streamCount < oosList.size(); streamCount++) { - - ObjectOutputStream oos = null; - try { - oos = (ObjectOutputStream)oosList.elementAt(streamCount); - } - catch (ArrayIndexOutOfBoundsException e) { - // catch this, but just don't assign a value - // this should not really occur as this method is - // the only one that can remove oos's (besides cleanUp). - } - - // list size changed unexpectedly? Just exit the append. - if (oos == null) - break; - - try { - oos.writeObject(event); - oos.flush(); - // Failing to reset the object output stream every now and - // then creates a serious memory leak. - // right now we always reset. TODO - set up frequency counter per oos? - oos.reset(); - } - catch(IOException e) { - if (e instanceof InterruptedIOException) { - Thread.currentThread().interrupt(); - } - // there was an io exception so just drop the connection - oosList.removeElementAt(streamCount); - LogLog.debug("dropped connection"); - - // decrement to keep the counter in place (for loop always increments) - streamCount--; - } - } } /** @@ -272,241 +85,50 @@ boolean requiresLayout() { return false; } - /** - The Port option takes a positive integer representing - the port where the server is waiting for connections. */ public void setPort(int _port) { - port = _port; } - /** - * The App option takes a string value which should be the name of the application getting logged. If property was already set (via system - * property), don't set here. - */ - public + public void setApplication(String lapp) { - this.application = lapp; } - /** - * Returns value of the Application option. - */ - public + public String getApplication() { - return application; + return null; } - /** - Returns value of the Port option. */ public int getPort() { - return port; + return 0; } - /** - * The BufferSize option takes a positive integer representing the number of events this appender will buffer and send to newly connected - * clients. - */ - public + public void setBufferSize(int _bufferSize) { - buffer = new CyclicBuffer(_bufferSize); } - /** - * Returns value of the bufferSize option. - */ - public + public int getBufferSize() { - if (buffer == null) { - return 0; - } else { - return buffer.getMaxSize(); - } + return 0; } - /** - The LocationInfo option takes a boolean value. If true, - the information sent to the remote host will include location - information. By default no location information is sent to the server. */ public void setLocationInfo(boolean _locationInfo) { - locationInfo = _locationInfo; } - /** - Returns value of the LocationInfo option. */ public boolean getLocationInfo() { - return locationInfo; + return false; } public void setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS) { - this.advertiseViaMulticastDNS = advertiseViaMulticastDNS; } public boolean isAdvertiseViaMulticastDNS() { - return advertiseViaMulticastDNS; + return false; } - /** - Start the ServerMonitor thread. */ - private - void startServer() { - serverMonitor = new ServerMonitor(port, oosList); - } - - /** - * Creates a server socket to accept connections. - * @param socketPort port on which the socket should listen, may be zero. - * @return new socket. - * @throws IOException IO error when opening the socket. - */ protected ServerSocket createServerSocket(final int socketPort) throws IOException { - return new ServerSocket(socketPort); - } - - /** - This class is used internally to monitor a ServerSocket - and register new connections in a vector passed in the - constructor. */ - private class ServerMonitor implements Runnable { - private int port; - private Vector oosList; - private boolean keepRunning; - private Thread monitorThread; - - /** - Create a thread and start the monitor. */ - public - ServerMonitor(int _port, Vector _oosList) { - port = _port; - oosList = _oosList; - keepRunning = true; - monitorThread = new Thread(this); - monitorThread.setDaemon(true); - monitorThread.setName("SocketHubAppender-Monitor-" + port); - monitorThread.start(); - } - - /** - Stops the monitor. This method will not return until - the thread has finished executing. */ - public synchronized void stopMonitor() { - if (keepRunning) { - LogLog.debug("server monitor thread shutting down"); - keepRunning = false; - try { - if (serverSocket != null) { - serverSocket.close(); - serverSocket = null; - } - } catch (IOException ioe) {} - - try { - monitorThread.join(); - } - catch (InterruptedException e) { - Thread.currentThread().interrupt(); - // do nothing? - } - - // release the thread - monitorThread = null; - LogLog.debug("server monitor thread shut down"); - } - } - - private - void sendCachedEvents(ObjectOutputStream stream) throws IOException { - if (buffer != null) { - for (int i = 0; i < buffer.length(); i++) { - stream.writeObject(buffer.get(i)); - } - stream.flush(); - stream.reset(); - } - } - - /** - Method that runs, monitoring the ServerSocket and adding connections as - they connect to the socket. */ - public - void run() { - serverSocket = null; - try { - serverSocket = createServerSocket(port); - serverSocket.setSoTimeout(1000); - } - catch (Exception e) { - if (e instanceof InterruptedIOException || e instanceof InterruptedException) { - Thread.currentThread().interrupt(); - } - LogLog.error("exception setting timeout, shutting down server socket.", e); - keepRunning = false; - return; - } - - try { - try { - serverSocket.setSoTimeout(1000); - } - catch (SocketException e) { - LogLog.error("exception setting timeout, shutting down server socket.", e); - return; - } - - while (keepRunning) { - Socket socket = null; - try { - socket = serverSocket.accept(); - } - catch (InterruptedIOException e) { - // timeout occurred, so just loop - } - catch (SocketException e) { - LogLog.error("exception accepting socket, shutting down server socket.", e); - keepRunning = false; - } - catch (IOException e) { - LogLog.error("exception accepting socket.", e); - } - - // if there was a socket accepted - if (socket != null) { - try { - InetAddress remoteAddress = socket.getInetAddress(); - LogLog.debug("accepting connection from " + remoteAddress.getHostName() - + " (" + remoteAddress.getHostAddress() + ")"); - - // create an ObjectOutputStream - ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); - if (buffer != null && buffer.length() > 0) { - sendCachedEvents(oos); - } - - // add it to the oosList. OK since Vector is synchronized. - oosList.addElement(oos); - } catch (IOException e) { - if (e instanceof InterruptedIOException) { - Thread.currentThread().interrupt(); - } - LogLog.error("exception creating output stream on socket.", e); - } - } - } - } - finally { - // close the socket - try { - serverSocket.close(); - } catch(InterruptedIOException e) { - Thread.currentThread().interrupt(); - } catch (IOException e) { - // do nothing with it? - } - } - } + throw new IOException(SOCKET_HUB_UNSUPPORTED); } } - diff --git a/src/main/java/org/apache/log4j/net/SocketNode.java b/src/main/java/org/apache/log4j/net/SocketNode.java index e977f1333a..ae3827f2fa 100644 --- a/src/main/java/org/apache/log4j/net/SocketNode.java +++ b/src/main/java/org/apache/log4j/net/SocketNode.java @@ -17,13 +17,9 @@ package org.apache.log4j.net; -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.InterruptedIOException; -import java.io.ObjectInputStream; import java.net.Socket; -import org.apache.log4j.Logger; +import org.apache.log4j.helpers.LogLog; import org.apache.log4j.spi.LoggerRepository; import org.apache.log4j.spi.LoggingEvent; @@ -31,94 +27,29 @@ /** Read {@link LoggingEvent} objects sent from a remote client using - Sockets (TCP). These logging events are logged according to local - policy, as if they were generated locally. + Sockets (TCP) in Log4j up to 1.2.17. -

For example, the socket node might decide to log events to a - local file and also resent them to a second socket node. + Changed in 1.2.18+ to complain about its use and do nothing else. + See the log4j 1.2 homepage + for more information on why this class is disabled since 1.2.18. - @author Ceki Gülcü + @author Ceki Gülcü - @since 0.8.4 + @since 0.8.4 + @deprecated + @noinspection unused */ public class SocketNode implements Runnable { - Socket socket; - LoggerRepository hierarchy; - ObjectInputStream ois; - - static Logger logger = Logger.getLogger(SocketNode.class); + static final String SOCKET_NODE_UNSUPPORTED = + "ERROR-LOG4J-NETWORKING-UNSUPPORTED: SocketNode unsupported!" + + " This is a breaking change in Log4J 1 >=1.2.18. Stop using this class!"; public SocketNode(Socket socket, LoggerRepository hierarchy) { - this.socket = socket; - this.hierarchy = hierarchy; - try { - ois = new ObjectInputStream( - new BufferedInputStream(socket.getInputStream())); - } catch(InterruptedIOException e) { - Thread.currentThread().interrupt(); - logger.error("Could not open ObjectInputStream to "+socket, e); - } catch(IOException e) { - logger.error("Could not open ObjectInputStream to "+socket, e); - } catch(RuntimeException e) { - logger.error("Could not open ObjectInputStream to "+socket, e); - } + LogLog.error(SOCKET_NODE_UNSUPPORTED); } - //public - //void finalize() { - //System.err.println("-------------------------Finalize called"); - // System.err.flush(); - //} - public void run() { - LoggingEvent event; - Logger remoteLogger; - - try { - if (ois != null) { - while(true) { - // read an event from the wire - event = (LoggingEvent) ois.readObject(); - // get a logger from the hierarchy. The name of the logger is taken to be the name contained in the event. - remoteLogger = hierarchy.getLogger(event.getLoggerName()); - //event.logger = remoteLogger; - // apply the logger-level filter - if(event.getLevel().isGreaterOrEqual(remoteLogger.getEffectiveLevel())) { - // finally log the event as if was generated locally - remoteLogger.callAppenders(event); - } - } - } - } catch(java.io.EOFException e) { - logger.info("Caught java.io.EOFException closing conneciton."); - } catch(java.net.SocketException e) { - logger.info("Caught java.net.SocketException closing conneciton."); - } catch(InterruptedIOException e) { - Thread.currentThread().interrupt(); - logger.info("Caught java.io.InterruptedIOException: "+e); - logger.info("Closing connection."); - } catch(IOException e) { - logger.info("Caught java.io.IOException: "+e); - logger.info("Closing connection."); - } catch(Exception e) { - logger.error("Unexpected exception. Closing conneciton.", e); - } finally { - if (ois != null) { - try { - ois.close(); - } catch(Exception e) { - logger.info("Could not close connection.", e); - } - } - if (socket != null) { - try { - socket.close(); - } catch(InterruptedIOException e) { - Thread.currentThread().interrupt(); - } catch(IOException ex) { - } - } - } + LogLog.error(SOCKET_NODE_UNSUPPORTED); } } diff --git a/src/main/java/org/apache/log4j/net/SocketServer.java b/src/main/java/org/apache/log4j/net/SocketServer.java index 8ea3cb79a1..de2b7fa322 100644 --- a/src/main/java/org/apache/log4j/net/SocketServer.java +++ b/src/main/java/org/apache/log4j/net/SocketServer.java @@ -17,196 +17,44 @@ package org.apache.log4j.net; -import java.io.File; -import java.net.InetAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.Hashtable; +import org.apache.log4j.helpers.LogLog; -import org.apache.log4j.Hierarchy; -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.spi.LoggerRepository; -import org.apache.log4j.spi.RootLogger; +import java.io.File; /** A {@link SocketNode} based server that uses a different hierarchy - for each client. - -

-     Usage: java org.apache.log4j.net.SocketServer port configFile configDir
-
-     where port is a part number where the server listens,
-           configFile is a configuration file fed to the {@link PropertyConfigurator} and
-           configDir is a path to a directory containing configuration files, possibly one for each client host.
-     
- -

The configFile is used to configure the log4j - default hierarchy that the SocketServer will use to - report on its actions. - -

When a new connection is opened from a previously unknown - host, say foo.bar.net, then the - SocketServer will search for a configuration file - called foo.bar.net.lcf under the directory - configDir that was passed as the third argument. If - the file can be found, then a new hierarchy is instantiated and - configured using the configuration file - foo.bar.net.lcf. If and when the host - foo.bar.net opens another connection to the server, - then the previously configured hierarchy is used. - -

In case there is no file called foo.bar.net.lcf - under the directory configDir, then the - generic hierarchy is used. The generic hierarchy is - configured using a configuration file called - generic.lcf under the configDir - directory. If no such file exists, then the generic hierarchy will be - identical to the log4j default hierarchy. - -

Having different client hosts log using different hierarchies - ensures the total independence of the clients with respect to - their logging settings. + for each client in Log4j up to 1.2.17. -

Currently, the hierarchy that will be used for a given request - depends on the IP address of the client host. For example, two - separate applicatons running on the same host and logging to the - same server will share the same hierarchy. This is perfectly safe - except that it might not provide the right amount of independence - between applications. The SocketServer is intended - as an example to be enhanced in order to implement more elaborate - policies. - - - @author Ceki Gülcü - - @since 1.0 */ + Changed in 1.2.18+ to complain about its use and do nothing else. + See the log4j 1.2 homepage + for more information on why this class is disabled since 1.2.18. + @author Ceki Gülcü + @since 1.0 + */ public class SocketServer { - static String GENERIC = "generic"; - static String CONFIG_FILE_EXT = ".lcf"; - - static Logger cat = Logger.getLogger(SocketServer.class); - static SocketServer server; - static int port; - - // key=inetAddress, value=hierarchy - Hashtable hierarchyMap; - LoggerRepository genericHierarchy; - File dir; + static final String SOCKET_SERVER_UNSUPPORTED = + "ERROR-LOG4J-NETWORKING-UNSUPPORTED: SocketServer unsupported!" + + " This is a breaking change in Log4J 1 >=1.2.18. Stop using this class!"; public static void main(String argv[]) { - if(argv.length == 3) - init(argv[0], argv[1], argv[2]); - else - usage("Wrong number of arguments."); - - try { - cat.info("Listening on port " + port); - ServerSocket serverSocket = new ServerSocket(port); - while(true) { - cat.info("Waiting to accept a new client."); - Socket socket = serverSocket.accept(); - InetAddress inetAddress = socket.getInetAddress(); - cat.info("Connected to client at " + inetAddress); - - LoggerRepository h = (LoggerRepository) server.hierarchyMap.get(inetAddress); - if(h == null) { - h = server.configureHierarchy(inetAddress); - } - - cat.info("Starting new socket node."); - new Thread(new SocketNode(socket, h)).start(); - } - } - catch(Exception e) { - e.printStackTrace(); - } + usage(); } static - void usage(String msg) { - System.err.println(msg); - System.err.println( - "Usage: java " +SocketServer.class.getName() + " port configFile directory"); + void usage() { + System.err.println(SOCKET_SERVER_UNSUPPORTED); System.exit(1); } - static - void init(String portStr, String configFile, String dirStr) { - try { - port = Integer.parseInt(portStr); - } - catch(java.lang.NumberFormatException e) { - e.printStackTrace(); - usage("Could not interpret port number ["+ portStr +"]."); - } - - PropertyConfigurator.configure(configFile); - - File dir = new File(dirStr); - if(!dir.isDirectory()) { - usage("["+dirStr+"] is not a directory."); - } - server = new SocketServer(dir); - } - - + /** @noinspection unused*/ public SocketServer(File directory) { - this.dir = directory; - hierarchyMap = new Hashtable(11); - } - - // This method assumes that there is no hiearchy for inetAddress - // yet. It will configure one and return it. - LoggerRepository configureHierarchy(InetAddress inetAddress) { - cat.info("Locating configuration file for "+inetAddress); - // We assume that the toSting method of InetAddress returns is in - // the format hostname/d1.d2.d3.d4 e.g. torino/192.168.1.1 - String s = inetAddress.toString(); - int i = s.indexOf("/"); - if(i == -1) { - cat.warn("Could not parse the inetAddress ["+inetAddress+ - "]. Using default hierarchy."); - return genericHierarchy(); - } else { - String key = s.substring(0, i); - - File configFile = new File(dir, key+CONFIG_FILE_EXT); - if(configFile.exists()) { - Hierarchy h = new Hierarchy(new RootLogger(Level.DEBUG)); - hierarchyMap.put(inetAddress, h); - - new PropertyConfigurator().doConfigure(configFile.getAbsolutePath(), h); - - return h; - } else { - cat.warn("Could not find config file ["+configFile+"]."); - return genericHierarchy(); - } - } - } - - LoggerRepository genericHierarchy() { - if(genericHierarchy == null) { - File f = new File(dir, GENERIC+CONFIG_FILE_EXT); - if(f.exists()) { - genericHierarchy = new Hierarchy(new RootLogger(Level.DEBUG)); - new PropertyConfigurator().doConfigure(f.getAbsolutePath(), genericHierarchy); - } else { - cat.warn("Could not find config file ["+f+ - "]. Will use the default hierarchy."); - genericHierarchy = LogManager.getLoggerRepository(); - } - } - return genericHierarchy; + LogLog.error(SOCKET_SERVER_UNSUPPORTED); } } diff --git a/src/main/java/org/apache/log4j/net/SyslogAppender.java b/src/main/java/org/apache/log4j/net/SyslogAppender.java index 6ab7eddfd0..124ac3a388 100644 --- a/src/main/java/org/apache/log4j/net/SyslogAppender.java +++ b/src/main/java/org/apache/log4j/net/SyslogAppender.java @@ -17,25 +17,29 @@ package org.apache.log4j.net; +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; +import java.util.regex.Pattern; + import org.apache.log4j.AppenderSkeleton; import org.apache.log4j.Layout; import org.apache.log4j.helpers.SyslogQuietWriter; import org.apache.log4j.helpers.SyslogWriter; import org.apache.log4j.spi.LoggingEvent; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.io.IOException; - // Contributors: Yves Bossel // Christopher Taylor /** Use SyslogAppender to send log messages to a remote syslog daemon. + Since Log4J 1.2.18, will log a warning if the remote syslog daemon + is not a local loopback (127.x.x.x or ::1/128). + @author Ceki Gülcü @author Anders Kristensen */ @@ -44,6 +48,11 @@ public class SyslogAppender extends AppenderSkeleton { // copyrighted by the Regents of the University of California // I hope nobody at Berkley gets offended. + /** + * Maximum length of a TAG string. + */ + private static final int MAX_TAG_LEN = 32; + /** Kernel messages */ final static public int LOG_KERN = 0; /** Random user-level messages */ @@ -93,6 +102,8 @@ public class SyslogAppender extends AppenderSkeleton { static final String TAB = " "; + static final Pattern NOT_ALPHANUM = Pattern.compile("[^\\p{Alnum}]"); + // Have LOG_USER as default int syslogFacility = LOG_USER; String facilityStr; @@ -108,11 +119,20 @@ public class SyslogAppender extends AppenderSkeleton { * @since 1.2.15 */ private boolean header = false; + + /** + * The TAG part of the syslog message. + * + * @since 1.2.18 + */ + private String tag = null; + /** * Date format used if header = true. * @since 1.2.15 */ private final SimpleDateFormat dateFormat = new SimpleDateFormat("MMM dd HH:mm:ss ", Locale.ENGLISH); + /** * Host name used to identify messages from this appender. * @since 1.2.15 @@ -295,8 +315,9 @@ private void splitPacket(final String header, final String packet) { public void append(LoggingEvent event) { - if(!isAsSevereAsThreshold(event.getLevel())) - return; + if(!isAsSevereAsThreshold(event.getLevel())) { + return; + } // We must not attempt to append if sqw is null. if(sqw == null) { @@ -413,8 +434,9 @@ String getSyslogHost() { @since 0.8.1 */ public void setFacility(String facilityName) { - if(facilityName == null) - return; + if(facilityName == null) { + return; + } syslogFacility = getFacility(facilityName); if (syslogFacility == -1) { @@ -508,6 +530,10 @@ private String getPacketHeader(final long timeStamp) { } buf.append(getLocalHostname()); buf.append(' '); + if(this.tag != null) { + buf.append(this.tag); + buf.append(": "); + } return buf.toString(); } return ""; diff --git a/src/main/java/org/apache/log4j/net/TelnetAppender.java b/src/main/java/org/apache/log4j/net/TelnetAppender.java index 23847b551c..0b2b467cae 100644 --- a/src/main/java/org/apache/log4j/net/TelnetAppender.java +++ b/src/main/java/org/apache/log4j/net/TelnetAppender.java @@ -22,215 +22,78 @@ import org.apache.log4j.spi.LoggingEvent; import java.io.IOException; -import java.io.PrintWriter; -import java.io.InterruptedIOException; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Vector; /** -

The TelnetAppender is a log4j appender that specializes in - writing to a read-only socket. The output is provided in a - telnet-friendly way so that a log can be monitored over TCP/IP. - Clients using telnet connect to the socket and receive log data. - This is handy for remote monitoring, especially when monitoring a - servlet. - -

Here is a list of the available configuration options: - - - - - - - - - - - - - - -
NameRequirementDescriptionSample Value
PortoptionalThis parameter determines the port to use for announcing log events. The default port is 23 (telnet).5875
+ The TelnetAppender is a log4j appender that specializes in + writing to a read-only socket in Log4j up to 1.2.17. + + Changed in 1.2.18+ to complain about its use and do nothing else. + See the log4j 1.2 homepage + for more information on why this class is disabled since 1.2.18. @author Jay Funnell + @deprecated + @noinspection unused */ public class TelnetAppender extends AppenderSkeleton { - private SocketHandler sh; - private int port = 23; + static final String TELNET_APPENDER_UNSUPPORTED = + "ERROR-LOG4J-NETWORKING-UNSUPPORTED: TelnetAppender unsupported!" + + " This is a breaking change in Log4J 1 >=1.2.18. Stop using this class!"; + + public TelnetAppender() { + LogLog.error(TELNET_APPENDER_UNSUPPORTED); + } - /** - This appender requires a layout to format the text to the - attached client(s). */ + /** + In 1.2.17 this appender required a layout to format the text to the + attached client(s), keep the same for compatibility. */ public boolean requiresLayout() { return true; } - /** all of the options have been set, create the socket handler and - wait for connections. */ public void activateOptions() { - try { - sh = new SocketHandler(port); - sh.start(); - } - catch(InterruptedIOException e) { - Thread.currentThread().interrupt(); - e.printStackTrace(); - } catch(IOException e) { - e.printStackTrace(); - } catch(RuntimeException e) { - e.printStackTrace(); - } - super.activateOptions(); + LogLog.error(TELNET_APPENDER_UNSUPPORTED); } public int getPort() { - return port; + return 0; } public void setPort(int port) { - this.port = port; } - - /** shuts down the appender. */ public void close() { - if (sh != null) { - sh.close(); - try { - sh.join(); - } catch(InterruptedException ex) { - Thread.currentThread().interrupt(); - } - } } - /** Handles a log event. For this appender, that means writing the - message to each connected client. */ protected void append(LoggingEvent event) { - if(sh != null) { - sh.send(layout.format(event)); - if(layout.ignoresThrowable()) { - String[] s = event.getThrowableStrRep(); - if (s != null) { - StringBuffer buf = new StringBuffer(); - for(int i = 0; i < s.length; i++) { - buf.append(s[i]); - buf.append("\r\n"); - } - sh.send(buf.toString()); - } - } - } + errorHandler.error(TELNET_APPENDER_UNSUPPORTED); } - //---------------------------------------------------------- SocketHandler: - - /** The SocketHandler class is used to accept connections from - clients. It is threaded so that clients can connect/disconnect - asynchronously. */ + /** @noinspection InnerClassMayBeStatic, FinalizeNotProtected */ protected class SocketHandler extends Thread { - private Vector writers = new Vector(); - private Vector connections = new Vector(); - private ServerSocket serverSocket; - private int MAX_CONNECTIONS = 20; - public void finalize() { close(); } - /** - * make sure we close all network connections when this handler is destroyed. - * @since 1.2.15 - */ public void close() { - synchronized(this) { - for(Enumeration e = connections.elements();e.hasMoreElements();) { - try { - ((Socket)e.nextElement()).close(); - } catch(InterruptedIOException ex) { - Thread.currentThread().interrupt(); - } catch(IOException ex) { - } catch(RuntimeException ex) { - } - } - } - - try { - serverSocket.close(); - } catch(InterruptedIOException ex) { - Thread.currentThread().interrupt(); - } catch(IOException ex) { - } catch(RuntimeException ex) { - } } - /** sends a message to each of the clients in telnet-friendly output. */ public synchronized void send(final String message) { - Iterator ce = connections.iterator(); - for(Iterator e = writers.iterator();e.hasNext();) { - ce.next(); - PrintWriter writer = (PrintWriter)e.next(); - writer.print(message); - if(writer.checkError()) { - ce.remove(); - e.remove(); - } - } + errorHandler.error(TELNET_APPENDER_UNSUPPORTED); } - /** - Continually accepts client connections. Client connections - are refused when MAX_CONNECTIONS is reached. - */ public void run() { - while(!serverSocket.isClosed()) { - try { - Socket newClient = serverSocket.accept(); - PrintWriter pw = new PrintWriter(newClient.getOutputStream()); - if(connections.size() < MAX_CONNECTIONS) { - synchronized(this) { - connections.addElement(newClient); - writers.addElement(pw); - pw.print("TelnetAppender v1.0 (" + connections.size() - + " active connections)\r\n\r\n"); - pw.flush(); - } - } else { - pw.print("Too many connections.\r\n"); - pw.flush(); - newClient.close(); - } - } catch(Exception e) { - if (e instanceof InterruptedIOException || e instanceof InterruptedException) { - Thread.currentThread().interrupt(); - } - if (!serverSocket.isClosed()) { - LogLog.error("Encountered error while in SocketHandler loop.", e); - } - break; - } - } - - try { - serverSocket.close(); - } catch(InterruptedIOException ex) { - Thread.currentThread().interrupt(); - } catch(IOException ex) { - } + errorHandler.error(TELNET_APPENDER_UNSUPPORTED); } public SocketHandler(int port) throws IOException { - serverSocket = new ServerSocket(port); - setName("TelnetAppender-" + getName() + "-" + port); + LogLog.error(TELNET_APPENDER_UNSUPPORTED); + throw new IOException(TELNET_APPENDER_UNSUPPORTED); } - } } diff --git a/src/main/java/org/apache/log4j/varia/ExternallyRolledFileAppender.java b/src/main/java/org/apache/log4j/varia/ExternallyRolledFileAppender.java index 26e7d842bc..e51353207a 100644 --- a/src/main/java/org/apache/log4j/varia/ExternallyRolledFileAppender.java +++ b/src/main/java/org/apache/log4j/varia/ExternallyRolledFileAppender.java @@ -17,75 +17,43 @@ package org.apache.log4j.varia; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InterruptedIOException; -import java.net.ServerSocket; -import java.net.Socket; - import org.apache.log4j.RollingFileAppender; import org.apache.log4j.helpers.LogLog; /** This appender listens on a socket on the port specified by the - Port property for a "RollOver" message. When such a message - is received, the underlying log file is rolled over and an - acknowledgment message is sent back to the process initiating the - roll over. - -

This method of triggering roll over has the advantage of being - operating system independent, fast and reliable. - -

A simple application {@link Roller} is provided to initiate the - roll over. - -

Note that the initiator is not authenticated. Anyone can trigger - a rollover. In production environments, it is recommended that you - add some form of protection to prevent undesired rollovers. + Port property for a "RollOver" message in Log4j up to 1.2.17. + Changed in 1.2.18+ to complain about its use and act as a regular + FileAppender otherwise. This may mean your files stop rolling over + if you keep using this class! See + the log4j 1.2 homepage + for more information on why this class is disabled since 1.2.18. @author Ceki Gülcü - @since version 0.9.0 */ + @since version 0.9.0 + @noinspection unused +*/ public class ExternallyRolledFileAppender extends RollingFileAppender { - - /** - The string constant sent to initiate a roll over. Current value of - this string constant is RollOver. - */ + static final String EXTERNAL_ROLLING_UNSUPPORTED = + "ERROR-LOG4J-NETWORKING-UNSUPPORTED: External Rolled File Appender unsupported!" + + " This is a breaking change in Log4J 1 >=1.2.18. Change your config to stop using it!"; static final public String ROLL_OVER = "RollOver"; - - /** - The string constant sent to acknowledge a roll over. Current value of - this string constant is OK. - */ static final public String OK = "OK"; - int port = 0; - HUP hup; - - /** - The default constructor does nothing but calls its super-class - constructor. */ public ExternallyRolledFileAppender() { + super(); + LogLog.error(EXTERNAL_ROLLING_UNSUPPORTED); } - /** - The Port [roperty is used for setting the port for - listening to external roll over messages. - */ public void setPort(int port) { - this.port = port; } - /** - Returns value of the Port option. - */ public int getPort() { - return port; + return 0; } /** @@ -94,96 +62,5 @@ int getPort() { public void activateOptions() { super.activateOptions(); - if(port != 0) { - if(hup != null) { - hup.interrupt(); - } - hup = new HUP(this, port); - hup.setDaemon(true); - hup.start(); - } - } -} - - -class HUP extends Thread { - - int port; - ExternallyRolledFileAppender er; - - HUP(ExternallyRolledFileAppender er, int port) { - this.er = er; - this.port = port; - } - - public - void run() { - while(!isInterrupted()) { - try { - ServerSocket serverSocket = new ServerSocket(port); - while(true) { - Socket socket = serverSocket.accept(); - LogLog.debug("Connected to client at " + socket.getInetAddress()); - new Thread(new HUPNode(socket, er), "ExternallyRolledFileAppender-HUP").start(); - } - } catch(InterruptedIOException e) { - Thread.currentThread().interrupt(); - e.printStackTrace(); - } catch(IOException e) { - e.printStackTrace(); - } catch(RuntimeException e) { - e.printStackTrace(); - } - } } } - -class HUPNode implements Runnable { - - Socket socket; - DataInputStream dis; - DataOutputStream dos; - ExternallyRolledFileAppender er; - - public - HUPNode(Socket socket, ExternallyRolledFileAppender er) { - this.socket = socket; - this.er = er; - try { - dis = new DataInputStream(socket.getInputStream()); - dos = new DataOutputStream(socket.getOutputStream()); - } catch(InterruptedIOException e) { - Thread.currentThread().interrupt(); - e.printStackTrace(); - } catch(IOException e) { - e.printStackTrace(); - } catch(RuntimeException e) { - e.printStackTrace(); - } - } - - public void run() { - try { - String line = dis.readUTF(); - LogLog.debug("Got external roll over signal."); - if(ExternallyRolledFileAppender.ROLL_OVER.equals(line)) { - synchronized(er) { - er.rollOver(); - } - dos.writeUTF(ExternallyRolledFileAppender.OK); - } - else { - dos.writeUTF("Expecting [RollOver] string."); - } - dos.close(); - } catch(InterruptedIOException e) { - Thread.currentThread().interrupt(); - LogLog.error("Unexpected exception. Exiting HUPNode.", e); - } catch(IOException e) { - LogLog.error("Unexpected exception. Exiting HUPNode.", e); - } catch(RuntimeException e) { - LogLog.error("Unexpected exception. Exiting HUPNode.", e); - } - } -} - diff --git a/src/main/resources/META-INF/LICENSE b/src/main/resources/META-INF/LICENSE deleted file mode 100644 index 6279e5206d..0000000000 --- a/src/main/resources/META-INF/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 1999-2005 The Apache Software Foundation - - Licensed 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. diff --git a/src/main/resources/META-INF/NOTICE b/src/main/resources/META-INF/NOTICE deleted file mode 100644 index 0375732360..0000000000 --- a/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache log4j -Copyright 2007 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). \ No newline at end of file diff --git a/src/site/apt/download.apt b/src/site/apt/download.apt index 7a4aa54b97..5e41d1e19c 100644 --- a/src/site/apt/download.apt +++ b/src/site/apt/download.apt @@ -30,9 +30,9 @@ Download Apache log4j 1.2.17 *-------------------------+---------+----------+-----------+ | | Mirrors | Checksum | Signature | *-------------------------+---------+----------+-----------+ -| Apache log4j 1.2.17 (tar.gz) | {{{http://www.apache.org/dyn/closer.cgi/logging/log4j/1.2.17/apache-log4j-1.2.17.tar.gz} apache-log4j-1.2.17.tar.gz}} | {{{http://www.apache.org/dist/logging/log4j/1.2.17/apache-log4j-1.2.17.tar.gz.md5} apache-log4j-1.2.17.tar.gz.md5}} | {{{http://www.apache.org/dist/logging/log4j/1.2.17/apache-log4j-1.2.17.tar.gz.asc} apache-log4j-1.2.17.tar.gz.asc}} | +| Apache log4j 1.2.17 (tar.gz) | {{{http://www.apache.org/dyn/closer.cgi/logging/log4j/1.2.17/log4j-1.2.17.tar.gz} log4j-1.2.17.tar.gz}} | {{{http://www.apache.org/dist/logging/log4j/1.2.17/log4j-1.2.17.tar.gz.md5} log4j-1.2.17.tar.gz.md5}} | {{{http://www.apache.org/dist/logging/log4j/1.2.17/log4j-1.2.17.tar.gz.asc} log4j-1.2.17.tar.gz.asc}} | *-------------------------+---------+----------+-----------+ -| Apache log4j 1.2.17 (zip) | {{{http://www.apache.org/dyn/closer.cgi/logging/log4j/1.2.17/apache-log4j-1.2.17.zip} apache-log4j-1.2.17.zip}} | {{{http://www.apache.org/dist/logging/log4j/1.2.17/apache-log4j-1.2.17.zip.md5} apache-log4j-1.2.17.zip.md5}} | {{{http://www.apache.org/dist/logging/log4j/1.2.17/apache-log4j-1.2.17.zip.asc} apache-log4j-1.2.17.zip.asc}} | +| Apache log4j 1.2.17 (zip) | {{{http://www.apache.org/dyn/closer.cgi/logging/log4j/1.2.17/log4j-1.2.17.zip} log4j-1.2.17.zip}} | {{{http://www.apache.org/dist/logging/log4j/1.2.17/log4j-1.2.17.zip.md5} log4j-1.2.17.zip.md5}} | {{{http://www.apache.org/dist/logging/log4j/1.2.17/log4j-1.2.17.zip.asc} log4j-1.2.17.zip.asc}} | *-------------------------+---------+----------+-----------+ It is essential that you verify the integrity of the downloaded files using the PGP or MD5 signatures. @@ -48,7 +48,7 @@ Download Apache log4j 1.2.17 % gpg --verify log4j-1.2.17.tar.gz.asc --- - Apache log4j 1.2.17 is signed by Curt Arnold 70C9C3DO + Apache log4j 1.2.17 is signed by Christian Grobmeier 42196CA8 Alternatively, you can verify the MD5 signature on the files. A unix program called md5 or md5sum is included in many unix distributions. diff --git a/src/site/apt/roadmap.apt b/src/site/apt/roadmap.apt deleted file mode 100644 index 7bb284f722..0000000000 --- a/src/site/apt/roadmap.apt +++ /dev/null @@ -1,22 +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. - -Apache log4j 1.2 Roadmap - - Apache log4j 1.2 is mature and widely deployed. Significant - changes are unlikely. Bug fixes and maintenance releases are anticipated. - - The next major version with is {{{http://logging.apache.org/log4j/2.0/index.html}Apache log4j 2}} - diff --git a/src/site/default-site-macros.vm b/src/site/default-site-macros.vm new file mode 100644 index 0000000000..20eb354e29 --- /dev/null +++ b/src/site/default-site-macros.vm @@ -0,0 +1,494 @@ +## 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. +## +#macro ( link $href $name $target $img $position $alt $border $width $height $title ) +#**##set ( $linkTitle = ' title="' + $name + '"' ) +#**##if( $target ) +#* *##set ( $linkTarget = ' target="' + $target + '"' ) +#**##else +#* *##set ( $linkTarget = "" ) +#**##end +#**##if ( $decoration.isLink( $href ) ) +#* *##set ( $linkClass = ' class="externalLink"' ) +#**##else +#* *##set ( $linkClass = "" ) +#**##end +#**##if ( $img ) +#* *##if ( $position == "left" ) +#* *##image($img $alt $border $width $height $title)$name## +#* *##else +#* *#$name #image($img $alt $border $width $height $title)## +#* *##end +#**##else +#* *#$name## +#**##end +#end +## +#macro ( image $img $alt $border $width $height $title ) +#**##if( $img ) +#* *##if ( !$decoration.isLink( $img ) ) +#* *##set ( $imgSrc = $PathTool.calculateLink( $img, $relativePath ) ) +#* *##set ( $imgSrc = $imgSrc.replaceAll( '\\', '/' ) ) +#* *##set ( $imgSrc = ' src="' + $imgSrc + '"' ) +#* *##else +#* *##set ( $imgSrc = ' src="' + $img + '"' ) +#* *##end +#* *##if( $alt ) +#* *##set ( $imgAlt = ' alt="' + $alt + '"' ) +#* *##else +#* *##set ( $imgAlt = ' alt=""' ) +#* *##end +#* *##if( $border ) +#* *##set ( $imgBorder = ' border="' + $border + '"' ) +#* *##else +#* *##set ( $imgBorder = "" ) +#* *##end +#* *##if( $width ) +#* *##set ( $imgWidth = ' width="' + $width + '"' ) +#* *##else +#* *##set ( $imgWidth = "" ) +#* *##end +#* *##if( $height ) +#* *##set ( $imgHeight = ' height="' + $height + '"' ) +#* *##else +#* *##set ( $imgHeight = "" ) +#* *##end +#* *##if( $title ) +#* *##set ( $imgTitle = ' title="' + $title + '"' ) +#* *##else +#* *##set ( $imgTitle = "" ) +#* *##end +#* *### +#**##end +#end +## +#macro ( banner $banner $id ) +#**##if ( $banner ) +#* *##if( $banner.href ) +#* *##set ( $hrf = $banner.href ) +#* *##if ( !$decoration.isLink( $hrf ) ) +#* *##set ( $hrf = $PathTool.calculateLink( $hrf, $relativePath ) ) +#* *##set ( $hrf = $hrf.replaceAll( '\\', '/' ) ) +#* *##if ( ( $hrf == '' ) ) +#* *##set ( $hrf = './' ) +#* *##end +#* *##end +#* *### +#* *##else +#* *#

+#* *##end +#**##end +#end +## +#macro ( links $links ) +#**##set ( $counter = 0 ) +#**##foreach( $item in $links ) +#* *##set ( $counter = $counter + 1 ) +#* *##set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) +#* *##set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) +#* *##link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height $item.title ) +#* *##if ( $links.size() > $counter ) +#* *# | +#* *##end +#**##end +#end +## +#macro ( breadcrumbs $breadcrumbs ) +#**##foreach( $item in $breadcrumbs ) +#* *##set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) +#* *##set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) +#* *##if ( ( $currentItemHref == '' ) ) +#* *##set ( $currentItemHref = './' ) +#* *##end +## +#* *##link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height $item.title ) +#**# > +#**##end +#**#$shortTitle +#**##if( $decoration.edit && $docRenderingContext.editable ) +#* *# [edit] +#**##end +#end +## +#macro ( displayTree $display $item ) +#**##if ( $item && $item.items && $item.items.size() > 0 ) +#* *##foreach( $subitem in $item.items ) +#* *##set ( $subitemHref = $PathTool.calculateLink( $subitem.href, $relativePath ) ) +#* *##set ( $subitemHref = $subitemHref.replaceAll( '\\', '/' ) ) +## +#* *##if ( $alignedFileName == $subitemHref ) +#* *##set ( $display = true ) +#* *##end +## +#* *##displayTree( $display $subitem ) +#* *##end +#**##end +#end +## +#macro ( menuItem $item $indent ) +#**##set ( $collapseClass = "none" ) +#**##set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) +#**##set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) +## +#**##if ( $item && $item.items && $item.items.size() > 0 ) +#* *##if ( $item.collapse == false ) +#* *##set ( $collapseClass = "expanded" ) +#* *##else +#* *### By default collapsed +#* *##set ( $collapseClass = "collapsed" ) +#* *##end +## +#* *##set ( $display = false ) +#* *##displayTree( $display $item ) +## +#* *##if ( $alignedFileName == $currentItemHref || $display ) +#* *##set ( $collapseClass = "expanded" ) +#* *##end +#**##end +$indent
  • ## +#**##if ( $item.img ) +#* *##if ( $item.position == "left" ) +#* *##if ( $alignedFileName == $currentItemHref ) +#* *##image($item.img $item.alt $item.border $item.width $item.height $item.title) $item.name +#* *##else +#* *##link($currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height $item.title) +#* *##end +#* *##else +#* *##if ( $alignedFileName == $currentItemHref ) +#* *#$item.name #image($item.img $item.alt $item.border $item.width $item.height $item.title) +#* *##else +#* *##link($currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height $item.title) +#* *##end +#* *##end +#**##else +#* *##if ( $alignedFileName == $currentItemHref ) +#* *#$item.name## +#* *##else +#* *##link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height $item.title ) +#* *##end +#**##end +#**##if ( $item && $item.items && $item.items.size() > 0 ) +#* *##if ( $collapseClass == "expanded" ) + +$indent
      +#* *##foreach( $subitem in $item.items ) +#* *##menuItem( $subitem "$indent " ) +#* *##end +$indent
    ## +#* *##end +#**##end +#**#
  • +#end +## +#macro ( mainMenu $menus ) +#**##foreach( $menu in $menus ) +#* *##if ( $menu.name ) +#* *##if ( $menu.img ) +#* *##if( $menu.position ) +#* *##set ( $position = $menu.position ) +#* *##else +#* *##set ( $position = "left" ) +#* *##end +## +#* *##if ( !$decoration.isLink( $menu.img ) ) +#* *##set ( $src = $PathTool.calculateLink( $menu.img, $relativePath ) ) +#* *##set ( $src = $src.replaceAll( '\\', '/' ) ) +#* *##set ( $src = ' src="' + $src + '"' ) +#* *##else +#* *##set ( $src = ' src="' + $menu.img + '"' ) +#* *##end +## +#* *##if( $menu.alt ) +#* *##set ( $alt = ' alt="' + $menu.alt + '"' ) +#* *##else +#* *##set ( $alt = ' alt="' + $menu.name + '"' ) +#* *##end +## +#* *##if( $menu.border ) +#* *##set ( $border = ' border="' + $menu.border + '"' ) +#* *##else +#* *##set ( $border = ' border="0"' ) +#* *##end +## +#* *##if( $menu.width ) +#* *##set ( $width = ' width="' + $menu.width + '"' ) +#* *##else +#* *##set ( $width = "" ) +#* *##end +#* *##if( $menu.height ) +#* *##set ( $height = ' height="' + $menu.height + '"' ) +#* *##else +#* *##set ( $height = "" ) +#* *##end +#* *##if( $menu.title ) +#* *##set ( $title = ' title="' + $menu.title + '"' ) +#* *##else +#* *##set ( $title = "" ) +#* *##end +## +#* *##set ( $img = '" ) +## +#* *##if ( $position == "left" ) +
    $img $menu.name
    +#* *##else +
    $menu.name $img
    +#* *##end +#* *##else +
    $menu.name
    +#* *##end +#* *##end +#* *##if ( $menu.items && $menu.items.size() > 0 ) +
      +#* *##foreach( $item in $menu.items ) +#* *##menuItem( $item '' ) +#* *##end +
    +#* *##end +#**##end +#end +## +#macro ( copyright ) +#**##if ( $project ) +#* *##if ( ${project.organization} && ${project.organization.name} ) +#* *##set ( $period = "" ) +#* *##else +#* *##set ( $period = "." ) +#* *##end +## +#* *##set ( $currentYear = ${currentDate.year} + 1900 ) +## +#* *##if ( ${project.inceptionYear} && ( ${project.inceptionYear} != ${currentYear.toString()} ) ) + ${project.inceptionYear}–${currentYear}${period}## +#* *##else + ${currentYear}${period}## +#* *##end +## +#* *##if ( ${project.organization} ) +#* *##if ( ${project.organization.name} && ${project.organization.url} ) +#* *#${project.organization.name}. +#* *##elseif ( ${project.organization.name} ) +#* *#${project.organization.name}. +#* *##end +#* *##end +#**##end +#end +## +#macro ( publishDate $position $decorationPublishDate $version ) +#**##if ( $publishDate ) +#* *##set ( $dateValue = $dateFormat.format( $publishDate ) ) +#**##elseif ( $decoration.custom.getChild( 'publishDate' ) ) +#* *##set ( $dateValue = $decoration.custom.getChild( 'publishDate' ).getValue() ) +#**##else +#* *##set ( $dateValue = $dateFormat.format( $currentDate ) ) +#**##end +## +#**##set ( $datePosition = $decorationPublishDate.position ) +#**##set ( $versionPosition = $version.position ) +## +#**##set ( $breadcrumbs = $decoration.body.breadcrumbs ) +#**##set ( $links = $decoration.body.links ) +## +#**##if ( $datePosition.equalsIgnoreCase( "right" ) && $links && $links.size() > 0 ) +#* *##set ( $prefix = " |" ) +#**##else +#* *##set ( $prefix = "" ) +#**##end +## +#**##if ( $datePosition.equalsIgnoreCase( $position ) ) +#* *##if ( ( $datePosition.equalsIgnoreCase( "right" ) ) || ( $datePosition.equalsIgnoreCase( "bottom" ) ) ) + $prefix $i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateValue +#* *##if ( $versionPosition.equalsIgnoreCase( $position ) ) + | $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} +#* *##end +#* *##elseif ( ( $datePosition.equalsIgnoreCase( "navigation-bottom" ) ) || ( $datePosition.equalsIgnoreCase( "navigation-top" ) ) ) +
    + $i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateValue +#* *##if ( $versionPosition.equalsIgnoreCase( $position ) ) + | $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} +#* *##end +
    +#* *##elseif ( $datePosition.equalsIgnoreCase( "left" ) ) +
    + $i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateValue +#* *##if ( $versionPosition.equalsIgnoreCase( $position ) ) + | $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} +#* *##end +#* *##if ( $breadcrumbs && $breadcrumbs.size() > 0 ) + | #breadcrumbs( $breadcrumbs ) +#* *##end +
    +#* *##end +#**##elseif ( $versionPosition.equalsIgnoreCase( $position ) ) +#* *##if ( ( $versionPosition.equalsIgnoreCase( "right" ) ) || ( $versionPosition.equalsIgnoreCase( "bottom" ) ) ) + $prefix $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} +#* *##elseif ( ( $versionPosition.equalsIgnoreCase( "navigation-bottom" ) ) || ( $versionPosition.equalsIgnoreCase( "navigation-top" ) ) ) +
    + $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} +
    +#* *##elseif ( $versionPosition.equalsIgnoreCase( "left" ) ) +
    + $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} +#* *##if ( $breadcrumbs && $breadcrumbs.size() > 0 ) + | #breadcrumbs( $breadcrumbs ) +#* *##end +
    +#* *##end +#**##elseif ( $position.equalsIgnoreCase( "left" ) ) +#* *##if ( $breadcrumbs && $breadcrumbs.size() > 0 ) +
    +#* *##breadcrumbs( $breadcrumbs ) +
    +#* *##end +#**##end +#end +## +#macro ( poweredByLogo $poweredBy ) +#**##if( $poweredBy ) +#* *##foreach ($item in $poweredBy) +#* *##if( $item.href ) +#* *##set ( $href = $PathTool.calculateLink( $item.href, $relativePath ) ) +#* *##set ( $href = $href.replaceAll( '\\', '/' ) ) +#* *##else +#* *##set ( $href="https://maven.apache.org/" ) +#* *##end +## +#* *##if( $item.name ) +#* *##set ( $name = $item.name ) +#* *##else +#* *##set ( $name = $i18n.getString( "site-renderer", $locale, "template.builtby" ) ) +#* *##set ( $name = "${name} Maven" ) +#* *##end +## +#* *##if( $item.img ) +#* *##set ( $img = $item.img ) +#* *##else +#* *##set ( $img = "images/maven-feather.png" ) +#* *##end +## +#* *##if ( !$decoration.isLink( $img ) ) +#* *##set ( $img = $PathTool.calculateLink( $img, $relativePath ) ) +#* *##set ( $img = $img.replaceAll( '\\', '/' ) ) +#* *##end +## +#* *##if( $item.alt ) +#* *##set ( $alt = ' alt="' + $item.alt + '"' ) +#* *##else +#* *##set ( $alt = ' alt="' + $name + '"' ) +#* *##end +## +#* *##if( $item.border ) +#* *##set ( $border = ' border="' + $item.border + '"' ) +#* *##else +#* *##set ( $border = "" ) +#* *##end +## +#* *##if( $item.width ) +#* *##set ( $width = ' width="' + $item.width + '"' ) +#* *##else +#* *##set ( $width = "" ) +#* *##end +#* *##if( $item.height ) +#* *##set ( $height = ' height="' + $item.height + '"' ) +#* *##else +#* *##set ( $height = "" ) +#* *##end +#* *##if( $item.title ) +#* *##set ( $title = ' title="' + $item.title + '"' ) +#* *##else +#* *##set ( $title = "" ) +#* *##end +## + + + +#* *##end +#* *##if( $poweredBy.isEmpty() ) + + $i18n.getString( + +#* *##end +#**##else + + $i18n.getString( + +#**##end +#end +## +#macro ( googleAnalytics $accountId ) +#**##if( $accountId && $accountId != "" ) + + +#**##end +#end +## +#macro( generatedBy ) +Apache Maven Doxia Site Renderer#if( $doxiaSiteRendererVersion ) $doxiaSiteRendererVersion#end## +#end +## \ No newline at end of file diff --git a/src/site/maven-site.vm b/src/site/maven-site.vm deleted file mode 100644 index 45de1aced7..0000000000 --- a/src/site/maven-site.vm +++ /dev/null @@ -1,522 +0,0 @@ - - - -#macro ( link $href $name $target $img $position $alt $border $width $height ) - #set ( $linkTitle = ' title="' + $name + '"' ) - #if( $target ) - #set ( $linkTarget = ' target="' + $target + '"' ) - #else - #set ( $linkTarget = "" ) - #end - #if ( ( $href.toLowerCase().startsWith("http") || $href.toLowerCase().startsWith("https") ) ) - #set ( $linkClass = ' class="externalLink"' ) - #else - #set ( $linkClass = "" ) - #end - #if ( $img ) - #if ( $position == "left" ) - #image($img $alt $border $width $height)$name - #else - $name #image($img $alt $border $width $height) - #end - #else - $name - #end -#end -## -#macro ( image $img $alt $border $width $height ) - #if( $img ) - #if ( ! ( $img.toLowerCase().startsWith("http") || $img.toLowerCase().startsWith("https") ) ) - #set ( $imgSrc = $PathTool.calculateLink( $img, $relativePath ) ) - #set ( $imgSrc = $imgSrc.replaceAll( '\\', '/' ) ) - #set ( $imgSrc = ' src="' + $imgSrc + '"' ) - #else - #set ( $imgSrc = ' src="' + $img + '"' ) - #end - #if( $alt ) - #set ( $imgAlt = ' alt="' + $alt + '"' ) - #else - #set ( $imgAlt = ' alt=""' ) - #end - #if( $border ) - #set ( $imgBorder = ' border="' + $border + '"' ) - #else - #set ( $imgBorder = "" ) - #end - #if( $width ) - #set ( $imgWidth = ' width="' + $width + '"' ) - #else - #set ( $imgWidth = "" ) - #end - #if( $height ) - #set ( $imgHeight = ' height="' + $height + '"' ) - #else - #set ( $imgHeight = "" ) - #end - - #end -#end -#macro ( banner $banner $id ) - #if ( $banner ) - #if( $banner.href ) - - #else - - #end - #end -#end -## -#macro ( links $links ) - #set ( $counter = 0 ) - #foreach( $item in $links ) - #set ( $counter = $counter + 1 ) - #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) - #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) - #link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height ) - #if ( $links.size() > $counter ) - | - #end - #end -#end -## -#macro ( breadcrumbs $breadcrumbs ) - #set ( $counter = 0 ) - #foreach( $item in $breadcrumbs ) - #set ( $counter = $counter + 1 ) - #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) - #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) -## - #if ( $currentItemHref == $alignedFileName || $currentItemHref == "" ) - $item.name - #else - #link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height ) - #end - #if ( $breadcrumbs.size() > $counter ) - > - #end - #end -#end -## -#macro ( displayTree $display $item ) - #if ( $item && $item.items && $item.items.size() > 0 ) - #foreach( $subitem in $item.items ) - #set ( $subitemHref = $PathTool.calculateLink( $subitem.href, $relativePath ) ) - #set ( $subitemHref = $subitemHref.replaceAll( '\\', '/' ) ) - #if ( $alignedFileName == $subitemHref ) - #set ( $display = true ) - #end -## - #displayTree( $display $subitem ) - #end - #end -#end -## -#macro ( menuItem $item ) - #set ( $collapse = "none" ) - #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) - #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) -## - #if ( $item && $item.items && $item.items.size() > 0 ) - #if ( $item.collapse == false ) - #set ( $collapse = "expanded" ) - #else - ## By default collapsed - #set ( $collapse = "collapsed" ) - #end -## - #set ( $display = false ) - #displayTree( $display $item ) -## - #if ( $alignedFileName == $currentItemHref || $display ) - #set ( $collapse = "expanded" ) - #end - #end -
  • - #if ( $item.img ) - #if ( $item.position == "left" ) - #if ( $alignedFileName == $currentItemHref ) - #image($item.img $item.alt $item.border $item.width $item.height) $item.name - #else - #link($currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height) - #end - #else - #if ( $alignedFileName == $currentItemHref ) - $item.name #image($item.img $item.alt $item.border $item.width $item.height) - #else - #link($currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height) - #end - #end - #else - #if ( $alignedFileName == $currentItemHref ) - $item.name - #else - #link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height ) - #end - #end - #if ( $item && $item.items && $item.items.size() > 0 ) - #if ( $collapse == "expanded" ) -
      - #foreach( $subitem in $item.items ) - #menuItem( $subitem ) - #end -
    - #end - #end -
  • -#end -## -#macro ( mainMenu $menus ) - #foreach( $menu in $menus ) - #if ( $menu.name ) - #if ( $menu.img ) - #if( $menu.position ) - #set ( $position = $menu.position ) - #else - #set ( $position = "left" ) - #end -## - #if ( ! ( $menu.img.toLowerCase().startsWith("http") || $menu.img.toLowerCase().startsWith("https") ) ) - #set ( $src = $PathTool.calculateLink( $menu.img, $relativePath ) ) - #set ( $src = $src.replaceAll( '\\', '/' ) ) - #set ( $src = ' src="' + $src + '"' ) - #else - #set ( $src = ' src="' + $menu.img + '"' ) - #end -## - #if( $menu.alt ) - #set ( $alt = ' alt="' + $menu.alt + '"' ) - #else - #set ( $alt = ' alt="' + $menu.name + '"' ) - #end -## - #if( $menu.border ) - #set ( $border = ' border="' + $menu.border + '"' ) - #else - #set ( $border = ' border="0"' ) - #end -## - #if( $menu.width ) - #set ( $width = ' width="' + $menu.width + '"' ) - #else - #set ( $width = "" ) - #end - #if( $menu.height ) - #set ( $height = ' height="' + $menu.height + '"' ) - #else - #set ( $height = "" ) - #end -## - #set ( $img = '" ) -## - #if ( $position == "left" ) -
    $img $menu.name
    - #else -
    $menu.name $img
    - #end - #else -
    $menu.name
    - #end - #end - #if ( $menu.items && $menu.items.size() > 0 ) -
      - #foreach( $item in $menu.items ) - #menuItem( $item ) - #end -
    - #end - #end -#end -## -#macro ( copyright ) - #if ( $project ) - #if ( ${project.organization} && ${project.organization.name} ) - #set ( $period = "" ) - #else - #set ( $period = "." ) - #end -## - #set ( $currentYear = ${currentDate.year} + 1900 ) -## - #if ( ${project.inceptionYear} && ( ${project.inceptionYear} != ${currentYear.toString()} ) ) - ${project.inceptionYear}-${currentYear}${period} - #else - ${currentYear}${period} - #end -## - #if ( ${project.organization} ) - #if ( ${project.organization.name} && ${project.organization.url} ) - ${project.organization.name}. - #elseif ( ${project.organization.name} ) - ${project.organization.name}. - #end - #end - #end -#end -## -#macro ( publishDate $position $publishDate $version ) - #if ( $publishDate && $publishDate.format ) - #set ( $format = $publishDate.format ) - #else - #set ( $format = "yyyy-MM-dd" ) - #end -## - $dateFormat.applyPattern( $format ) -## - #set ( $dateToday = $dateFormat.format( $currentDate ) ) -## - #if ( $publishDate && $publishDate.position ) - #set ( $datePosition = $publishDate.position ) - #else - #set ( $datePosition = "left" ) - #end -## - #if ( $version ) - #if ( $version.position ) - #set ( $versionPosition = $version.position ) - #else - #set ( $versionPosition = "left" ) - #end - #else - #set ( $version = "" ) - #set ( $versionPosition = "left" ) - #end -## - #set ( $breadcrumbs = $decoration.body.breadcrumbs ) - #set ( $links = $decoration.body.links ) - - #if ( $datePosition.equalsIgnoreCase( "right" ) && $links && $links.size() > 0 ) - #set ( $prefix = " |" ) - #else - #set ( $prefix = "" ) - #end -## - #if ( $datePosition.equalsIgnoreCase( $position ) ) - #if ( ( $datePosition.equalsIgnoreCase( "right" ) ) || ( $datePosition.equalsIgnoreCase( "bottom" ) ) ) - $prefix $i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateToday - #if ( $versionPosition.equalsIgnoreCase( $position ) ) -  | $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} - #end - #elseif ( ( $datePosition.equalsIgnoreCase( "navigation-bottom" ) ) || ( $datePosition.equalsIgnoreCase( "navigation-top" ) ) ) -
    - $i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateToday - #if ( $versionPosition.equalsIgnoreCase( $position ) ) -  | $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} - #end -
    - #elseif ( $datePosition.equalsIgnoreCase("left") ) -
    - $i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateToday - #if ( $versionPosition.equalsIgnoreCase( $position ) ) -  | $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} - #end - #if ( $breadcrumbs && $breadcrumbs.size() > 0 ) - | #breadcrumbs( $breadcrumbs ) - #end -
    - #end - #elseif ( $versionPosition.equalsIgnoreCase( $position ) ) - #if ( ( $versionPosition.equalsIgnoreCase( "right" ) ) || ( $versionPosition.equalsIgnoreCase( "bottom" ) ) ) - $prefix $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} - #elseif ( ( $versionPosition.equalsIgnoreCase( "navigation-bottom" ) ) || ( $versionPosition.equalsIgnoreCase( "navigation-top" ) ) ) -
    - $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} -
    - #elseif ( $versionPosition.equalsIgnoreCase("left") ) -
    - $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} - #if ( $breadcrumbs && $breadcrumbs.size() > 0 ) - | #breadcrumbs( $breadcrumbs ) - #end -
    - #end - #elseif ( $position.equalsIgnoreCase( "left" ) ) - #if ( $breadcrumbs && $breadcrumbs.size() > 0 ) -
    - #breadcrumbs( $breadcrumbs ) -
    - #end - #end -#end -## -#macro ( poweredByLogo $poweredBy ) - #if( $poweredBy ) - #foreach ($item in $poweredBy) - #if( $item.href ) - #set ( $href = $PathTool.calculateLink( $item.href, $relativePath ) ) - #set ( $href = $href.replaceAll( '\\', '/' ) ) - #else - #set ( $href="http://maven.apache.org/" ) - #end -## - #if( $item.name ) - #set ( $name = $item.name ) - #else - #set ( $name = $i18n.getString( "site-renderer", $locale, "template.builtby" ) ) - #set ( $name = "${name} Maven" ) - #end -## - #if( $item.img ) - #set ( $img = $item.img ) - #else - #set ( $img = "images/maven-feather.png" ) - #end -## - #if ( ! ( $img.toLowerCase().startsWith("http") || $img.toLowerCase().startsWith("https") ) ) - #set ( $img = $PathTool.calculateLink( $img, $relativePath ) ) - #set ( $img = $src.replaceAll( '\\', '/' ) ) - #end -## - #if( $item.alt ) - #set ( $alt = ' alt="' + $item.alt + '"' ) - #else - #set ( $alt = ' alt="' + $name + '"' ) - #end -## - #if( $item.border ) - #set ( $border = ' border="' + $item.border + '"' ) - #else - #set ( $border = "" ) - #end -## - #if( $item.width ) - #set ( $width = ' width="' + $item.width + '"' ) - #else - #set ( $width = "" ) - #end - #if( $item.height ) - #set ( $height = ' height="' + $item.height + '"' ) - #else - #set ( $height = "" ) - #end -## - - - - #end - #if( $poweredBy.isEmpty() ) - - $i18n.getString( - - #end - #else - - $i18n.getString( - - #end -#end -## - - - - $title - - -#foreach( $author in $authors ) - -#end -#if ( $dateCreation ) - -#end -#if ( $dateRevision ) - -#end -#if ( $locale ) - -#end - #if ( $decoration.body.head ) - #foreach( $item in $decoration.body.head.getChildren() ) - ## Workaround for DOXIA-150 due to a non-desired behaviour in p-u - ## @see org.codehaus.plexus.util.xml.Xpp3Dom#toString() - ## @see org.codehaus.plexus.util.xml.Xpp3Dom#toUnescapedString() - #set ( $documentHeader = '' ) - #if ( $item.name == "script" ) - $StringUtils.replace( $item.toUnescapedString(), $documentHeader, "" ) - #else - $StringUtils.replace( $item.toString(), $documentHeader, "" ) - #end - #end - #end - - - - -
    - -
    -
    -
    - $bodyContent -
    -
    -
    -
    -
    - - - diff --git a/src/site/resources/css/maven-theme.css b/src/site/resources/css/maven-theme.css new file mode 100644 index 0000000000..0148466593 --- /dev/null +++ b/src/site/resources/css/maven-theme.css @@ -0,0 +1,157 @@ +/* + 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. + +*/ +body { + padding: 0px 0px 10px 0px; +} +body, td, select, input, li{ + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 13px; +} +code{ + font-family: Courier, monospace; + font-size: 13px; +} +a { + text-decoration: none; +} +a:link { + color:#36a; +} +a:visited { + color:#47a; +} +a:active, a:hover { + color:#69c; +} +#legend li.externalLink { + background: url(../images/external.png) left top no-repeat; + padding-left: 18px; +} +a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover { + background: url(../images/external.png) right center no-repeat; + padding-right: 18px; +} +#legend li.newWindow { + background: url(../images/newwindow.png) left top no-repeat; + padding-left: 18px; +} +a.newWindow, a.newWindow:link, a.newWindow:visited, a.newWindow:active, a.newWindow:hover { + background: url(../images/newwindow.png) right center no-repeat; + padding-right: 18px; +} +h2 { + padding: 4px 4px 4px 6px; + border: 1px solid #999; + color: #900; + background-color: #ddd; + font-weight:900; + font-size: x-large; +} +h3 { + padding: 4px 4px 4px 6px; + border: 1px solid #aaa; + color: #900; + background-color: #eee; + font-weight: normal; + font-size: large; +} +h4 { + padding: 4px 4px 4px 6px; + border: 1px solid #bbb; + color: #900; + background-color: #fff; + font-weight: normal; + font-size: large; +} +h5 { + padding: 4px 4px 4px 6px; + color: #900; + font-size: normal; +} +p { + line-height: 1.3em; + font-size: small; +} +#breadcrumbs { + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; + background-color: #ccc; +} +#leftColumn { + margin: 10px 0 0 5px; + border: 1px solid #999; + background-color: #eee; +} +#navcolumn h5 { + font-size: smaller; + border-bottom: 1px solid #aaaaaa; + padding-top: 2px; + color: #000; +} + +table.bodyTable th { + color: white; + background-color: #bbb; + text-align: left; + font-weight: bold; +} + +table.bodyTable th, table.bodyTable td { + font-size: 1em; +} + +table.bodyTable tr.a { + background-color: #ddd; +} + +table.bodyTable tr.b { + background-color: #eee; +} + +.source { + border: 1px solid #999; +} +dl { + padding: 4px 4px 4px 6px; + border: 1px solid #aaa; + background-color: #ffc; +} +dt { + color: #900; +} +#organizationLogo img, #projectLogo img, #projectLogo span{ + margin: 8px; +} +#banner { + border-bottom: 1px solid #fff; +} +.errormark, .warningmark, .donemark, .infomark { + background: url(../images/icon_error_sml.gif) no-repeat; +} + +.warningmark { + background-image: url(../images/icon_warning_sml.gif); +} + +.donemark { + background-image: url(../images/icon_success_sml.gif); +} + +.infomark { + background-image: url(../images/icon_info_sml.gif); +} diff --git a/src/site/resources/images/collapsed.gif b/src/site/resources/images/collapsed.gif new file mode 100644 index 0000000000..6e71084064 Binary files /dev/null and b/src/site/resources/images/collapsed.gif differ diff --git a/src/site/resources/images/expanded.gif b/src/site/resources/images/expanded.gif new file mode 100644 index 0000000000..0fef3d89e0 Binary files /dev/null and b/src/site/resources/images/expanded.gif differ diff --git a/src/site/resources/images/external.png b/src/site/resources/images/external.png new file mode 100644 index 0000000000..3f999fc88b Binary files /dev/null and b/src/site/resources/images/external.png differ diff --git a/src/site/resources/images/icon_error_sml.gif b/src/site/resources/images/icon_error_sml.gif new file mode 100644 index 0000000000..61132ef2b0 Binary files /dev/null and b/src/site/resources/images/icon_error_sml.gif differ diff --git a/src/site/resources/images/icon_info_sml.gif b/src/site/resources/images/icon_info_sml.gif new file mode 100644 index 0000000000..c6cb9ad7ce Binary files /dev/null and b/src/site/resources/images/icon_info_sml.gif differ diff --git a/src/site/resources/images/icon_success_sml.gif b/src/site/resources/images/icon_success_sml.gif new file mode 100644 index 0000000000..52e85a430a Binary files /dev/null and b/src/site/resources/images/icon_success_sml.gif differ diff --git a/src/site/resources/images/icon_warning_sml.gif b/src/site/resources/images/icon_warning_sml.gif new file mode 100644 index 0000000000..873bbb52cb Binary files /dev/null and b/src/site/resources/images/icon_warning_sml.gif differ diff --git a/src/site/resources/images/newwindow.png b/src/site/resources/images/newwindow.png new file mode 100644 index 0000000000..6287f72bd0 Binary files /dev/null and b/src/site/resources/images/newwindow.png differ diff --git a/src/site/site-template.vm b/src/site/site-template.vm new file mode 100644 index 0000000000..63717fe193 --- /dev/null +++ b/src/site/site-template.vm @@ -0,0 +1,106 @@ + +## 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. +## +#parse( "default-site-macros.vm" ) + +## + + + + +## put meta together + +#foreach( $author in $authors ) + +#end +#if ( $documentDate ) + +#end + $title + + + + +#**##if( $decoration.body.head ) +#* *#$render.eval( $decoration.body.head ) +#**##end +#**##if( $headContent )$headContent#end +#**##googleAnalytics( $decoration.googleAnalyticsAccountId ) + + + + +
    + +
    +
    +
    +

    End of Life

    On August 5, 2015 the Logging Services Project + Management Committee announced that Log4j 1.x had reached end of life. + For complete text of the announcement please see the + Apache Blog. + Users of Log4j 1 are recommended to upgrade to + Apache Log4j 2.

    +#* *#$bodyContent +
    +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/src/site/site.xml b/src/site/site.xml index e233aef621..351f4f1aa5 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -38,11 +38,10 @@ - - + @@ -52,7 +51,6 @@ - diff --git a/src/site/xdoc/building.xml b/src/site/xdoc/building.xml index f32364592c..5a65ccde97 100644 --- a/src/site/xdoc/building.xml +++ b/src/site/xdoc/building.xml @@ -43,22 +43,13 @@ $> sudo apt-get install openjdk-6-jdk -

    Install Maven 2, Subversion, mingw and xemacs21, openssh-server:

    +

    Install Maven 3, Subversion, mingw and xemacs21, openssh-server:

    -$> sudo apt-get install maven2 subversion mingw32 xemacs21 openssh-server
    +$> sudo apt-get install maven3 git mingw32 xemacs21 openssh-server
     
    -

    Copy Win32 version of jni_md.h for NTEventLogAppender.dll

    - -
    -c:\>cd "\Program Files\Java\jdk_1.6.0_16\include\win32
    -c:\>scp jni_md.h username@hostname:
    -
    -$> export JNI_WIN32_INCLUDE_DIR=/home/username
    -
    - -

    Signing & Deploying

    +

    Outdated: signing & Deploying

    Create a local ssh key with no passphrase to enable "deployment" of site back to the local machine using scp.

    @@ -107,12 +98,14 @@ $ ssh -l USERNAME people.apache.org $ ssh localhost -

    Building release artifacts

    +

    Untested: Building release artifacts

    + +

    Instructions not tested for Log4J 1.2.18. The switch to Maven 3 and git probably mean changes. Make sure to check the INSTALL file at https://github.com/apache/log4j/blob/trunk/INSTALL

    -

    Before you build, please make sure you have a nonblocking editor set as SVN editor. Like:

    +

    Before you build, please make sure you have a nonblocking editor set as GIT editor. Like:

    -$ export SVN_EDITOR=xemacs
    +$ export GIT_EDITOR=xemacs
     

    Other checks:

    @@ -122,16 +115,17 @@ $ export SVN_EDITOR=xemacs to the date the release candidate is created.
  • Please update doap_log4j.rdf to reflect the correct version. Use the same release date as in changes.
  • -

    The release artifacts were originally built by:

    + +

    Untested: the release artifacts might be buildable with:

    -$> svn co http://svn.apache.org/repos/asf/logging/log4j/trunk log4j
    +$> git clone git@github.com:apache/log4j.git
     $> cd log4j
     $> mvn package release:prepare
     $> mvn release:perform
     
    -

    Note: you'll be ask for a SVN tagname. Please use the following pattern: v1.2.17-RC1.

    +

    Note: you'll be ask for a git tagname. Please use the following pattern: v1.2.17-RC1.

    Attention: this is an non-interactive build. In some cases it is necessary @@ -140,13 +134,35 @@ to the release plugin commands. This is surely not safe because your password can be seen clearly.

    -

    The release artifacts can be rebuilt by:

    +

    Outdated: The release artifacts can be rebuilt by:

     $ mvn release:perform -DconnectionUrl=scm:svn:https://svn.apache.org/repos/asf/logging/log4j/tags/v1_2_16
     
    -

    Building site and artifacts from a tag:

    +

    ATTENTION: if your asc files are not created, you need to create them manually. F. e.

    + +
    +    #!/bin/sh
    +
    +    if [ -n "$1" ]
    +    then
    +      root_dir=$1
    +    else
    +      root_dir=.
    +    fi
    +
    +    for file in $root_dir/*.jar $root_dir/*.pom $root_dir/*.zip $root_dir/*.tar.gz; do
    +       echo §file
    +        gpg --armor --output $file.asc --detach-sig $file
    +        echo "GPG verification output"
    +        gpg --verify $file.asc $file
    +        echo "~~~~~~~~~~~~~~~~~~~~~~~"
    +    done
    +
    + + +

    Outdated: building site and artifacts from a tag:

     $ svn co https://svn.apache.org/repos/asf/logging/log4j/tags/v1_2_16
    @@ -173,7 +189,7 @@ The staged version can be published to the main public site by executing
     "svn update" in /www/logging.apache.org/log4j/1.2 on people.apache.org.
     

    -

    If a vote has failed

    +

    Outdated: If a vote has failed

    • Send a "cancel" note to the mailinglist (usually resend the vote mail with [CANCEL] in subject
    • Delete the RC artifacts from:
      http://people.apache.org/builds/logging/repo/log4j/log4j/
    • @@ -181,7 +197,7 @@ The staged version can be published to the main public site by executing -

      If a vote has passed

      +

      Outdated: If a vote has passed

      If a RC has passed the vote, these steps are necessary:

      @@ -190,8 +206,12 @@ The staged version can be published to the main public site by executing $> svn mv https://svn.apache.org/repos/asf/logging/log4j/tags/log4j-1.2.17-RC1 https://svn.apache.org/repos/asf/logging/log4j/tags/log4j-1.2.17
    -

    Change the pom.xml version to the prior version number.

    +

    mv the tar.gz and the zip files to p.a.o dist

    +

    Create a jar file containing your artifacts: jar cf log4j-bundle-1217.jar *

    +

    Upload the bundle to repository.apache.org and follow the instructions to get the artifacts from staging to proper

    + +

    Send an announcement to: announce@apache.org, general@logging.apache.org, log4j-dev@logging.apache.org, log4j-user@logging.apache.org

    - \ No newline at end of file + diff --git a/tests/README b/tests/README deleted file mode 100644 index fcca3958ba..0000000000 --- a/tests/README +++ /dev/null @@ -1,53 +0,0 @@ - -This directory contains a series of log4j test cases. - -Prerequisites -============= - -Jakarta-ant is used to compile and run the tests. Jakarta-ant version -1.4.0 was used to compile and run the tests. The optional -jakarta-ant-1.4-optional.jar file is required to be in the -$ANT_HOME/lib directory where ANT_HOME envrironment variable point to -the directory where you installed jakarta-ant. - -The tests cases as well running ant require a JAXP compatible -parser. Such a parser is placed on the classpath by the shell or batch -script that invokes ant, namely $ANT_HOME/bin/ant on UNIX and -%ANT_HOME%/bin/ant.bat on Windows. - -The test cases are based on Junit version 3.7+. - -IMPORTANT: You need to place junit.jar in your CLASSPATH environment -variable. - -The test cases perform some regular expression based filtering. This -requires jakarta-oro. Version-2.0.5 was used when writing the -tests. You need to have jakarta.oro.jar property (found in the -build.properties file) to point to jakarta-oro.jar. See the file -build.properties.sample for an example of a build.properties file. - -Assuming jakarta-ant is installed properly, depending on your platform -type $ANT_HOME/bin/ant or %ANT_HOME%/bin/ant.bat to see the available -commands. - ------------------------------------------------------------------------- -NOTE: The compilation and execution of tests must be performed from - within the tests/ directory, that is from the directory where - this README file is located. ------------------------------------------------------------------------- - -Writing a new test case -======================= - -Our test cases are based on junit and you should be familiar with -junit in order to write new a test case. - -Some of the existing test are actually regression tests. They compare -the output of a test with the output of a previous run, a.k.a a -witness, which is purported to be correct. Since the ouput of some -tests vary on time and line numbers, before comparing the output with -a witness, we transform the output by unifying the result, for example -by removing date and time information. - -To automatically run your test case with the rest of the log4j test -cases, you need to modify tests/build.xml. diff --git a/tests/build.properties.sample b/tests/build.properties.sample deleted file mode 100644 index 5f0f1b879d..0000000000 --- a/tests/build.properties.sample +++ /dev/null @@ -1,48 +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. -# -# -# by default assume that all necessary dependencies -# are relative to the user's home directory -# -lib.home.dir=/java - -# The jaxp interface and a jaxp parser are required -# to build the DOMConfigurator. -# -# modern equivalents are xml-commons-apis.jar -# and xercesImpl.jar -jaxp.home=${lib.home.dir}/crimson-1.1.3 -jaxp.jaxp.jar=${jaxp.home}/crimson.jar -jaxp.parser.jar=${jaxp.home}/crimson.jar - -jakarta.oro.jar=${lib.home.dir}/jakarta-oro-2.0.8/jakarta-oro-2.0.8.jar -clover.jar=${lib.home.dir}/clover-1.3.8/lib/clover.jar -deprecation=on - -# junit must be on the classpath or specified with -lib -# only needs to be set here for JDK 1.1. -junit.jar=${lib.home.dir}/junit3.8.1/junit.jar - -# -# Jalopy source code reformatter -# -# -jalopy-ant.dir=${lib.home.dir}/jalopy-ant-0.6.2 - -# -# Checkstyle coding convention checker -# -checkstyle.jar=${lib.home.dir}/checkstyle-4.0-beta2/checkstyle-all-4.0-beta2.jar diff --git a/tests/build.xml b/tests/build.xml deleted file mode 100644 index 74a7139dce..0000000000 --- a/tests/build.xml +++ /dev/null @@ -1,565 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - These are the targets supported by this ANT build scpript: - - build - compile all project files, if a certain library is missing, - then the compilation of its dependents are skipped. - - regression - Run regression tests which check large parts of log4j. - - runAll - run all available tests - - Specify the log4j.jar property to test an arbitrary jar, - otherwise the parent log4j will be built and tested. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - clover.jar must be in the classpath and should also be - placed in the lib directory. A version of clover - (http://www.cenqua.com/clover) for use with ASF projects - is available from the committers/donated-licenses/clover module - in the SVN repository. - - - - - - - - - - - - - - - - - - - - - - - -Specify files to reformat with -Djalopy.files=PATTERN. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/input/fallback1.properties b/tests/input/fallback1.properties index bf520ae407..0ea3dd885d 100644 --- a/tests/input/fallback1.properties +++ b/tests/input/fallback1.properties @@ -24,7 +24,7 @@ log4j.appender.PRIMARY.layout=org.apache.log4j.PatternLayout log4j.appender.PRIMARY.layout.conversionPattern=%-5p %c{2} - %m%n log4j.appender.FALLBACK=org.apache.log4j.FileAppender -log4j.appender.FALLBACK.File=output/temp +log4j.appender.FALLBACK.File=output/temp.ErrorHandlerTestCase log4j.appender.FALLBACK.Append=false log4j.appender.FALLBACK.layout=org.apache.log4j.PatternLayout log4j.appender.FALLBACK.layout.ConversionPattern=FALLBACK - %c - %m%n diff --git a/tests/input/hierarchyThreshold1.properties b/tests/input/hierarchyThreshold1.properties index 81a529ecda..0619d89651 100644 --- a/tests/input/hierarchyThreshold1.properties +++ b/tests/input/hierarchyThreshold1.properties @@ -16,7 +16,7 @@ log4j.threshold=OFF log4j.rootLogger=,A log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.File=output/temp +log4j.appender.A.File=output/temp.HierarchyThresholdTestCase log4j.appender.A.Append=false log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n \ No newline at end of file +log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n diff --git a/tests/input/hierarchyThreshold2.properties b/tests/input/hierarchyThreshold2.properties index b79aa7f603..f94a7c5d70 100644 --- a/tests/input/hierarchyThreshold2.properties +++ b/tests/input/hierarchyThreshold2.properties @@ -16,7 +16,7 @@ log4j.threshold=FATAL log4j.rootLogger=,A log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.File=output/temp +log4j.appender.A.File=output/temp.HierarchyThresholdTestCase log4j.appender.A.Append=false log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n \ No newline at end of file +log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n diff --git a/tests/input/hierarchyThreshold3.properties b/tests/input/hierarchyThreshold3.properties index aae8b4435f..1901812dcc 100644 --- a/tests/input/hierarchyThreshold3.properties +++ b/tests/input/hierarchyThreshold3.properties @@ -16,7 +16,7 @@ log4j.threshold=ERROR log4j.rootLogger=,A log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.File=output/temp +log4j.appender.A.File=output/temp.HierarchyThresholdTestCase log4j.appender.A.Append=false log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n \ No newline at end of file +log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n diff --git a/tests/input/hierarchyThreshold4.properties b/tests/input/hierarchyThreshold4.properties index ba54f13321..4ef8704dd5 100644 --- a/tests/input/hierarchyThreshold4.properties +++ b/tests/input/hierarchyThreshold4.properties @@ -16,7 +16,7 @@ log4j.threshold=WARN log4j.rootLogger=,A log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.File=output/temp +log4j.appender.A.File=output/temp.HierarchyThresholdTestCase log4j.appender.A.Append=false log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n \ No newline at end of file +log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n diff --git a/tests/input/hierarchyThreshold5.properties b/tests/input/hierarchyThreshold5.properties index f4ef8587f1..5b49ba0a16 100644 --- a/tests/input/hierarchyThreshold5.properties +++ b/tests/input/hierarchyThreshold5.properties @@ -16,7 +16,7 @@ log4j.threshold=INFO log4j.rootLogger=,A log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.File=output/temp +log4j.appender.A.File=output/temp.HierarchyThresholdTestCase log4j.appender.A.Append=false log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n \ No newline at end of file +log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n diff --git a/tests/input/hierarchyThreshold6.properties b/tests/input/hierarchyThreshold6.properties index 3cc6122a21..7f2f8a9cb7 100644 --- a/tests/input/hierarchyThreshold6.properties +++ b/tests/input/hierarchyThreshold6.properties @@ -16,7 +16,7 @@ log4j.threshold=DEBUG log4j.rootLogger=,A log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.File=output/temp +log4j.appender.A.File=output/temp.HierarchyThresholdTestCase log4j.appender.A.Append=false log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n \ No newline at end of file +log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n diff --git a/tests/input/hierarchyThreshold7.properties b/tests/input/hierarchyThreshold7.properties index 3ffcdfb003..f213b81a1b 100644 --- a/tests/input/hierarchyThreshold7.properties +++ b/tests/input/hierarchyThreshold7.properties @@ -16,7 +16,7 @@ log4j.threshold=TRACE#org.apache.log4j.xml.XLevel log4j.rootLogger=ALL,A log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.File=output/temp +log4j.appender.A.File=output/temp.HierarchyThresholdTestCase log4j.appender.A.Append=false log4j.appender.A.layout=org.apache.log4j.PatternLayout log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n diff --git a/tests/input/hierarchyThreshold8.properties b/tests/input/hierarchyThreshold8.properties index a21eed9276..0b8fdffe51 100644 --- a/tests/input/hierarchyThreshold8.properties +++ b/tests/input/hierarchyThreshold8.properties @@ -16,7 +16,7 @@ log4j.threshold=ALL log4j.rootLogger=ALL,A log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.File=output/temp +log4j.appender.A.File=output/temp.HierarchyThresholdTestCase log4j.appender.A.Append=false log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n \ No newline at end of file +log4j.appender.A.layout.ConversionPattern=%p [%t] %c{2} = %m%n diff --git a/tests/input/pattern/enhancedPatternLayout.mdc.1.properties b/tests/input/pattern/enhancedPatternLayout.mdc.1.properties index dc6055ab08..35bf0a7795 100644 --- a/tests/input/pattern/enhancedPatternLayout.mdc.1.properties +++ b/tests/input/pattern/enhancedPatternLayout.mdc.1.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%-5p - %m %X%n diff --git a/tests/input/pattern/enhancedPatternLayout1.properties b/tests/input/pattern/enhancedPatternLayout1.properties index 7d73b79951..2f22f3cb91 100644 --- a/tests/input/pattern/enhancedPatternLayout1.properties +++ b/tests/input/pattern/enhancedPatternLayout1.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootLogger=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.file=output/temp +log4j.appender.testAppender.file=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%-5p - %m%n diff --git a/tests/input/pattern/enhancedPatternLayout10.properties b/tests/input/pattern/enhancedPatternLayout10.properties index cf62885b1a..3bf8fa3c37 100644 --- a/tests/input/pattern/enhancedPatternLayout10.properties +++ b/tests/input/pattern/enhancedPatternLayout10.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append= false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %l: %m%n diff --git a/tests/input/pattern/enhancedPatternLayout11.properties b/tests/input/pattern/enhancedPatternLayout11.properties index 02b7798664..bdf5b70b32 100644 --- a/tests/input/pattern/enhancedPatternLayout11.properties +++ b/tests/input/pattern/enhancedPatternLayout11.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%-5p [%t] %c{2}: %m%n diff --git a/tests/input/pattern/enhancedPatternLayout12.properties b/tests/input/pattern/enhancedPatternLayout12.properties index 3c2677952a..8abe2b0d74 100644 --- a/tests/input/pattern/enhancedPatternLayout12.properties +++ b/tests/input/pattern/enhancedPatternLayout12.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %C.%M(%F:%L): %m%n diff --git a/tests/input/pattern/enhancedPatternLayout13.properties b/tests/input/pattern/enhancedPatternLayout13.properties index f7cadbe5dd..83a6b16ca2 100644 --- a/tests/input/pattern/enhancedPatternLayout13.properties +++ b/tests/input/pattern/enhancedPatternLayout13.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %C{3}.%M(%F:%L): %m%n diff --git a/tests/input/pattern/enhancedPatternLayout14.properties b/tests/input/pattern/enhancedPatternLayout14.properties index cbb8b694db..a4163e8524 100644 --- a/tests/input/pattern/enhancedPatternLayout14.properties +++ b/tests/input/pattern/enhancedPatternLayout14.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%-5p [%t] %c{1.}: %m%n diff --git a/tests/input/pattern/enhancedPatternLayout15.properties b/tests/input/pattern/enhancedPatternLayout15.properties index fc98586dde..73ba63ad19 100644 --- a/tests/input/pattern/enhancedPatternLayout15.properties +++ b/tests/input/pattern/enhancedPatternLayout15.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedMyPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%5p %-4# - %m%n diff --git a/tests/input/pattern/enhancedPatternLayout2.properties b/tests/input/pattern/enhancedPatternLayout2.properties index 5858647d4e..384a2e629f 100644 --- a/tests/input/pattern/enhancedPatternLayout2.properties +++ b/tests/input/pattern/enhancedPatternLayout2.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append= false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %.16c - %m%n diff --git a/tests/input/pattern/enhancedPatternLayout3.properties b/tests/input/pattern/enhancedPatternLayout3.properties index 72b3ab176e..c604c1839d 100644 --- a/tests/input/pattern/enhancedPatternLayout3.properties +++ b/tests/input/pattern/enhancedPatternLayout3.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] %-5p %.16c - %m%n diff --git a/tests/input/pattern/enhancedPatternLayout4.properties b/tests/input/pattern/enhancedPatternLayout4.properties index 0438cc9409..a59dac21d1 100644 --- a/tests/input/pattern/enhancedPatternLayout4.properties +++ b/tests/input/pattern/enhancedPatternLayout4.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%d{DATE} [%t] %-5p %.16c - %m%n diff --git a/tests/input/pattern/enhancedPatternLayout5.properties b/tests/input/pattern/enhancedPatternLayout5.properties index 24f30e4eca..fc07143fa4 100644 --- a/tests/input/pattern/enhancedPatternLayout5.properties +++ b/tests/input/pattern/enhancedPatternLayout5.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} [%t] %-5p %.16c - %m%n diff --git a/tests/input/pattern/enhancedPatternLayout6.properties b/tests/input/pattern/enhancedPatternLayout6.properties index 8284edd3de..252ff730dc 100644 --- a/tests/input/pattern/enhancedPatternLayout6.properties +++ b/tests/input/pattern/enhancedPatternLayout6.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%d{ABSOLUTE} [%t] %-5p %.16c - %m%n diff --git a/tests/input/pattern/enhancedPatternLayout7.properties b/tests/input/pattern/enhancedPatternLayout7.properties index eed2a34385..8839f7941f 100644 --- a/tests/input/pattern/enhancedPatternLayout7.properties +++ b/tests/input/pattern/enhancedPatternLayout7.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%t] %-5p %.16c - %m%n diff --git a/tests/input/pattern/enhancedPatternLayout8.properties b/tests/input/pattern/enhancedPatternLayout8.properties index 22a8eaf718..66c64eee8b 100644 --- a/tests/input/pattern/enhancedPatternLayout8.properties +++ b/tests/input/pattern/enhancedPatternLayout8.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%r [%t] %-5p %.16c - %m%n diff --git a/tests/input/pattern/enhancedPatternLayout9.properties b/tests/input/pattern/enhancedPatternLayout9.properties index 705d62c0f3..538f0f5dc2 100644 --- a/tests/input/pattern/enhancedPatternLayout9.properties +++ b/tests/input/pattern/enhancedPatternLayout9.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.EnhancedPatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %.16c : %m%n diff --git a/tests/input/patternLayout.mdc.1.properties b/tests/input/patternLayout.mdc.1.properties index d3a5439b2e..dcc50ba62b 100644 --- a/tests/input/patternLayout.mdc.1.properties +++ b/tests/input/patternLayout.mdc.1.properties @@ -14,7 +14,7 @@ # limitations under the License. log4j.rootCategory=DEBUG, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout log4j.appender.testAppender.layout.ConversionPattern=%-5p - %m %X%n diff --git a/tests/input/patternLayout1.properties b/tests/input/patternLayout1.properties index 634c19542e..80dd82d9f4 100644 --- a/tests/input/patternLayout1.properties +++ b/tests/input/patternLayout1.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.testAppender.layout.ConversionPattern=%-5p - %m%n \ No newline at end of file +log4j.appender.testAppender.layout.ConversionPattern=%-5p - %m%n diff --git a/tests/input/patternLayout10.properties b/tests/input/patternLayout10.properties index 117969d39f..882c980859 100644 --- a/tests/input/patternLayout10.properties +++ b/tests/input/patternLayout10.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File= output/temp +log4j.appender.testAppender.File= output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append= false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %l: %m%n \ No newline at end of file +log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %l: %m%n diff --git a/tests/input/patternLayout11.properties b/tests/input/patternLayout11.properties index a94325a998..333d2f2a2c 100644 --- a/tests/input/patternLayout11.properties +++ b/tests/input/patternLayout11.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.testAppender.layout.ConversionPattern=%-5p [%t] %c{2}: %m%n \ No newline at end of file +log4j.appender.testAppender.layout.ConversionPattern=%-5p [%t] %c{2}: %m%n diff --git a/tests/input/patternLayout12.properties b/tests/input/patternLayout12.properties index bc0f3f0f05..72aa0702d6 100644 --- a/tests/input/patternLayout12.properties +++ b/tests/input/patternLayout12.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %C.%M(%F:%L): %m%n \ No newline at end of file +log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %C.%M(%F:%L): %m%n diff --git a/tests/input/patternLayout13.properties b/tests/input/patternLayout13.properties index b965dfb36c..6f69eac672 100644 --- a/tests/input/patternLayout13.properties +++ b/tests/input/patternLayout13.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File= output/temp +log4j.appender.testAppender.File= output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %C{3}.%M(%F:%L): %m%n \ No newline at end of file +log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %C{3}.%M(%F:%L): %m%n diff --git a/tests/input/patternLayout14.properties b/tests/input/patternLayout14.properties index f0cf51fb9b..77a94784db 100644 --- a/tests/input/patternLayout14.properties +++ b/tests/input/patternLayout14.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File= output/temp +log4j.appender.testAppender.File= output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.MyPatternLayout log4j.appender.testAppender.layout.ConversionPattern=%5p %-4# - %m%n diff --git a/tests/input/patternLayout2.properties b/tests/input/patternLayout2.properties index 951ca9513a..16c15a6890 100644 --- a/tests/input/patternLayout2.properties +++ b/tests/input/patternLayout2.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append= false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout log4j.appender.testAppender.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %.16c - %m%n diff --git a/tests/input/patternLayout3.properties b/tests/input/patternLayout3.properties index e9846c79f9..ff94089571 100644 --- a/tests/input/patternLayout3.properties +++ b/tests/input/patternLayout3.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.testAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] %-5p %.16c - %m%n \ No newline at end of file +log4j.appender.testAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] %-5p %.16c - %m%n diff --git a/tests/input/patternLayout4.properties b/tests/input/patternLayout4.properties index 6a2e442146..1ff61081a8 100644 --- a/tests/input/patternLayout4.properties +++ b/tests/input/patternLayout4.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.testAppender.layout.ConversionPattern=%d{DATE} [%t] %-5p %.16c - %m%n \ No newline at end of file +log4j.appender.testAppender.layout.ConversionPattern=%d{DATE} [%t] %-5p %.16c - %m%n diff --git a/tests/input/patternLayout5.properties b/tests/input/patternLayout5.properties index 1acfaf8320..ed9c98f06d 100644 --- a/tests/input/patternLayout5.properties +++ b/tests/input/patternLayout5.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.testAppender.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} [%t] %-5p %.16c - %m%n \ No newline at end of file +log4j.appender.testAppender.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} [%t] %-5p %.16c - %m%n diff --git a/tests/input/patternLayout6.properties b/tests/input/patternLayout6.properties index 2eb6dabc4d..f49d837ee1 100644 --- a/tests/input/patternLayout6.properties +++ b/tests/input/patternLayout6.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.testAppender.layout.ConversionPattern=%d{ABSOLUTE} [%t] %-5p %.16c - %m%n \ No newline at end of file +log4j.appender.testAppender.layout.ConversionPattern=%d{ABSOLUTE} [%t] %-5p %.16c - %m%n diff --git a/tests/input/patternLayout7.properties b/tests/input/patternLayout7.properties index 921d5520b8..65d412d1c0 100644 --- a/tests/input/patternLayout7.properties +++ b/tests/input/patternLayout7.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout log4j.appender.testAppender.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%t] %-5p %.16c - %m%n diff --git a/tests/input/patternLayout8.properties b/tests/input/patternLayout8.properties index bf56fab098..e271bd31f7 100644 --- a/tests/input/patternLayout8.properties +++ b/tests/input/patternLayout8.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.testAppender.layout.ConversionPattern=%r [%t] %-5p %.16c - %m%n \ No newline at end of file +log4j.appender.testAppender.layout.ConversionPattern=%r [%t] %-5p %.16c - %m%n diff --git a/tests/input/patternLayout9.properties b/tests/input/patternLayout9.properties index aa468785f5..4323f1f2a7 100644 --- a/tests/input/patternLayout9.properties +++ b/tests/input/patternLayout9.properties @@ -15,7 +15,7 @@ log4j.rootCategory=TRACE, testAppender log4j.appender.testAppender=org.apache.log4j.FileAppender -log4j.appender.testAppender.File=output/temp +log4j.appender.testAppender.File=output/temp.PatternLayoutTestCase log4j.appender.testAppender.Append=false log4j.appender.testAppender.layout=org.apache.log4j.PatternLayout -log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %.16c : %m%n \ No newline at end of file +log4j.appender.testAppender.layout.ConversionPattern=[%t] %-5p %.16c : %m%n diff --git a/tests/input/socketServer1.properties b/tests/input/socketServer1.properties deleted file mode 100644 index 573524b6f9..0000000000 --- a/tests/input/socketServer1.properties +++ /dev/null @@ -1,23 +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. -log4j.rootLogger=TRACE, A -log4j.logger.org.apache.log4j.test.ShortSocketServer=WARN -log4j.logger.org.apache.log4j.net.SocketNode=WARN -log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.file=output/temp -log4j.appender.A.Append=false -log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%5p %x [%t] %c %m%n - diff --git a/tests/input/socketServer2.properties b/tests/input/socketServer2.properties deleted file mode 100644 index aafd7afba5..0000000000 --- a/tests/input/socketServer2.properties +++ /dev/null @@ -1,23 +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. -log4j.rootLogger=TRACE, A -log4j.logger.org.apache.log4j.test.ShortSocketServer=WARN -log4j.logger.org.apache.log4j.net.SocketNode=WARN -log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.file=output/temp -log4j.appender.A.Append=false -log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%5p %x [%t] %C (%F:%L) %m%n - diff --git a/tests/input/socketServer3.properties b/tests/input/socketServer3.properties deleted file mode 100644 index 7ddb85c6f1..0000000000 --- a/tests/input/socketServer3.properties +++ /dev/null @@ -1,22 +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. -log4j.rootLogger=TRACE, A -log4j.Logger.org.apache.log4j.test.ShortSocketServer=WARN -log4j.Logger.org.apache.log4j.net.SocketNode=WARN -log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.file=output/temp -log4j.appender.A.Append=false -log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%5p %x [%t] %C (%F:%L) %m%n diff --git a/tests/input/socketServer4.properties b/tests/input/socketServer4.properties deleted file mode 100644 index c00fd65b27..0000000000 --- a/tests/input/socketServer4.properties +++ /dev/null @@ -1,22 +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. -log4j.rootLogger=TRACE, A -log4j.Logger.org.apache.log4j.test.ShortSocketServer=WARN -log4j.Logger.org.apache.log4j.net.SocketNode=WARN -log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.file=output/temp -log4j.appender.A.Append=false -log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%5p %x %X{key1}%X{key4} [%t] %c{1} - %m%n diff --git a/tests/input/socketServer5.properties b/tests/input/socketServer5.properties deleted file mode 100644 index d2d03ce8b6..0000000000 --- a/tests/input/socketServer5.properties +++ /dev/null @@ -1,22 +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. -log4j.rootLogger=TRACE, A -log4j.Logger.org.apache.log4j.test.ShortSocketServer=WARN -log4j.Logger.org.apache.log4j.net.SocketNode=WARN -log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.file=output/temp -log4j.appender.A.Append=false -log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%5p %x %X{key1}%X{key5} [%t] %c{1} - %m%n diff --git a/tests/input/socketServer6.properties b/tests/input/socketServer6.properties deleted file mode 100644 index 19a817c40c..0000000000 --- a/tests/input/socketServer6.properties +++ /dev/null @@ -1,22 +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. -log4j.rootLogger=TRACE, A -log4j.Logger.org.apache.log4j.test.ShortSocketServer=WARN -log4j.Logger.org.apache.log4j.net.SocketNode=WARN -log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.file=output/temp -log4j.appender.A.Append=false -log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%5p %x %X{hostID} %X{key6} [%t] %c{1} - %m%n diff --git a/tests/input/socketServer7.properties b/tests/input/socketServer7.properties deleted file mode 100644 index 742eceb479..0000000000 --- a/tests/input/socketServer7.properties +++ /dev/null @@ -1,22 +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. -log4j.rootLogger=TRACE, A -log4j.Logger.org.apache.log4j.test.ShortSocketServer=WARN -log4j.Logger.org.apache.log4j.net.SocketNode=WARN -log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.file=output/temp -log4j.appender.A.Append=false -log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%5p %x %X{hostID} %X{key7} [%t] %c{1} - %m%n diff --git a/tests/input/socketServer8.properties b/tests/input/socketServer8.properties deleted file mode 100644 index fa31a08422..0000000000 --- a/tests/input/socketServer8.properties +++ /dev/null @@ -1,22 +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. -log4j.rootLogger=TRACE, A -log4j.Logger.org.apache.log4j.test.ShortSocketServer=WARN -log4j.Logger.org.apache.log4j.net.SocketNode=WARN -log4j.appender.A=org.apache.log4j.FileAppender -log4j.appender.A.file=output/temp -log4j.appender.A.Append=false -log4j.appender.A.layout=org.apache.log4j.PatternLayout -log4j.appender.A.layout.ConversionPattern=%5p %x %X{hostID} %X{key8} [%t] %c{1} - %m%n diff --git a/tests/input/xml/DOMTest4_A1.xml b/tests/input/xml/DOMTest4_A1.xml index 9b945e60aa..d63c853714 100644 --- a/tests/input/xml/DOMTest4_A1.xml +++ b/tests/input/xml/DOMTest4_A1.xml @@ -16,7 +16,7 @@ --> - + diff --git a/tests/input/xml/DOMTest4_A2.xml b/tests/input/xml/DOMTest4_A2.xml index e5e26c0248..6c9c932162 100644 --- a/tests/input/xml/DOMTest4_A2.xml +++ b/tests/input/xml/DOMTest4_A2.xml @@ -15,7 +15,7 @@ limitations under the License. --> - + diff --git a/tests/input/xml/DOMTestCase1.xml b/tests/input/xml/DOMTestCase1.xml index fcd1a7ca59..e2c00f1639 100644 --- a/tests/input/xml/DOMTestCase1.xml +++ b/tests/input/xml/DOMTestCase1.xml @@ -20,7 +20,7 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/tests/input/xml/customLevel1.xml b/tests/input/xml/customLevel1.xml index 5c798d2229..752840bbd9 100644 --- a/tests/input/xml/customLevel1.xml +++ b/tests/input/xml/customLevel1.xml @@ -21,7 +21,7 @@ - + @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/tests/input/xml/customLevel2.xml b/tests/input/xml/customLevel2.xml index fdc0be1274..361c4520d7 100644 --- a/tests/input/xml/customLevel2.xml +++ b/tests/input/xml/customLevel2.xml @@ -22,7 +22,7 @@ - + @@ -39,4 +39,4 @@ - \ No newline at end of file + diff --git a/tests/input/xml/customLevel3.xml b/tests/input/xml/customLevel3.xml index 8e4b626856..e08fec8f0c 100644 --- a/tests/input/xml/customLevel3.xml +++ b/tests/input/xml/customLevel3.xml @@ -22,7 +22,7 @@ - + @@ -42,4 +42,4 @@ - \ No newline at end of file + diff --git a/tests/input/xml/customLevel4.xml b/tests/input/xml/customLevel4.xml index 0ae0b75335..f9cb031d66 100644 --- a/tests/input/xml/customLevel4.xml +++ b/tests/input/xml/customLevel4.xml @@ -22,7 +22,7 @@ - + @@ -33,4 +33,4 @@ - \ No newline at end of file + diff --git a/tests/input/xml/fallback1.xml b/tests/input/xml/fallback1.xml index 5eb42c4f61..2590e79a97 100644 --- a/tests/input/xml/fallback1.xml +++ b/tests/input/xml/fallback1.xml @@ -35,7 +35,7 @@ - + diff --git a/tests/input/xml/smtpAppender2.xml b/tests/input/xml/smtpAppender2.xml new file mode 100644 index 0000000000..f4466d0dc1 --- /dev/null +++ b/tests/input/xml/smtpAppender2.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/input/xml/smtpAppender3.xml b/tests/input/xml/smtpAppender3.xml new file mode 100644 index 0000000000..059428aa79 --- /dev/null +++ b/tests/input/xml/smtpAppender3.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/run-tests.bat b/tests/run-tests.bat deleted file mode 100755 index 11d463dab6..0000000000 --- a/tests/run-tests.bat +++ /dev/null @@ -1,111 +0,0 @@ -rem Licensed to the Apache Software Foundation (ASF) under one or more -rem contributor license agreements. See the NOTICE file distributed with -rem this work for additional information regarding copyright ownership. -rem The ASF licenses this file to You under the Apache License, Version 2.0 -rem (the "License"); you may not use this file except in compliance with -rem the License. You may obtain a copy of the License at -rem -rem http://www.apache.org/licenses/LICENSE-2.0 -rem -rem Unless required by applicable law or agreed to in writing, software -rem distributed under the License is distributed on an "AS IS" BASIS, -rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -rem See the License for the specific language governing permissions and -rem limitations under the License. -rem Batch file for running tests on JDK 1.1 -rem -SET CLASSPATH=\java\junit3.8.1\junit.jar;\java\crimson-1.1.3\crimson.jar;\java\jakarta-oro-2.0.8\jakarta-oro-2.0.8.jar;target\classes;..\..\target\classes;resources;%log4j.jar% -mkdir target -mkdir target\classes -cd src\java -javac -d ..\..\target\classes org\apache\log4j\util\SerializationTestHelper.java -javac -d ..\..\target\classes org\apache\log4j\spi\LoggingEventTest.java -javac -d ..\..\target\classes org\apache\log4j\LevelTest.java -javac -d ..\..\target\classes org\apache\log4j\FileAppenderTest.java -javac -d ..\..\target\classes org\apache\log4j\PriorityTest.java -javac -d ..\..\target\classes org\apache\log4j\CategoryTest.java -javac -d ..\..\target\classes org\apache\log4j\LogManagerTest.java -javac -d ..\..\target\classes org\apache\log4j\helpers\LogLogTest.java -javac -d ..\..\target\classes org\apache\log4j\LayoutTest.java -javac -d ..\..\target\classes org\apache\log4j\helpers\DateLayoutTest.java -javac -d ..\..\target\classes org\apache\log4j\TTCCLayoutTest.java -javac -d ..\..\target\classes org\apache\log4j\xml\XMLLayoutTest.java -javac -d ..\..\target\classes org\apache\log4j\HTMLLayoutTest.java -javac -d ..\..\target\classes org\apache\log4j\PatternLayoutTest.java -javac -d ..\..\target\classes org\apache\log4j\spi\ThrowableInformationTest.java -javac -d ..\..\target\classes org\apache\log4j\spi\LocationInfoTest.java -javac -d ..\..\target\classes org\apache\log4j\PropertyConfiguratorTest.java -javac -d ..\..\target\classes org\apache\log4j\CoreTestSuite.java -javac -d ..\..\target\classes org\apache\log4j\util\UnexpectedFormatException.java -javac -d ..\..\target\classes org\apache\log4j\util\Filter.java -javac -d ..\..\target\classes org\apache\log4j\util\Compare.java -javac -d ..\..\target\classes org\apache\log4j\util\ControlFilter.java -javac -d ..\..\target\classes org\apache\log4j\util\Transformer.java -javac -d ..\..\target\classes org\apache\log4j\util\LineNumberFilter.java -javac -d ..\..\target\classes org\apache\log4j\util\AbsoluteDateAndTimeFilter.java -javac -d ..\..\target\classes org\apache\log4j\MinimumTestCase.java -javac -d ..\..\target\classes org\apache\log4j\VectorAppender.java -javac -d ..\..\target\classes org\apache\log4j\LoggerTestCase.java -javac -d ..\..\target\classes org\apache\log4j\util\ISO8601Filter.java -javac -d ..\..\target\classes org\apache\log4j\util\SunReflectFilter.java -javac -d ..\..\target\classes org\apache\log4j\util\JunitTestRunnerFilter.java -javac -d ..\..\target\classes org\apache\log4j\xml\DOMTestCase.java -javac -d ..\..\target\classes org\apache\log4j\xml\XLevel.java -javac -d ..\..\target\classes org\apache\log4j\xml\CustomLevelTestCase.java -javac -d ..\..\target\classes org\apache\log4j\customLogger\XLogger.java -javac -d ..\..\target\classes org\apache\log4j\customLogger\XLoggerTestCase.java -javac -d ..\..\target\classes org\apache\log4j\defaultInit\TestCase1.java -javac -d ..\..\target\classes org\apache\log4j\defaultInit\TestCase3.java -javac -d ..\..\target\classes org\apache\log4j\defaultInit\TestCase4.java -javac -d ..\..\target\classes org\apache\log4j\util\XMLTimestampFilter.java -javac -d ..\..\target\classes org\apache\log4j\util\XMLLineAttributeFilter.java -javac -d ..\..\target\classes org\apache\log4j\xml\XMLLayoutTestCase.java -javac -d ..\..\target\classes org\apache\log4j\AsyncAppenderTestCase.java -javac -d ..\..\target\classes org\apache\log4j\helpers\OptionConverterTestCase.java -javac -d ..\..\target\classes org\apache\log4j\helpers\BoundedFIFOTestCase.java -javac -d ..\..\target\classes org\apache\log4j\helpers\CyclicBufferTestCase.java -javac -d ..\..\target\classes org\apache\log4j\or\ORTestCase.java -javac -d ..\..\target\classes org\apache\log4j\varia\LevelMatchFilterTestCase.java -javac -d ..\..\target\classes org\apache\log4j\helpers\PatternParserTestCase.java -javac -d ..\..\target\classes org\apache\log4j\util\AbsoluteTimeFilter.java -javac -d ..\..\target\classes org\apache\log4j\util\RelativeTimeFilter.java -javac -d ..\..\target\classes org\apache\log4j\PatternLayoutTestCase.java -javac -d ..\..\target\classes org\apache\log4j\MyPatternParser.java -javac -d ..\..\target\classes org\apache\log4j\MyPatternLayout.java -javac -d ..\..\target\classes org\apache\log4j\VectorErrorHandler.java -javac -d ..\..\target\classes org\apache\log4j\DRFATestCase.java -cd ..\.. -mkdir output -java junit.textui.TestRunner org.apache.log4j.CoreTestSuite -java junit.textui.TestRunner org.apache.log4j.MinimumTestCase -java junit.textui.TestRunner org.apache.log4j.LoggerTestCase -java junit.textui.TestRunner org.apache.log4j.xml.DOMTestCase -java junit.textui.TestRunner org.apache.log4j.xml.CustomLevelTestCase -java junit.textui.TestRunner org.apache.log4j.customLogger.XLoggerTestCase -del target\classes\log4j.xml -del target\classes\log4j.properties -java junit.textui.TestRunner org.apache.log4j.defaultInit.TestCase1 -copy input\xml\defaultInit.xml target\classes\log4j.xml -java junit.textui.TestRunner org.apache.log4j.defaultInit.TestCase2 -del target\classes\log4j.xml -copy input\xml\defaultInit.xml target\classes\log4j.xml -java -Dlog4j.defaultInitOverride=true junit.textui.TestRunner org.apache.log4j.defaultInit.TestCase1 -del target\classes\log4j.xml -copy input\defaultInit3.properties target\classes\log4j.properties -java junit.textui.TestRunner org.apache.log4j.defaultInit.TestCase3 -del target\classes\log4j.properties -copy input\xml\defaultInit.xml target\classes\log4j.xml -copy input\defaultInit3.properties target\classes\log4j.properties -java junit.textui.TestRunner org.apache.log4j.defaultInit.TestCase4 -del target\classes\log4j.xml -del target\classes\log4j.properties -java junit.textui.TestRunner org.apache.log4j.xml.XMLLayoutTestCase -java junit.textui.TestRunner org.apache.log4j.AsyncAppenderTestCase -java junit.textui.TestRunner org.apache.log4j.helpers.OptionConverterTestCase -java junit.textui.TestRunner org.apache.log4j.helpers.BoundedFIFOTestCase -java junit.textui.TestRunner org.apache.log4j.helpers.CyclicBufferTestCase -java junit.textui.TestRunner org.apache.log4j.or.ORTestCase -java junit.textui.TestRunner org.apache.log4j.varia.LevelMatchFilterTestCase -java junit.textui.TestRunner org.apache.log4j.helpers.PatternParserTestCase -java junit.textui.TestRunner org.apache.log4j.PatternLayoutTestCase -java junit.textui.TestRunner org.apache.log4j.DRFATestCase diff --git a/tests/src/java/org/apache/log4j/DRFATestCase.java b/tests/src/java/org/apache/log4j/DRFATestCase.java index 8d0417422f..76782c750e 100644 --- a/tests/src/java/org/apache/log4j/DRFATestCase.java +++ b/tests/src/java/org/apache/log4j/DRFATestCase.java @@ -415,6 +415,7 @@ public void testMinuteRollover() throws IOException, InterruptedException { cal.set(Calendar.MILLISECOND, 0); cal.add(Calendar.MINUTE, 1); long until = cal.getTime().getTime(); + System.out.println("Sleep until three seconds into next minute..."); Thread.sleep(until - now); root.info("Hello, World"); assertTrue(firstFile.exists()); @@ -472,6 +473,7 @@ public void testBlockedRollover() throws IOException, InterruptedException { // // sleep until three seconds into next minute // + System.out.println("Sleep until three seconds into next minute..."); Thread.sleep(63000 - (start.getTime() % 60000)); // // should trigger failed rollover diff --git a/tests/src/java/org/apache/log4j/EnhancedPatternLayoutTestCase.java b/tests/src/java/org/apache/log4j/EnhancedPatternLayoutTestCase.java index e97c42f737..8e5bb6c367 100644 --- a/tests/src/java/org/apache/log4j/EnhancedPatternLayoutTestCase.java +++ b/tests/src/java/org/apache/log4j/EnhancedPatternLayoutTestCase.java @@ -28,6 +28,7 @@ import org.apache.log4j.util.EnhancedLineNumberFilter; import org.apache.log4j.util.RelativeTimeFilter; import org.apache.log4j.util.SunReflectFilter; +import org.apache.log4j.util.TestFile; import org.apache.log4j.util.Transformer; import org.apache.log4j.MDCOrderFilter; import org.apache.log4j.spi.ThrowableInformation; @@ -40,8 +41,8 @@ public class EnhancedPatternLayoutTestCase extends TestCase { - static String TEMP = "output/temp"; - static String FILTERED = "output/filtered"; + static String TEMP = TestFile.temp(EnhancedPatternLayoutTestCase.class); + static String FILTERED = TestFile.filtered(EnhancedPatternLayoutTestCase.class); static String EXCEPTION1 = "java.lang.Exception: Just testing"; static String EXCEPTION2 = "\\s*at .*\\(.*\\)"; static String EXCEPTION3 = "\\s*at .*\\((Native Method|Unknown Source)\\)"; diff --git a/tests/src/java/org/apache/log4j/HierarchyThresholdTestCase.java b/tests/src/java/org/apache/log4j/HierarchyThresholdTestCase.java index 3e885bde4f..b9d67f8bec 100644 --- a/tests/src/java/org/apache/log4j/HierarchyThresholdTestCase.java +++ b/tests/src/java/org/apache/log4j/HierarchyThresholdTestCase.java @@ -22,6 +22,7 @@ import junit.framework.Test; import org.apache.log4j.util.Compare; +import org.apache.log4j.util.TestFile; import org.apache.log4j.xml.XLevel; /** @@ -31,7 +32,7 @@ */ public class HierarchyThresholdTestCase extends TestCase { - static String TEMP = "output/temp"; + static String TEMP = TestFile.temp(HierarchyThresholdTestCase.class); static Logger logger = Logger.getLogger(HierarchyThresholdTestCase.class); public HierarchyThresholdTestCase(String name) { diff --git a/tests/src/java/org/apache/log4j/MDCTestCase.java b/tests/src/java/org/apache/log4j/MDCTestCase.java index 245c131158..7bbcc92a75 100644 --- a/tests/src/java/org/apache/log4j/MDCTestCase.java +++ b/tests/src/java/org/apache/log4j/MDCTestCase.java @@ -46,7 +46,15 @@ public void testRemoveLastKey() throws Exception { MDC.put("key", "some value"); MDC.remove("key"); - checkThreadLocalsForLeaks(); + try { + checkThreadLocalsForLeaks(); + } catch (Exception e) { + if (e.getClass().getName().endsWith("InaccessibleObjectException")) { + System.out.println("Ignoring modern JDK reflection error: " + e.getMessage()); + } else { + throw e; + } + } } private void checkThreadLocalsForLeaks() throws Exception { diff --git a/tests/src/java/org/apache/log4j/MinimumTestCase.java b/tests/src/java/org/apache/log4j/MinimumTestCase.java index 50d1503f7b..f2a2085eff 100644 --- a/tests/src/java/org/apache/log4j/MinimumTestCase.java +++ b/tests/src/java/org/apache/log4j/MinimumTestCase.java @@ -29,7 +29,7 @@ */ public class MinimumTestCase extends TestCase { - static String FILTERED = "output/filtered"; + static String FILTERED = TestFile.filtered(MinimumTestCase.class); static String EXCEPTION1 = "java.lang.Exception: Just testing"; static String EXCEPTION2 = "\\s*at .*\\(.*\\)"; diff --git a/tests/src/java/org/apache/log4j/PatternLayoutTestCase.java b/tests/src/java/org/apache/log4j/PatternLayoutTestCase.java index 9578523097..1421a7943e 100644 --- a/tests/src/java/org/apache/log4j/PatternLayoutTestCase.java +++ b/tests/src/java/org/apache/log4j/PatternLayoutTestCase.java @@ -28,12 +28,13 @@ import org.apache.log4j.util.LineNumberFilter; import org.apache.log4j.util.RelativeTimeFilter; import org.apache.log4j.util.SunReflectFilter; +import org.apache.log4j.util.TestFile; import org.apache.log4j.util.Transformer; public class PatternLayoutTestCase extends TestCase { - static String TEMP = "output/temp"; - static String FILTERED = "output/filtered"; + static String TEMP = TestFile.temp(PatternLayoutTestCase.class); + static String FILTERED = TestFile.filtered(PatternLayoutTestCase.class); Logger root; Logger logger; diff --git a/tests/src/java/org/apache/log4j/customLogger/XLoggerTestCase.java b/tests/src/java/org/apache/log4j/customLogger/XLoggerTestCase.java index ac05b765ca..eb26fdbeac 100644 --- a/tests/src/java/org/apache/log4j/customLogger/XLoggerTestCase.java +++ b/tests/src/java/org/apache/log4j/customLogger/XLoggerTestCase.java @@ -31,7 +31,7 @@ */ public class XLoggerTestCase extends TestCase { - static String FILTERED = "output/filtered"; + static String FILTERED = TestFile.filtered(XLoggerTestCase.class); static XLogger logger = (XLogger) XLogger.getLogger(XLoggerTestCase.class); public XLoggerTestCase(String name){ diff --git a/tests/src/java/org/apache/log4j/defaultInit/TestCase2.java b/tests/src/java/org/apache/log4j/defaultInit/TestCase2.java deleted file mode 100644 index c5552b8117..0000000000 --- a/tests/src/java/org/apache/log4j/defaultInit/TestCase2.java +++ /dev/null @@ -1,57 +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.log4j.defaultInit; - -import junit.framework.TestCase; -import junit.framework.TestSuite; -import junit.framework.Test; -import java.util.Enumeration; -import org.apache.log4j.Appender; -import org.apache.log4j.Logger; -import org.apache.log4j.LogManager; - -public class TestCase2 extends TestCase { - - public TestCase2(String name) { - super(name); - } - - public void setUp() { - } - - public void tearDown() { - LogManager.shutdown(); - } - - public void xmlTest() { - Logger root = Logger.getRootLogger(); - boolean rootIsConfigured = root.getAllAppenders().hasMoreElements(); - assertTrue(rootIsConfigured); - Enumeration e = root.getAllAppenders(); - Appender appender = (Appender) e.nextElement(); - assertEquals(appender.getName(), "D1"); - } - - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTest(new TestCase2("xmlTest")); - return suite; - } - -} - diff --git a/tests/src/java/org/apache/log4j/defaultInit/TestCase3.java b/tests/src/java/org/apache/log4j/defaultInit/TestCase3.java deleted file mode 100644 index 661a02633a..0000000000 --- a/tests/src/java/org/apache/log4j/defaultInit/TestCase3.java +++ /dev/null @@ -1,57 +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.log4j.defaultInit; - -import junit.framework.TestCase; -import junit.framework.TestSuite; -import junit.framework.Test; -import java.util.Enumeration; -import org.apache.log4j.Appender; -import org.apache.log4j.Logger; -import org.apache.log4j.LogManager; - -public class TestCase3 extends TestCase { - - public TestCase3(String name) { - super(name); - } - - public void setUp() { - } - - public void tearDown() { - LogManager.shutdown(); - } - - public void propertiesTest() { - Logger root = Logger.getRootLogger(); - boolean rootIsConfigured = root.getAllAppenders().hasMoreElements(); - assertTrue(rootIsConfigured); - Enumeration e = root.getAllAppenders(); - Appender appender = (Appender) e.nextElement(); - assertEquals(appender.getName(), "D3"); - } - - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTest(new TestCase3("propertiesTest")); - return suite; - } - -} - diff --git a/tests/src/java/org/apache/log4j/defaultInit/TestCase4.java b/tests/src/java/org/apache/log4j/defaultInit/TestCase4.java deleted file mode 100644 index aeed8a13ca..0000000000 --- a/tests/src/java/org/apache/log4j/defaultInit/TestCase4.java +++ /dev/null @@ -1,58 +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.log4j.defaultInit; - -import junit.framework.TestCase; -import junit.framework.TestSuite; -import junit.framework.Test; -import java.util.Enumeration; -import org.apache.log4j.Appender; -import org.apache.log4j.Logger; -import org.apache.log4j.LogManager; - -public class TestCase4 extends TestCase { - - public TestCase4(String name) { - super(name); - } - - public void setUp() { - } - - public void tearDown() { - LogManager.shutdown(); - } - - public void combinedTest() { - Logger root = Logger.getRootLogger(); - boolean rootIsConfigured = root.getAllAppenders().hasMoreElements(); - assertTrue(rootIsConfigured); - Enumeration e = root.getAllAppenders(); - Appender appender = (Appender) e.nextElement(); - assertEquals(appender.getName(), "D1"); - assertEquals(e.hasMoreElements(), false); - } - - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTest(new TestCase4("combinedTest")); - return suite; - } - -} - diff --git a/tests/src/java/org/apache/log4j/jdbc/JDBCAppenderTest.java b/tests/src/java/org/apache/log4j/jdbc/JDBCAppenderTest.java new file mode 100644 index 0000000000..6a491e1787 --- /dev/null +++ b/tests/src/java/org/apache/log4j/jdbc/JDBCAppenderTest.java @@ -0,0 +1,30 @@ +package org.apache.log4j.jdbc; + +import junit.framework.TestCase; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; + +public class JDBCAppenderTest extends TestCase { + + public void tearDown() { + LogManager.resetConfiguration(); + } + + public void testActivateOptions() { + new JDBCAppender().activateOptions(); + } + + public void testClose() { + new JDBCAppender().close(); + } + + public void testAppend() { + Logger logger = Logger.getRootLogger(); + logger.addAppender(new JDBCAppender()); + logger.info("Should not be logged by JDBCAppenderTest.testAppend."); + } + + public void testRequiresLayout() { + assertTrue(new JDBCAppender().requiresLayout()); + } +} diff --git a/tests/src/java/org/apache/log4j/net/JMSAppenderTest.java b/tests/src/java/org/apache/log4j/net/JMSAppenderTest.java new file mode 100644 index 0000000000..ca9fb40c23 --- /dev/null +++ b/tests/src/java/org/apache/log4j/net/JMSAppenderTest.java @@ -0,0 +1,30 @@ +package org.apache.log4j.net; + +import junit.framework.TestCase; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; + +public class JMSAppenderTest extends TestCase { + + public void tearDown() { + LogManager.resetConfiguration(); + } + + public void testActivateOptions() { + new JMSAppender().activateOptions(); + } + + public void testClose() { + new JMSAppender().close(); + } + + public void testAppend() { + Logger logger = Logger.getRootLogger(); + logger.addAppender(new JMSAppender()); + logger.info("Should not be logged by JMSAppenderTest.testAppend."); + } + + public void testRequiresLayout() { + assertFalse(new JMSAppender().requiresLayout()); + } +} diff --git a/tests/src/java/org/apache/log4j/net/JMSSinkTest.java b/tests/src/java/org/apache/log4j/net/JMSSinkTest.java new file mode 100644 index 0000000000..38bdc32bef --- /dev/null +++ b/tests/src/java/org/apache/log4j/net/JMSSinkTest.java @@ -0,0 +1,210 @@ +package org.apache.log4j.net; + +import junit.framework.TestCase; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.naming.NamingException; +import java.util.Enumeration; + +public class JMSSinkTest extends TestCase { + + public void testOnMessage() { + JMSSink sink = new JMSSink("ignore", "ignore", "ignore", "ignore"); + Message message = new MockMessage(); + sink.onMessage(message); + } + + public void testLookup() { + try { + JMSSink.lookup(null, "foo"); + fail("Expected NamingException"); + } catch (NamingException e) { + assertNotNull(e); + } + } + + /** @noinspection RedundantThrows*/ + private static class MockMessage implements Message { + public String getJMSMessageID() throws JMSException { + return null; + } + + public void setJMSMessageID(String s) throws JMSException { + + } + + public long getJMSTimestamp() throws JMSException { + return 0; + } + + public void setJMSTimestamp(long l) throws JMSException { + + } + + public byte[] getJMSCorrelationIDAsBytes() throws JMSException { + return new byte[0]; + } + + public void setJMSCorrelationIDAsBytes(byte[] bytes) throws JMSException { + + } + + public void setJMSCorrelationID(String s) throws JMSException { + + } + + public String getJMSCorrelationID() throws JMSException { + return null; + } + + public Destination getJMSReplyTo() throws JMSException { + return null; + } + + public void setJMSReplyTo(Destination destination) throws JMSException { + + } + + public Destination getJMSDestination() throws JMSException { + return null; + } + + public void setJMSDestination(Destination destination) throws JMSException { + + } + + public int getJMSDeliveryMode() throws JMSException { + return 0; + } + + public void setJMSDeliveryMode(int i) throws JMSException { + + } + + public boolean getJMSRedelivered() throws JMSException { + return false; + } + + public void setJMSRedelivered(boolean b) throws JMSException { + + } + + public String getJMSType() throws JMSException { + return null; + } + + public void setJMSType(String s) throws JMSException { + + } + + public long getJMSExpiration() throws JMSException { + return 0; + } + + public void setJMSExpiration(long l) throws JMSException { + + } + + public int getJMSPriority() throws JMSException { + return 0; + } + + public void setJMSPriority(int i) throws JMSException { + + } + + public void clearProperties() throws JMSException { + + } + + public boolean propertyExists(String s) throws JMSException { + return false; + } + + public boolean getBooleanProperty(String s) throws JMSException { + return false; + } + + public byte getByteProperty(String s) throws JMSException { + return 0; + } + + public short getShortProperty(String s) throws JMSException { + return 0; + } + + public int getIntProperty(String s) throws JMSException { + return 0; + } + + public long getLongProperty(String s) throws JMSException { + return 0; + } + + public float getFloatProperty(String s) throws JMSException { + return 0; + } + + public double getDoubleProperty(String s) throws JMSException { + return 0; + } + + public String getStringProperty(String s) throws JMSException { + return null; + } + + public Object getObjectProperty(String s) throws JMSException { + return null; + } + + public Enumeration getPropertyNames() throws JMSException { + return null; + } + + public void setBooleanProperty(String s, boolean b) throws JMSException { + + } + + public void setByteProperty(String s, byte b) throws JMSException { + + } + + public void setShortProperty(String s, short i) throws JMSException { + + } + + public void setIntProperty(String s, int i) throws JMSException { + + } + + public void setLongProperty(String s, long l) throws JMSException { + + } + + public void setFloatProperty(String s, float v) throws JMSException { + + } + + public void setDoubleProperty(String s, double v) throws JMSException { + + } + + public void setStringProperty(String s, String s1) throws JMSException { + + } + + public void setObjectProperty(String s, Object o) throws JMSException { + + } + + public void acknowledge() throws JMSException { + + } + + public void clearBody() throws JMSException { + + } + } +} diff --git a/tests/src/java/org/apache/log4j/net/ShortSocketServer.java b/tests/src/java/org/apache/log4j/net/ShortSocketServer.java deleted file mode 100644 index 78eee86905..0000000000 --- a/tests/src/java/org/apache/log4j/net/ShortSocketServer.java +++ /dev/null @@ -1,85 +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.log4j.net; - -import java.net.Socket; -import java.net.ServerSocket; - -import org.apache.log4j.Logger; -import org.apache.log4j.LogManager; -import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.MDC; -import org.apache.log4j.helpers.LogLog; - -/** - * This SocketServer exits after certain number of connections from a - * client. This number is determined the totalsTest parameter, that is - * the first argument on the commmand line. The second argument, - * prefix, determines the prefix of the configuration file to - * use. Each run of the server will use a different properties - * file. For the i-th run, the path to the file is - * (prefix+i+".properties"). - * - * @author Ceki Gulcu */ - -public class ShortSocketServer { - - static Logger cat = Logger.getLogger(ShortSocketServer.class); - - public - static - void main(String args[]) throws Exception { - int totalTests = 0; - String prefix = null; - - if(args.length == 2) { - totalTests = Integer.parseInt(args[0]); - prefix = args[1]; - } else { - usage("Wrong number of arguments."); - } - - - LogLog.debug("Listening on port " + SocketServerTestCase.PORT); - ServerSocket serverSocket = new ServerSocket(SocketServerTestCase.PORT); - - MDC.put("hostID", "shortSocketServer"); - - for(int i = 1; i <= totalTests; i++) { - PropertyConfigurator.configure(prefix+i+".properties"); - LogLog.debug("Waiting to accept a new client."); - Socket socket = serverSocket.accept(); - LogLog.debug("Connected to client at " + socket.getInetAddress()); - LogLog.debug("Starting new socket node."); - SocketNode sn = new SocketNode(socket, LogManager.getLoggerRepository()); - Thread t = new Thread(sn); - t.start(); - t.join(); - } - } - - - static - void usage(String msg) { - System.err.println(msg); - System.err.println( - "Usage: java " +ShortSocketServer.class.getName() + " totalTests configFilePrefix"); - System.exit(1); - } -} diff --git a/tests/src/java/org/apache/log4j/net/SocketHubAppenderTest.java b/tests/src/java/org/apache/log4j/net/SocketHubAppenderTest.java new file mode 100644 index 0000000000..b96a80a687 --- /dev/null +++ b/tests/src/java/org/apache/log4j/net/SocketHubAppenderTest.java @@ -0,0 +1,30 @@ +package org.apache.log4j.net; + +import junit.framework.TestCase; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; + +public class SocketHubAppenderTest extends TestCase { + + public void tearDown() { + LogManager.resetConfiguration(); + } + + public void testActivateOptions() { + new SocketHubAppender().activateOptions(); + } + + public void testClose() { + new SocketHubAppender().close(); + } + + public void testAppend() { + Logger logger = Logger.getRootLogger(); + logger.addAppender(new SocketHubAppender()); + logger.info("Should not be logged by SocketHubAppenderTest.testAppend."); + } + + public void testRequiresLayout() { + assertFalse(new SocketHubAppender().requiresLayout()); + } +} diff --git a/tests/src/java/org/apache/log4j/net/SocketServerTestCase.java b/tests/src/java/org/apache/log4j/net/SocketServerTestCase.java deleted file mode 100644 index 59194076a3..0000000000 --- a/tests/src/java/org/apache/log4j/net/SocketServerTestCase.java +++ /dev/null @@ -1,408 +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.log4j.net; - -import junit.framework.TestCase; -import junit.framework.TestSuite; -import junit.framework.Test; - -import org.apache.log4j.*; -import org.apache.log4j.util.*; - - -import org.apache.log4j.Logger; -import org.apache.log4j.NDC; -import org.apache.log4j.xml.XLevel; - -/** - @author Ceki Gülcü -*/ -public class SocketServerTestCase extends TestCase { - - static String TEMP = "output/temp"; - static String FILTERED = "output/filtered"; - - // %5p %x [%t] %c %m%n - // DEBUG T1 [main] org.apache.log4j.net.SocketAppenderTestCase Message 1 - static String PAT1 = "^(TRACE|DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T1 \\[main]\\ " - + ".* Message \\d{1,2}"; - - // DEBUG T2 [main] ? (?:?) Message 1 - static String PAT2 = "^(TRACE|DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T2 \\[main]\\ " - + "\\? \\(\\?:\\?\\) Message \\d{1,2}"; - - - // DEBUG T3 [main] org.apache.log4j.net.SocketServerTestCase (SocketServerTestCase.java:121) Message 1 - static String PAT3 = "^(TRACE|DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T3 \\[main]\\ " - + "org.apache.log4j.net.SocketServerTestCase " - + "\\(SocketServerTestCase.java:\\d{3}\\) Message \\d{1,2}"; - - - // DEBUG some T4 MDC-TEST4 [main] SocketAppenderTestCase - Message 1 - // DEBUG some T4 MDC-TEST4 [main] SocketAppenderTestCase - Message 1 - static String PAT4 = "^(TRACE|DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some T4 MDC-TEST4 \\[main]\\" - + " (root|SocketServerTestCase) - Message \\d{1,2}"; - - static String PAT5 = "^(TRACE|DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some5 T5 MDC-TEST5 \\[main]\\" - + " (root|SocketServerTestCase) - Message \\d{1,2}"; - - static String PAT6 = "^(TRACE|DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some6 T6 client-test6 MDC-TEST6" - + " \\[main]\\ (root|SocketServerTestCase) - Message \\d{1,2}"; - - static String PAT7 = "^(TRACE|DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some7 T7 client-test7 MDC-TEST7" - + " \\[main]\\ (root|SocketServerTestCase) - Message \\d{1,2}"; - - // DEBUG some8 T8 shortSocketServer MDC-TEST7 [main] SocketServerTestCase - Message 1 - static String PAT8 = "^(TRACE|DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some8 T8 shortSocketServer" - + " MDC-TEST8 \\[main]\\ (root|SocketServerTestCase) - Message \\d{1,2}"; - - - - static String EXCEPTION1 = "java.lang.Exception: Just testing"; - static String EXCEPTION2 = "\\s*at .*\\(.*\\)"; - static String EXCEPTION3 = "\\s*at .*\\(Native Method\\)"; - static String EXCEPTION4 = "\\s*at .*\\(.*Compiled Code\\)"; - static String EXCEPTION5 = "\\s*at .*\\(.*libgcj.*\\)"; - - - static Logger logger = Logger.getLogger(SocketServerTestCase.class); - static public final int PORT = 12345; - static Logger rootLogger = Logger.getRootLogger(); - SocketAppender socketAppender; - - public SocketServerTestCase(String name) { - super(name); - } - - public void setUp() { - System.out.println("Setting up test case."); - } - - public void tearDown() { - System.out.println("Tearing down test case."); - socketAppender = null; - rootLogger.removeAllAppenders(); - } - - /** - * The pattern on the server side: %5p %x [%t] %c %m%n - * - * We are testing NDC functionality across the wire. - */ - public void test1() throws Exception { - socketAppender = new SocketAppender("localhost", PORT); - rootLogger.addAppender(socketAppender); - common("T1", "key1", "MDC-TEST1"); - delay(1); - ControlFilter cf = new ControlFilter(new String[]{PAT1, EXCEPTION1, - EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5}); - - Transformer.transform( - TEMP, FILTERED, - new Filter[] { cf, new LineNumberFilter(), - new JunitTestRunnerFilter(), - new SunReflectFilter() }); - - assertTrue(Compare.compare(FILTERED, "witness/socketServer.1")); - } - - /** - * The pattern on the server side: %5p %x [%t] %C (%F:%L) %m%n - * - * We are testing NDC across the wire. Localization is turned off by - * default so it is not tested here even if the conversion pattern - * uses localization. */ - public void test2() throws Exception { - socketAppender = new SocketAppender("localhost", PORT); - rootLogger.addAppender(socketAppender); - - common("T2", "key2", "MDC-TEST2"); - delay(1); - ControlFilter cf = new ControlFilter(new String[]{PAT2, EXCEPTION1, - EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5}); - - Transformer.transform( - TEMP, FILTERED, - new Filter[] { cf, new LineNumberFilter(), - new JunitTestRunnerFilter(), - new SunReflectFilter() }); - - assertTrue(Compare.compare(FILTERED, "witness/socketServer.2")); - } - - /** - * The pattern on the server side: %5p %x [%t] %C (%F:%L) %m%n - * meaning that we are testing NDC and locatization functionality - * across the wire. */ - public void test3() throws Exception { - socketAppender = new SocketAppender("localhost", PORT); - socketAppender.setLocationInfo(true); - rootLogger.addAppender(socketAppender); - - common("T3", "key3", "MDC-TEST3"); - delay(1); - ControlFilter cf = new ControlFilter(new String[]{PAT3, EXCEPTION1, - EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5}); - - Transformer.transform( - TEMP, FILTERED, - new Filter[] { cf, new LineNumberFilter(), - new JunitTestRunnerFilter(), - new SunReflectFilter() }); - - assertTrue(Compare.compare(FILTERED, "witness/socketServer.3")); - } - - /** - * The pattern on the server side: %5p %x %X{key1}%X{key4} [%t] %c{1} - %m%n - * meaning that we are testing NDC, MDC and localization functionality across - * the wire. - */ - public void test4() throws Exception { - socketAppender = new SocketAppender("localhost", PORT); - socketAppender.setLocationInfo(true); - rootLogger.addAppender(socketAppender); - - NDC.push("some"); - common("T4", "key4", "MDC-TEST4"); - NDC.pop(); - delay(1); - // - // These tests check MDC operation which - // requires JDK 1.2 or later - if(!System.getProperty("java.version").startsWith("1.1.")) { - - ControlFilter cf = new ControlFilter(new String[]{PAT4, EXCEPTION1, - EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5}); - Transformer.transform( - TEMP, FILTERED, - new Filter[] { cf, new LineNumberFilter(), - new JunitTestRunnerFilter(), - new SunReflectFilter() }); - - assertTrue(Compare.compare(FILTERED, "witness/socketServer.4")); - } - } - - /** - * The pattern on the server side: %5p %x %X{key1}%X{key5} [%t] %c{1} - %m%n - * - * The test case uses wraps an AsyncAppender around the - * SocketAppender. This tests was written specifically for bug - * report #9155. - - * Prior to the bug fix the output on the server did not contain the - * MDC-TEST5 string because the MDC clone operation (in getMDCCopy - * method) operation is performed twice, once from the main thread - * which is correct, and a second time from the AsyncAppender's - * dispatch thread which is incrorrect. - - */ - public void test5() throws Exception { - socketAppender = new SocketAppender("localhost", PORT); - socketAppender.setLocationInfo(true); - AsyncAppender asyncAppender = new AsyncAppender(); - asyncAppender.setLocationInfo(true); - asyncAppender.addAppender(socketAppender); - rootLogger.addAppender(asyncAppender); - - NDC.push("some5"); - common("T5", "key5", "MDC-TEST5"); - NDC.pop(); - delay(2); - // - // These tests check MDC operation which - // requires JDK 1.2 or later - if(!System.getProperty("java.version").startsWith("1.1.")) { - ControlFilter cf = new ControlFilter(new String[]{PAT5, EXCEPTION1, - EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5}); - - Transformer.transform( - TEMP, FILTERED, - new Filter[] { cf, new LineNumberFilter(), - new JunitTestRunnerFilter(), - new SunReflectFilter() }); - - assertTrue(Compare.compare(FILTERED, "witness/socketServer.5")); - } - } - - /** - * The pattern on the server side: %5p %x %X{hostID}${key6} [%t] %c{1} - %m%n - * - * This test checks whether client-side MDC overrides the server side. - * It uses an AsyncAppender encapsulating a SocketAppender - */ - public void test6() throws Exception { - socketAppender = new SocketAppender("localhost", PORT); - socketAppender.setLocationInfo(true); - AsyncAppender asyncAppender = new AsyncAppender(); - asyncAppender.setLocationInfo(true); - asyncAppender.addAppender(socketAppender); - rootLogger.addAppender(asyncAppender); - - NDC.push("some6"); - MDC.put("hostID", "client-test6"); - common("T6", "key6", "MDC-TEST6"); - NDC.pop(); - MDC.remove("hostID"); - delay(2); - // - // These tests check MDC operation which - // requires JDK 1.2 or later - if(!System.getProperty("java.version").startsWith("1.1.")) { - ControlFilter cf = new ControlFilter(new String[]{PAT6, EXCEPTION1, - EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5}); - - Transformer.transform( - TEMP, FILTERED, - new Filter[] { cf, new LineNumberFilter(), - new JunitTestRunnerFilter(), - new SunReflectFilter() }); - - assertTrue(Compare.compare(FILTERED, "witness/socketServer.6")); - } - } - - /** - * The pattern on the server side: %5p %x %X{hostID}${key7} [%t] %c{1} - %m%n - * - * This test checks whether client-side MDC overrides the server side. - */ - public void test7() throws Exception { - socketAppender = new SocketAppender("localhost", PORT); - socketAppender.setLocationInfo(true); - rootLogger.addAppender(socketAppender); - - NDC.push("some7"); - MDC.put("hostID", "client-test7"); - common("T7", "key7", "MDC-TEST7"); - NDC.pop(); - MDC.remove("hostID"); - delay(2); - // - // These tests check MDC operation which - // requires JDK 1.2 or later - if(!System.getProperty("java.version").startsWith("1.1.")) { - ControlFilter cf = new ControlFilter(new String[]{PAT7, EXCEPTION1, - EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5}); - - Transformer.transform( - TEMP, FILTERED, - new Filter[] { cf, new LineNumberFilter(), - new JunitTestRunnerFilter(), - new SunReflectFilter() }); - assertTrue(Compare.compare(FILTERED, "witness/socketServer.7")); - } - } - - /** - * The pattern on the server side: %5p %x %X{hostID} ${key8} [%t] %c{1} - %m%n - * - * This test checks whether server side MDC works. - */ - public void test8() throws Exception { - socketAppender = new SocketAppender("localhost", PORT); - socketAppender.setLocationInfo(true); - rootLogger.addAppender(socketAppender); - - NDC.push("some8"); - - // - // The test has relied on the receiving code to - // combine the sent MDC with the receivers MDC - // (which contains a value for hostID). - // The mechanism of how that happens is not clear - // and it does not work with Apache Harmony. - // Unclear if it is a Harmony issue. - if (System.getProperty("java.vendor").indexOf("Apache") != -1) { - MDC.put("hostID", "shortSocketServer"); - } - - common("T8", "key8", "MDC-TEST8"); - NDC.pop(); - delay(2); - // - // These tests check MDC operation which - // requires JDK 1.2 or later - if(!System.getProperty("java.version").startsWith("1.1.")) { - ControlFilter cf = new ControlFilter(new String[]{PAT8, EXCEPTION1, - EXCEPTION2, EXCEPTION3, EXCEPTION4, EXCEPTION5}); - - Transformer.transform( - TEMP, FILTERED, - new Filter[] { cf, new LineNumberFilter(), - new JunitTestRunnerFilter(), - new SunReflectFilter() }); - assertTrue(Compare.compare(FILTERED, "witness/socketServer.8")); - } - } - - static - void common(String dc, String key, Object o) { - String oldThreadName = Thread.currentThread().getName(); - Thread.currentThread().setName("main"); - - int i = -1; - NDC.push(dc); - MDC.put(key, o); - Logger root = Logger.getRootLogger(); - - logger.setLevel(Level.DEBUG); - rootLogger.setLevel(Level.DEBUG); - - logger.log(XLevel.TRACE, "Message " + ++i); - - logger.setLevel(Level.TRACE); - rootLogger.setLevel(Level.TRACE); - - logger.trace("Message " + ++i); - root.trace("Message " + ++i); - logger.debug("Message " + ++i); - root.debug("Message " + ++i); - logger.info("Message " + ++i); - logger.warn("Message " + ++i); - logger.log(XLevel.LETHAL, "Message " + ++i); //5 - - Exception e = new Exception("Just testing"); - logger.debug("Message " + ++i, e); - root.error("Message " + ++i, e); - NDC.pop(); - MDC.remove(key); - - Thread.currentThread().setName(oldThreadName); - } - - public void delay(int secs) { - try {Thread.sleep(secs*1000);} catch(Exception e) {} - } - - - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTest(new SocketServerTestCase("test1")); - suite.addTest(new SocketServerTestCase("test2")); - suite.addTest(new SocketServerTestCase("test3")); - suite.addTest(new SocketServerTestCase("test4")); - suite.addTest(new SocketServerTestCase("test5")); - suite.addTest(new SocketServerTestCase("test6")); - suite.addTest(new SocketServerTestCase("test7")); - suite.addTest(new SocketServerTestCase("test8")); - return suite; - } -} diff --git a/tests/src/java/org/apache/log4j/net/TelnetAppenderTest.java b/tests/src/java/org/apache/log4j/net/TelnetAppenderTest.java index dfad443c77..46a5748bad 100644 --- a/tests/src/java/org/apache/log4j/net/TelnetAppenderTest.java +++ b/tests/src/java/org/apache/log4j/net/TelnetAppenderTest.java @@ -16,11 +16,6 @@ */ package org.apache.log4j.net; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.Socket; - import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; @@ -29,28 +24,8 @@ public class TelnetAppenderTest extends TestCase { int port = 54353; - ByteArrayOutputStream bo = new ByteArrayOutputStream(); - - public class ReadThread extends Thread { - public void run() { - try { - Socket s = new Socket("localhost", port); - InputStream i = s.getInputStream(); - while (!Thread.interrupted()) { - int c = i.read(); - if (c == -1) - break; - bo.write(c); - } - s.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - public void testIt() throws Exception { - int oldActive = Thread.activeCount(); + public void testIt() { TelnetAppender ta = new TelnetAppender(); ta.setName("ta"); ta.setPort(port); @@ -58,20 +33,7 @@ public void testIt() throws Exception { ta.activateOptions(); Logger l = Logger.getLogger("x"); l.addAppender(ta); - Thread t = new ReadThread(); - t.start(); - Thread.sleep(200); l.info("hi"); - Thread.sleep(1000); - ta.close(); - Thread.sleep(200); - t.interrupt(); - t.join(); - String s = bo.toString(); - assertTrue(s.endsWith("INFO - hi")); - if(System.getProperty("java.vendor").indexOf("Free") == -1) { - assertEquals(oldActive, Thread.activeCount()); - } } } diff --git a/tests/src/java/org/apache/log4j/nt/NTEventLogAppenderTest.java b/tests/src/java/org/apache/log4j/nt/NTEventLogAppenderTest.java index bba8de0602..2d16f74171 100755 --- a/tests/src/java/org/apache/log4j/nt/NTEventLogAppenderTest.java +++ b/tests/src/java/org/apache/log4j/nt/NTEventLogAppenderTest.java @@ -42,6 +42,10 @@ public void tearDown() { * Simple test of NTEventLogAppender. */ public void testSimple() { + if (!System.getProperty("os.name").startsWith("Windows")) { + return; + } + BasicConfigurator.configure(new NTEventLogAppender()); Logger logger = Logger.getLogger("org.apache.log4j.nt.NTEventLogAppenderTest"); int i = 0; diff --git a/tests/src/java/org/apache/log4j/util/LoaderTest.java b/tests/src/java/org/apache/log4j/util/LoaderTest.java new file mode 100644 index 0000000000..81aab74382 --- /dev/null +++ b/tests/src/java/org/apache/log4j/util/LoaderTest.java @@ -0,0 +1,10 @@ +package org.apache.log4j.helpers; + +import junit.framework.TestCase; + +public class LoaderTest extends TestCase { + + public void testIsJava1IsAlwaysFalse() { + assertFalse(Loader.isJava1()); + } +} diff --git a/tests/src/java/org/apache/log4j/util/TestFile.java b/tests/src/java/org/apache/log4j/util/TestFile.java new file mode 100644 index 0000000000..e7dc29a8be --- /dev/null +++ b/tests/src/java/org/apache/log4j/util/TestFile.java @@ -0,0 +1,17 @@ +package org.apache.log4j.util; + +public class TestFile { + public static String byClassName(String baseName, Class testClass) { + String className = testClass.getName(); + className = className.substring(className.lastIndexOf(".")+1); + return baseName + "." + className; + } + + public static String temp(Class testClass) { + return byClassName("output/temp", testClass); + } + + public static String filtered(Class testClass) { + return byClassName("output/filtered", testClass); + } +} diff --git a/tests/src/java/org/apache/log4j/varia/ERFATestCase.java b/tests/src/java/org/apache/log4j/varia/ERFATestCase.java index 31b23ab249..eae6684668 100644 --- a/tests/src/java/org/apache/log4j/varia/ERFATestCase.java +++ b/tests/src/java/org/apache/log4j/varia/ERFATestCase.java @@ -59,30 +59,7 @@ public void testConstructor() { assertEquals(0, appender.getPort()); } - /** - * Send a message to the ERFA. - * @param port port number. - * @param msg message, may not be null. - * @param expectedResponse expected response, may not be null. - * @throws IOException thrown on IO error. - */ - void sendMessage(int port, final String msg, final String expectedResponse) throws IOException { - Socket socket = new Socket((String) null, port); - DataInputStream reader = new DataInputStream(socket.getInputStream()); - DataOutputStream writer = new DataOutputStream(socket.getOutputStream()); - writer.writeUTF(msg); - String response = reader.readUTF(); - assertEquals(expectedResponse, response); - reader.close(); - writer.close(); - socket.close(); - } - - /** - * Test externally triggered rollover. - * @throws IOException thrown on IO error. - */ - public void testRollover() throws IOException { + public void testRolloverDoesNotWork() { ExternallyRolledFileAppender erfa = new ExternallyRolledFileAppender(); @@ -96,46 +73,19 @@ public void testRollover() throws IOException { erfa.setMaxBackupIndex(2); erfa.setPort(port); erfa.setFile("output/ERFA-test2.log"); - try { - erfa.activateOptions(); - } catch(SecurityException ex) { - return; - } - try { - Thread.sleep(100); - } catch(InterruptedException ex) { - } + erfa.activateOptions(); root.addAppender(erfa); - // Write exactly 10 bytes with each log for (int i = 0; i < 55; i++) { if (i < 10) { logger.debug("Hello---" + i); - } else if (i < 100) { + } else { logger.debug("Hello--" + i); } - if ((i % 10) == 9) { - try { - sendMessage(port, "RollOver", "OK"); - } catch(SecurityException ex) { - return; - } - } } - try { - sendMessage(port, - "That's all folks.", - "Expecting [RollOver] string."); - } catch(SecurityException ex) { - return; - } - - assertTrue(new File("output/ERFA-test2.log").exists()); - assertTrue(new File("output/ERFA-test2.log.1").exists()); - assertTrue(new File("output/ERFA-test2.log.2").exists()); - assertFalse(new File("output/ERFA-test2.log.3").exists()); + assertFalse(new File("output/ERFA-test2.log.1").exists()); } } diff --git a/tests/src/java/org/apache/log4j/varia/ErrorHandlerTestCase.java b/tests/src/java/org/apache/log4j/varia/ErrorHandlerTestCase.java index b0001f8730..0000c34b64 100644 --- a/tests/src/java/org/apache/log4j/varia/ErrorHandlerTestCase.java +++ b/tests/src/java/org/apache/log4j/varia/ErrorHandlerTestCase.java @@ -23,6 +23,7 @@ import org.apache.log4j.Logger; import org.apache.log4j.spi.ErrorHandler; import org.apache.log4j.util.Filter; +import org.apache.log4j.util.TestFile; import org.apache.log4j.util.Transformer; import org.apache.log4j.util.Compare; import org.apache.log4j.util.JunitTestRunnerFilter; @@ -34,8 +35,8 @@ public class ErrorHandlerTestCase extends TestCase { - static String TEMP = "output/temp"; - static String FILTERED = "output/filtered"; + static String TEMP = TestFile.temp(ErrorHandlerTestCase.class); + static String FILTERED = TestFile.filtered(ErrorHandlerTestCase.class); static String EXCEPTION1 = "java.lang.Exception: Just testing"; @@ -82,7 +83,7 @@ public void test1() throws Exception { assertTrue(Compare.compare(FILTERED, "witness/fallback1")); } - public void test2() throws Exception { + public void disableFlakeyTest2() throws Exception { // consistent failures on various platforms PropertyConfigurator.configure("input/fallback1.properties"); Appender primary = root.getAppender("PRIMARY"); ErrorHandler eh = primary.getErrorHandler(); diff --git a/tests/src/java/org/apache/log4j/xml/CustomLevelTestCase.java b/tests/src/java/org/apache/log4j/xml/CustomLevelTestCase.java index 52c366ae94..0569e1ca45 100644 --- a/tests/src/java/org/apache/log4j/xml/CustomLevelTestCase.java +++ b/tests/src/java/org/apache/log4j/xml/CustomLevelTestCase.java @@ -22,10 +22,11 @@ import junit.framework.TestSuite; import org.apache.log4j.Logger; import org.apache.log4j.util.Compare; +import org.apache.log4j.util.TestFile; public class CustomLevelTestCase extends TestCase { - static String TEMP = "output/temp"; + static String TEMP = TestFile.temp(CustomLevelTestCase.class); Logger root; Logger logger; diff --git a/tests/src/java/org/apache/log4j/xml/DOMTestCase.java b/tests/src/java/org/apache/log4j/xml/DOMTestCase.java index e664c43996..8b6dd7b2e2 100644 --- a/tests/src/java/org/apache/log4j/xml/DOMTestCase.java +++ b/tests/src/java/org/apache/log4j/xml/DOMTestCase.java @@ -37,6 +37,7 @@ import org.apache.log4j.util.JunitTestRunnerFilter; import org.apache.log4j.util.LineNumberFilter; import org.apache.log4j.util.SunReflectFilter; +import org.apache.log4j.util.TestFile; import org.apache.log4j.util.Transformer; import java.io.File; @@ -50,10 +51,10 @@ public class DOMTestCase extends TestCase { - static String TEMP_A1 = "output/temp.A1"; - static String TEMP_A2 = "output/temp.A2"; - static String FILTERED_A1 = "output/filtered.A1"; - static String FILTERED_A2 = "output/filtered.A2"; + static String TEMP_A1 = TestFile.byClassName("output/temp.A1", DOMTestCase.class); + static String TEMP_A2 = TestFile.byClassName("output/temp.A2", DOMTestCase.class); + static String FILTERED_A1 = TestFile.byClassName("output/filtered.A1", DOMTestCase.class); + static String FILTERED_A2 = TestFile.byClassName("output/filtered.A2", DOMTestCase.class); static String EXCEPTION1 = "java.lang.Exception: Just testing"; @@ -332,8 +333,8 @@ public void testConfigureAndWatch() throws Exception { public void testOverrideSubst() { DOMConfigurator configurator = new DOMConfigurator() { protected String subst(final String value) { - if ("output/temp.A1".equals(value)) { - return "output/subst-test.A1"; + if ("output/temp.A1.DOMTestCase".equals(value)) { + return "output/subst-test.A1.DOMTestCase"; } return value; } @@ -341,7 +342,7 @@ protected String subst(final String value) { configurator.doConfigure("input/xml/DOMTestCase1.xml", LogManager.getLoggerRepository()); FileAppender a1 = (FileAppender) Logger.getRootLogger().getAppender("A1"); String file = a1.getFile(); - assertEquals("output/subst-test.A1", file); + assertEquals("output/subst-test.A1.DOMTestCase", file); } /** diff --git a/tests/src/java/org/apache/log4j/xml/XMLLayoutTestCase.java b/tests/src/java/org/apache/log4j/xml/XMLLayoutTestCase.java index e76acd6b19..78b8c8a2f0 100644 --- a/tests/src/java/org/apache/log4j/xml/XMLLayoutTestCase.java +++ b/tests/src/java/org/apache/log4j/xml/XMLLayoutTestCase.java @@ -29,6 +29,7 @@ import org.apache.log4j.util.JunitTestRunnerFilter; import org.apache.log4j.util.LineNumberFilter; import org.apache.log4j.util.SunReflectFilter; +import org.apache.log4j.util.TestFile; import org.apache.log4j.util.Transformer; import org.apache.log4j.util.XMLLineAttributeFilter; import org.apache.log4j.util.XMLTimestampFilter; @@ -37,8 +38,8 @@ public class XMLLayoutTestCase extends TestCase { - static String TEMP = "output/temp"; - static String FILTERED = "output/filtered"; + static String TEMP = TestFile.temp(XMLLayoutTestCase.class); + static String FILTERED = TestFile.filtered(XMLLayoutTestCase.class); Logger root; Logger logger; diff --git a/tests/witness/socketServer.1 b/tests/witness/socketServer.1 deleted file mode 100644 index 113f262eec..0000000000 --- a/tests/witness/socketServer.1 +++ /dev/null @@ -1,31 +0,0 @@ -TRACE T1 [main] org.apache.log4j.net.SocketServerTestCase Message 1 -TRACE T1 [main] root Message 2 -DEBUG T1 [main] org.apache.log4j.net.SocketServerTestCase Message 3 -DEBUG T1 [main] root Message 4 - INFO T1 [main] org.apache.log4j.net.SocketServerTestCase Message 5 - WARN T1 [main] org.apache.log4j.net.SocketServerTestCase Message 6 -LETHAL T1 [main] org.apache.log4j.net.SocketServerTestCase Message 7 -DEBUG T1 [main] org.apache.log4j.net.SocketServerTestCase Message 8 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test1(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) -ERROR T1 [main] root Message 9 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test1(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) diff --git a/tests/witness/socketServer.2 b/tests/witness/socketServer.2 deleted file mode 100644 index 3ee37c1a51..0000000000 --- a/tests/witness/socketServer.2 +++ /dev/null @@ -1,31 +0,0 @@ -TRACE T2 [main] ? (?:?) Message 1 -TRACE T2 [main] ? (?:?) Message 2 -DEBUG T2 [main] ? (?:?) Message 3 -DEBUG T2 [main] ? (?:?) Message 4 - INFO T2 [main] ? (?:?) Message 5 - WARN T2 [main] ? (?:?) Message 6 -LETHAL T2 [main] ? (?:?) Message 7 -DEBUG T2 [main] ? (?:?) Message 8 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test2(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) -ERROR T2 [main] ? (?:?) Message 9 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test2(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) diff --git a/tests/witness/socketServer.3 b/tests/witness/socketServer.3 deleted file mode 100644 index de184bbd8c..0000000000 --- a/tests/witness/socketServer.3 +++ /dev/null @@ -1,31 +0,0 @@ -TRACE T3 [main] org.apache.log4j.net.SocketServerTestCase (SocketServerTestCase.java:XXX) Message 1 -TRACE T3 [main] org.apache.log4j.net.SocketServerTestCase (SocketServerTestCase.java:XXX) Message 2 -DEBUG T3 [main] org.apache.log4j.net.SocketServerTestCase (SocketServerTestCase.java:XXX) Message 3 -DEBUG T3 [main] org.apache.log4j.net.SocketServerTestCase (SocketServerTestCase.java:XXX) Message 4 - INFO T3 [main] org.apache.log4j.net.SocketServerTestCase (SocketServerTestCase.java:XXX) Message 5 - WARN T3 [main] org.apache.log4j.net.SocketServerTestCase (SocketServerTestCase.java:XXX) Message 6 -LETHAL T3 [main] org.apache.log4j.net.SocketServerTestCase (SocketServerTestCase.java:XXX) Message 7 -DEBUG T3 [main] org.apache.log4j.net.SocketServerTestCase (SocketServerTestCase.java:XXX) Message 8 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test3(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) -ERROR T3 [main] org.apache.log4j.net.SocketServerTestCase (SocketServerTestCase.java:XXX) Message 9 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test3(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) diff --git a/tests/witness/socketServer.4 b/tests/witness/socketServer.4 deleted file mode 100644 index 69236688b4..0000000000 --- a/tests/witness/socketServer.4 +++ /dev/null @@ -1,31 +0,0 @@ -TRACE some T4 MDC-TEST4 [main] SocketServerTestCase - Message 1 -TRACE some T4 MDC-TEST4 [main] root - Message 2 -DEBUG some T4 MDC-TEST4 [main] SocketServerTestCase - Message 3 -DEBUG some T4 MDC-TEST4 [main] root - Message 4 - INFO some T4 MDC-TEST4 [main] SocketServerTestCase - Message 5 - WARN some T4 MDC-TEST4 [main] SocketServerTestCase - Message 6 -LETHAL some T4 MDC-TEST4 [main] SocketServerTestCase - Message 7 -DEBUG some T4 MDC-TEST4 [main] SocketServerTestCase - Message 8 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test4(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) -ERROR some T4 MDC-TEST4 [main] root - Message 9 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test4(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) diff --git a/tests/witness/socketServer.5 b/tests/witness/socketServer.5 deleted file mode 100644 index cde6de7152..0000000000 --- a/tests/witness/socketServer.5 +++ /dev/null @@ -1,31 +0,0 @@ -TRACE some5 T5 MDC-TEST5 [main] SocketServerTestCase - Message 1 -TRACE some5 T5 MDC-TEST5 [main] root - Message 2 -DEBUG some5 T5 MDC-TEST5 [main] SocketServerTestCase - Message 3 -DEBUG some5 T5 MDC-TEST5 [main] root - Message 4 - INFO some5 T5 MDC-TEST5 [main] SocketServerTestCase - Message 5 - WARN some5 T5 MDC-TEST5 [main] SocketServerTestCase - Message 6 -LETHAL some5 T5 MDC-TEST5 [main] SocketServerTestCase - Message 7 -DEBUG some5 T5 MDC-TEST5 [main] SocketServerTestCase - Message 8 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test5(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) -ERROR some5 T5 MDC-TEST5 [main] root - Message 9 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test5(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) diff --git a/tests/witness/socketServer.6 b/tests/witness/socketServer.6 deleted file mode 100644 index ae9a686040..0000000000 --- a/tests/witness/socketServer.6 +++ /dev/null @@ -1,31 +0,0 @@ -TRACE some6 T6 client-test6 MDC-TEST6 [main] SocketServerTestCase - Message 1 -TRACE some6 T6 client-test6 MDC-TEST6 [main] root - Message 2 -DEBUG some6 T6 client-test6 MDC-TEST6 [main] SocketServerTestCase - Message 3 -DEBUG some6 T6 client-test6 MDC-TEST6 [main] root - Message 4 - INFO some6 T6 client-test6 MDC-TEST6 [main] SocketServerTestCase - Message 5 - WARN some6 T6 client-test6 MDC-TEST6 [main] SocketServerTestCase - Message 6 -LETHAL some6 T6 client-test6 MDC-TEST6 [main] SocketServerTestCase - Message 7 -DEBUG some6 T6 client-test6 MDC-TEST6 [main] SocketServerTestCase - Message 8 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test6(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) -ERROR some6 T6 client-test6 MDC-TEST6 [main] root - Message 9 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test6(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) diff --git a/tests/witness/socketServer.7 b/tests/witness/socketServer.7 deleted file mode 100644 index 3ea7428cbd..0000000000 --- a/tests/witness/socketServer.7 +++ /dev/null @@ -1,31 +0,0 @@ -TRACE some7 T7 client-test7 MDC-TEST7 [main] SocketServerTestCase - Message 1 -TRACE some7 T7 client-test7 MDC-TEST7 [main] root - Message 2 -DEBUG some7 T7 client-test7 MDC-TEST7 [main] SocketServerTestCase - Message 3 -DEBUG some7 T7 client-test7 MDC-TEST7 [main] root - Message 4 - INFO some7 T7 client-test7 MDC-TEST7 [main] SocketServerTestCase - Message 5 - WARN some7 T7 client-test7 MDC-TEST7 [main] SocketServerTestCase - Message 6 -LETHAL some7 T7 client-test7 MDC-TEST7 [main] SocketServerTestCase - Message 7 -DEBUG some7 T7 client-test7 MDC-TEST7 [main] SocketServerTestCase - Message 8 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test7(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) -ERROR some7 T7 client-test7 MDC-TEST7 [main] root - Message 9 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test7(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) diff --git a/tests/witness/socketServer.8 b/tests/witness/socketServer.8 deleted file mode 100644 index c317ac7aca..0000000000 --- a/tests/witness/socketServer.8 +++ /dev/null @@ -1,31 +0,0 @@ -TRACE some8 T8 shortSocketServer MDC-TEST8 [main] SocketServerTestCase - Message 1 -TRACE some8 T8 shortSocketServer MDC-TEST8 [main] root - Message 2 -DEBUG some8 T8 shortSocketServer MDC-TEST8 [main] SocketServerTestCase - Message 3 -DEBUG some8 T8 shortSocketServer MDC-TEST8 [main] root - Message 4 - INFO some8 T8 shortSocketServer MDC-TEST8 [main] SocketServerTestCase - Message 5 - WARN some8 T8 shortSocketServer MDC-TEST8 [main] SocketServerTestCase - Message 6 -LETHAL some8 T8 shortSocketServer MDC-TEST8 [main] SocketServerTestCase - Message 7 -DEBUG some8 T8 shortSocketServer MDC-TEST8 [main] SocketServerTestCase - Message 8 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test8(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX) -ERROR some8 T8 shortSocketServer MDC-TEST8 [main] root - Message 9 -java.lang.Exception: Just testing - at org.apache.log4j.net.SocketServerTestCase.common(SocketServerTestCase.java:XXX) - at org.apache.log4j.net.SocketServerTestCase.test8(SocketServerTestCase.java:XXX) - at junit.framework.TestCase.runTest(TestCase.java:XXX) - at junit.framework.TestCase.runBare(TestCase.java:XXX) - at junit.framework.TestResult$1.protect(TestResult.java:XXX) - at junit.framework.TestResult.runProtected(TestResult.java:XXX) - at junit.framework.TestResult.run(TestResult.java:XXX) - at junit.framework.TestCase.run(TestCase.java:XXX) - at junit.framework.TestSuite.runTest(TestSuite.java:XXX) - at junit.framework.TestSuite.run(TestSuite.java:XXX)