aboutsummaryrefslogtreecommitdiff
path: root/log4j-over-slf4j
diff options
context:
space:
mode:
Diffstat (limited to 'log4j-over-slf4j')
-rw-r--r--log4j-over-slf4j/LICENSE.txt176
-rw-r--r--log4j-over-slf4j/compatibility/build.xml2
-rw-r--r--log4j-over-slf4j/compatibility/readme.txt4
-rwxr-xr-xlog4j-over-slf4j/pom.xml44
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/Appender.java9
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java86
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/ConsoleAppender.java12
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/Layout.java2
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/Level.java122
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java20
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/LogManager.java9
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java14
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/MDC.java2
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/PatternLayout.java2
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/Priority.java65
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/PropertyConfigurator.java2
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/RollingFileAppender.java2
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/helpers/LogLog.java18
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Configurator.java5
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/spi/HierarchyEventListener.java2
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Layout.java20
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggerFactory.java2
-rw-r--r--log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggerRepository.java4
-rwxr-xr-xlog4j-over-slf4j/src/main/java9/module-info.java8
-rw-r--r--log4j-over-slf4j/src/main/resources/META-INF/MANIFEST.MF8
-rw-r--r--log4j-over-slf4j/src/test/java/org/apache/log4j/test/NDCTest.java (renamed from log4j-over-slf4j/src/test/java/org/apache/log4j/NDCTest.java)19
-rw-r--r--log4j-over-slf4j/src/test/java/org/apache/log4j/test/Trivial.java (renamed from log4j-over-slf4j/src/test/java/org/apache/log4j/Trivial.java)2
-rw-r--r--log4j-over-slf4j/src/test/java/org/dummy/Bug131.java8
-rw-r--r--log4j-over-slf4j/src/test/java/org/dummy/Bug139.java8
-rw-r--r--log4j-over-slf4j/src/test/java/org/dummy/ListHandler.java2
30 files changed, 478 insertions, 201 deletions
diff --git a/log4j-over-slf4j/LICENSE.txt b/log4j-over-slf4j/LICENSE.txt
new file mode 100644
index 00000000..2bb9ad24
--- /dev/null
+++ b/log4j-over-slf4j/LICENSE.txt
@@ -0,0 +1,176 @@
+ 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 \ No newline at end of file
diff --git a/log4j-over-slf4j/compatibility/build.xml b/log4j-over-slf4j/compatibility/build.xml
index 5115a42a..b8136313 100644
--- a/log4j-over-slf4j/compatibility/build.xml
+++ b/log4j-over-slf4j/compatibility/build.xml
@@ -39,7 +39,7 @@
<!-- ================================================================= -->
<target name="usage">
<echo>
- These are some of the targets supported by this ANT build scpript:
+ These are some of the targets supported by this ANT build script:
all - run all available tests
refresh - copy required jar files to the lib directory
diff --git a/log4j-over-slf4j/compatibility/readme.txt b/log4j-over-slf4j/compatibility/readme.txt
index 6554cc63..86bbc820 100644
--- a/log4j-over-slf4j/compatibility/readme.txt
+++ b/log4j-over-slf4j/compatibility/readme.txt
@@ -5,7 +5,7 @@ that uses either log4j 1.2.x, or log4j 1.3.x.
In the same directory is a build.xml file that uses ant to
compile the test cases with the corresponding log4j version,
-and to runs these tests without log4j in the classpath but with
+and to run these tests without log4j in the classpath but with
logback jars instead.
To run the tests, one must have ant installed. Issuing the following command,
@@ -14,4 +14,4 @@ once in the compatibility directory will launch the tests:
ant all
To obtain more information about the use of the log4j-over-slf4j module,
-please visit http://www..slf4j.org/log4j-over-slf4j.html \ No newline at end of file
+please visit http://www.slf4j.org/log4j-over-slf4j.html
diff --git a/log4j-over-slf4j/pom.xml b/log4j-over-slf4j/pom.xml
index 6f6c0266..7823734f 100755
--- a/log4j-over-slf4j/pom.xml
+++ b/log4j-over-slf4j/pom.xml
@@ -1,5 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -7,16 +7,17 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.7.13-SNAPSHOT</version>
+ <version>2.0.12</version>
+ <relativePath>../parent/pom.xml</relativePath>
</parent>
- <artifactId>log4j-over-slf4j</artifactId>
- <packaging>jar</packaging>
- <name>Log4j Implemented Over SLF4J</name>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <packaging>jar</packaging>
+ <name>Log4j Implemented Over SLF4J</name>
<description>Log4j implemented over SLF4J</description>
- <url>http://www.slf4j.org</url>
+ <url>http://www.slf4j.org</url>
<licenses>
<license>
@@ -25,39 +26,34 @@
</license>
</licenses>
+
+
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- </dependency>
-
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<scope>test</scope>
- </dependency>
+ </dependency>
</dependencies>
-
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
<configuration>
- <archive>
- <manifestEntries>
- <Bundle-Version>${parsedVersion.osgiVersion}</Bundle-Version>
- <Bundle-Description>${project.description}</Bundle-Description>
- <Implementation-Version>${project.version}</Implementation-Version>
- </manifestEntries>
- <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
+ <instructions>
+ <_exportcontents>org.apache.log4j*;version=${reload4j.version};-noimport:=true</_exportcontents>
+ </instructions>
+ </configuration>
</plugin>
-
+
</plugins>
</build>
-</project> \ No newline at end of file
+</project>
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Appender.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Appender.java
index 3df673fb..fcc09994 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Appender.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Appender.java
@@ -18,7 +18,6 @@ package org.apache.log4j;
import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.ErrorHandler;
-import org.apache.log4j.spi.Layout;
import org.apache.log4j.spi.LoggingEvent;
/**
@@ -55,7 +54,7 @@ public interface Appender {
/**
* Release any resources allocated within the appender such as file
* handles, network connections, etc.
- * <p/>
+ *
* <p>It is a programming error to append to a closed appender.
*
* @since 0.8.4
@@ -115,12 +114,12 @@ public interface Appender {
* Configurators call this method to determine if the appender
* requires a layout. If this method returns <code>true</code>,
* meaning that layout is required, then the configurator will
- * configure an layout using the configuration information at its
+ * configure a layout using the configuration information at its
* disposal. If this method returns <code>false</code>, meaning that
* a layout is not required, then layout configuration will be
* skipped even if there is available layout configuration
- * information at the disposal of the configurator..
- * <p/>
+ * information at the disposal of the configurator.
+ *
* <p>In the rather exceptional case, where the appender
* implementation admits a layout but can also work without it, then
* the appender should return <code>true</code>.
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java
index 0d29fbe9..ee4d7893 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java
@@ -29,7 +29,7 @@ import java.util.Enumeration;
* This class is a minimal implementation of the original
* <code>org.apache.log4j.Category</code> class (as found in log4j 1.2) by
* delegation of all calls to a {@link org.slf4j.Logger} instance.
- * </p>
+ *
*
* <p>
* Log4j's <code>trace</code>, <code>debug()</code>, <code>info()</code>,
@@ -45,12 +45,12 @@ public class Category {
private static final String CATEGORY_FQCN = Category.class.getName();
- private String name;
+ private final String name;
protected org.slf4j.Logger slf4jLogger;
private org.slf4j.spi.LocationAwareLogger locationAwareLogger;
- private static Marker FATAL_MARKER = MarkerFactory.getMarker("FATAL");
+ private static final Marker FATAL_MARKER = MarkerFactory.getMarker("FATAL");
Category(String name) {
this.name = name;
@@ -125,6 +125,7 @@ public class Category {
/**
* @deprecated Please use {@link #getLevel} instead.
+ * @return a Level
*/
final public Level getPriority() {
return null;
@@ -132,6 +133,9 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#isDebugEnabled} method in SLF4J
+ *
+ * @return true if this logger is enabled for the level DEBUG
+ *
*/
public boolean isDebugEnabled() {
return slf4jLogger.isDebugEnabled();
@@ -139,13 +143,17 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#isInfoEnabled} method in SLF4J
+ *
+ * @return true if this logger is enabled for the level INFO
*/
public boolean isInfoEnabled() {
return slf4jLogger.isInfoEnabled();
}
/**
- * Delegates tob {@link org.slf4j.Logger#isWarnEnabled} method in SLF4J
+ * Delegates to {@link org.slf4j.Logger#isWarnEnabled} method in SLF4J
+ *
+ * @return true if this logger is enabled for the level WARN
*/
public boolean isWarnEnabled() {
return slf4jLogger.isWarnEnabled();
@@ -153,6 +161,8 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#isErrorEnabled} method in SLF4J
+ *
+ * @return true if this logger is enabled for the level ERROR
*/
public boolean isErrorEnabled() {
return slf4jLogger.isErrorEnabled();
@@ -160,13 +170,11 @@ public class Category {
/**
* Determines whether the priority passed as parameter is enabled in the
- * underlying SLF4J logger. Each log4j priority is mapped directly to its
- * SLF4J equivalent, except for FATAL which is mapped as ERROR.
+ * underlying SLF4J logger. Each log4j priority is mapped directly to its SLF4J
+ * equivalent, except for FATAL which is mapped as ERROR.
*
- * @param p
- * the priority to check against
- * @return true if this logger is enabled for the given level, false
- * otherwise.
+ * @param p the priority to check against
+ * @return true if this logger is enabled for the given level, false otherwise.
*/
public boolean isEnabledFor(Priority p) {
switch (p.level) {
@@ -194,19 +202,19 @@ public class Category {
} else {
switch (level) {
case LocationAwareLogger.TRACE_INT:
- slf4jLogger.trace(marker, m);
+ slf4jLogger.trace(marker, m, (Throwable) t);
break;
case LocationAwareLogger.DEBUG_INT:
- slf4jLogger.debug(marker, m);
+ slf4jLogger.debug(marker, m, (Throwable) t);
break;
case LocationAwareLogger.INFO_INT:
- slf4jLogger.info(marker, m);
+ slf4jLogger.info(marker, m, (Throwable) t);
break;
case LocationAwareLogger.WARN_INT:
- slf4jLogger.warn(marker, m);
+ slf4jLogger.warn(marker, m, (Throwable) t);
break;
case LocationAwareLogger.ERROR_INT:
- slf4jLogger.error(marker, m);
+ slf4jLogger.error(marker, m, (Throwable) t);
break;
}
}
@@ -214,6 +222,8 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#debug(String)} method of SLF4J.
+ *
+ * @param message a message to log
*/
public void debug(Object message) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.DEBUG_INT, message, null);
@@ -222,6 +232,9 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#debug(String,Throwable)} method in
* SLF4J.
+ *
+ * @param message a message to log
+ * @param t a throwable to log
*/
public void debug(Object message, Throwable t) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.DEBUG_INT, message, t);
@@ -229,14 +242,18 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#info(String)} method in SLF4J.
+ *
+ * @param message a message to log
*/
public void info(Object message) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.INFO_INT, message, null);
}
/**
- * Delegates to {@link org.slf4j.Logger#info(String,Throwable)} method in
- * SLF4J.
+ * Delegates to {@link org.slf4j.Logger#info(String,Throwable)} method in SLF4J.
+ *
+ * @param message a message to log
+ * @param t a throwable to log
*/
public void info(Object message, Throwable t) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.INFO_INT, message, t);
@@ -244,14 +261,20 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#warn(String)} method in SLF4J.
+ *
+ * @param message a message to log
+ *
*/
public void warn(Object message) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.WARN_INT, message, null);
}
/**
- * Delegates to {@link org.slf4j.Logger#warn(String,Throwable)} method in
- * SLF4J.
+ * Delegates to {@link org.slf4j.Logger#warn(String,Throwable)} method in SLF4J.
+ *
+ * @param message a message to log
+ * @param t a throwable to log
+ *
*/
public void warn(Object message, Throwable t) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.WARN_INT, message, t);
@@ -259,6 +282,9 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#error(String)} method in SLF4J.
+ *
+ * @param message a message to log
+ *
*/
public void error(Object message) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, null);
@@ -267,6 +293,10 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#error(String,Throwable)} method in
* SLF4J.
+ *
+ * @param message a message to log
+ * @param t a throwable to log
+ *
*/
public void error(Object message, Throwable t) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, t);
@@ -274,6 +304,9 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#error(String)} method in SLF4J.
+ *
+ * @param message a message to log
+ *
*/
public void fatal(Object message) {
differentiatedLog(FATAL_MARKER, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, null);
@@ -282,6 +315,10 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#error(String,Throwable)} method in
* SLF4J. In addition, the call is marked with a marker named "FATAL".
+ *
+ * @param message a message to log
+ * @param t a throwable to log
+ *
*/
public void fatal(Object message, Throwable t) {
differentiatedLog(FATAL_MARKER, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, t);
@@ -291,7 +328,7 @@ public class Category {
log(FQCN, p, msg, t);
}
- // See also http://bugzilla.slf4j.org/show_bug.cgi?id=168
+ // See also http://jira.qos.ch/browse/SLF4J-159
public void log(String FQCN, Priority p, Object msg, Throwable t) {
int levelInt = priorityToLevelInt(p);
differentiatedLog(null, FQCN, levelInt, msg, t);
@@ -347,4 +384,13 @@ public class Category {
// nothing to do
}
+ public boolean getAdditivity() {
+ return false;
+ }
+
+ public void assertLog(boolean assertion, String msg) {
+ if (!assertion)
+ error(msg);
+ }
+
}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/ConsoleAppender.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/ConsoleAppender.java
index 40e8f800..c1935074 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/ConsoleAppender.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/ConsoleAppender.java
@@ -15,6 +15,18 @@
*/
package org.apache.log4j;
+/**
+ * Skeleton implementation of ConsoleAppender
+ */
public class ConsoleAppender extends WriterAppender {
+ public ConsoleAppender() {
+ }
+
+ public ConsoleAppender(Layout layout) {
+ }
+
+ public ConsoleAppender(Layout layout, String target) {
+ }
+
}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Layout.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Layout.java
index 4ea3d990..1f4ef945 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Layout.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Layout.java
@@ -20,7 +20,7 @@ package org.apache.log4j;
/**
* This class is a minimal implementation of the original Log4J class.
*
- * @author Christian Trutz <christian.trutz@belaso.de>
+ * @author Christian Trutz
* */
public class Layout {
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Level.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Level.java
index 62ef578e..ddadbea0 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Level.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Level.java
@@ -26,21 +26,21 @@ import java.io.ObjectStreamException;
import java.io.Serializable;
/**
- Defines the minimum set of levels recognized by the system, that is
- <code>OFF</code>, <code>FATAL</code>, <code>ERROR</code>,
- <code>WARN</code>, <code>INFO</code>, <code>DEBUG</code> and
- <code>ALL</code>.
-
- <p>The <code>Level</code> class may be subclassed to define a larger
- level set.
-
- @author Ceki G&uuml;lc&uuml;
-
+ * Defines the minimum set of levels recognized by the system, that is
+ * <code>OFF</code>, <code>FATAL</code>, <code>ERROR</code>, <code>WARN</code>,
+ * <code>INFO</code>, <code>DEBUG</code> and <code>ALL</code>.
+ *
+ * <p>
+ * The <code>Level</code> class may be subclassed to define a larger level set.
+ *
+ * @author Ceki G&uuml;lc&uuml;
+ *
*/
public class Level extends Priority implements Serializable {
/**
* TRACE level integer value.
+ *
* @since 1.2.12
*/
public static final int TRACE_INT = 5000;
@@ -49,48 +49,52 @@ public class Level extends Priority implements Serializable {
public static final int X_TRACE_INT = DEBUG_INT - 100;
/**
- The <code>OFF</code> has the highest possible rank and is
- intended to turn off logging. */
+ * The <code>OFF</code> has the highest possible rank and is intended to turn
+ * off logging.
+ */
final static public Level OFF = new Level(OFF_INT, "OFF", 0);
/**
- The <code>FATAL</code> level designates very severe error
- events that will presumably lead the application to abort.
+ * The <code>FATAL</code> level designates very severe error events that will
+ * presumably lead the application to abort.
*/
final static public Level FATAL = new Level(FATAL_INT, "FATAL", 0);
/**
- The <code>ERROR</code> level designates error events that
- might still allow the application to continue running. */
+ * The <code>ERROR</code> level designates error events that might still allow
+ * the application to continue running.
+ */
final static public Level ERROR = new Level(ERROR_INT, "ERROR", 3);
/**
- The <code>WARN</code> level designates potentially harmful situations.
- */
+ * The <code>WARN</code> level designates potentially harmful situations.
+ */
final static public Level WARN = new Level(WARN_INT, "WARN", 4);
/**
- The <code>INFO</code> level designates informational messages
- that highlight the progress of the application at coarse-grained
- level. */
+ * The <code>INFO</code> level designates informational messages that highlight
+ * the progress of the application at coarse-grained level.
+ */
final static public Level INFO = new Level(INFO_INT, "INFO", 6);
/**
- The <code>DEBUG</code> Level designates fine-grained
- informational events that are most useful to debug an
- application. */
+ * The <code>DEBUG</code> Level designates fine-grained informational events
+ * that are most useful to debug an application.
+ */
final static public Level DEBUG = new Level(DEBUG_INT, "DEBUG", 7);
/**
- * The <code>TRACE</code> Level designates finer-grained
- * informational events than the <code>DEBUG</code level.
- * @since 1.2.12
- */
+ * The <code>TRACE</code> Level designates finer-grained informational events
+ * than the <code>DEBUG</code> level.
+ *
+ * @since 1.2.12
+ */
public static final Level TRACE = new Level(TRACE_INT, "TRACE", 7);
/**
- The <code>ALL</code> has the lowest possible rank and is intended to
- turn on all logging. */
+ * The <code>ALL</code> has the lowest possible rank and is intended to turn on
+ * all logging.
+ */
final static public Level ALL = new Level(ALL_INT, "ALL", 7);
/**
@@ -99,33 +103,47 @@ public class Level extends Priority implements Serializable {
static final long serialVersionUID = 3491141966387921974L;
/**
- Instantiate a Level object.
+ * Instantiate a Level object.
+ *
+ * @param level a level
+ * @param levelStr a level string
+ * @param syslogEquivalent the Syslog equivalent
*/
protected Level(int level, String levelStr, int syslogEquivalent) {
super(level, levelStr, syslogEquivalent);
}
/**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns {@link #DEBUG}.
- */
+ * Convert the string passed as argument to a level. If the conversion fails,
+ * then this method returns {@link #DEBUG}.
+ *
+ * @param sArg a string
+ * @return corresponding Level
+ *
+ */
public static Level toLevel(String sArg) {
return (Level) toLevel(sArg, Level.DEBUG);
}
/**
- Convert an integer passed as argument to a level. If the
- conversion fails, then this method returns {@link #DEBUG}.
-
- */
+ * Convert an integer passed as argument to a level. If the conversion fails,
+ * then this method returns {@link #DEBUG}.
+ *
+ * @param val an int
+ * @return a level
+ */
public static Level toLevel(int val) {
return (Level) toLevel(val, Level.DEBUG);
}
/**
- Convert an integer passed as argument to a level. If the
- conversion fails, then this method returns the specified default.
- */
+ * Convert an integer passed as argument to a level. If the conversion fails,
+ * then this method returns the specified default.
+ *
+ * @param val a value
+ * @param defaultLevel a defaultLevel
+ * @return corresponding Level
+ */
public static Level toLevel(int val, Level defaultLevel) {
switch (val) {
case ALL_INT:
@@ -150,10 +168,13 @@ public class Level extends Priority implements Serializable {
}
/**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns the value of
- <code>defaultLevel</code>.
- */
+ * Convert the string passed as argument to a level. If the conversion fails,
+ * then this method returns the value of <code>defaultLevel</code>.
+ *
+ * @param sArg a string
+ * @param defaultLevel a default level
+ * @return corresponding level
+ */
public static Level toLevel(String sArg, Level defaultLevel) {
if (sArg == null)
return defaultLevel;
@@ -181,8 +202,9 @@ public class Level extends Priority implements Serializable {
/**
* Custom deserialization of Level.
+ *
* @param s serialization stream.
- * @throws IOException if IO exception.
+ * @throws IOException if IO exception.
* @throws ClassNotFoundException if class not found.
*/
private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException {
@@ -197,6 +219,7 @@ public class Level extends Priority implements Serializable {
/**
* Serialize level.
+ *
* @param s serialization stream.
* @throws IOException if exception during serialization.
*/
@@ -208,14 +231,15 @@ public class Level extends Priority implements Serializable {
}
/**
- * Resolved deserialized level to one of the stock instances.
- * May be overriden in classes derived from Level.
+ * Resolved deserialized level to one of the stock instances. May be overridden
+ * in classes derived from Level.
+ *
* @return resolved object.
* @throws ObjectStreamException if exception during resolution.
*/
private Object readResolve() throws ObjectStreamException {
//
- // if the deserizalized object is exactly an instance of Level
+ // if the deserialized object is exactly an instance of Level
//
if (getClass() == Level.class) {
return toLevel(level);
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java
index 738b6a6c..eea3c97d 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java
@@ -17,7 +17,6 @@
package org.apache.log4j;
import org.apache.log4j.spi.LoggerFactory;
-import org.slf4j.helpers.Util;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -34,24 +33,7 @@ import java.util.concurrent.ConcurrentMap;
class Log4jLoggerFactory {
// String, Logger
- private static ConcurrentMap<String, Logger> log4jLoggers = new ConcurrentHashMap<String, Logger>();
-
- private static final String LOG4J_DELEGATION_LOOP_URL = "http://www.slf4j.org/codes.html#log4jDelegationLoop";
-
- // check for delegation loops
- static {
- try {
- Class.forName("org.slf4j.impl.Log4jLoggerFactory");
- String part1 = "Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. ";
- String part2 = "See also " + LOG4J_DELEGATION_LOOP_URL + " for more details.";
-
- Util.report(part1);
- Util.report(part2);
- throw new IllegalStateException(part1 + part2);
- } catch (ClassNotFoundException e) {
- // this is the good case
- }
- }
+ private static final ConcurrentMap<String, Logger> log4jLoggers = new ConcurrentHashMap<>();
public static Logger getLogger(String name) {
org.apache.log4j.Logger instance = log4jLoggers.get(name);
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/LogManager.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/LogManager.java
index 51c9c85d..42619190 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/LogManager.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/LogManager.java
@@ -22,12 +22,11 @@ import java.util.Enumeration;
import java.util.Vector;
/**
- * <p/>
+ * <p>
* This class is a minimal implementation of the original
* <code>org.apache.log4j.LogManager</code> class (as found in log4j 1.2)
* delegating all calls to SLF4J.
- * <p/>
- * <p/>
+ * <p>
* This implementation does <b>NOT</b> implement the setRepositorySelector(),
* getLoggerRepository(), exists(), getCurrentLoggers(), shutdown() and
* resetConfiguration() methods which do not have SLF4J equivalents.
@@ -51,7 +50,7 @@ public class LogManager {
/**
* Returns a logger instance created by loggerFactory. This method was requested in
- * <a href="http://bugzilla.slf4j.org/show_bug.cgi?id=234">bug #234</a>. Note that
+ * <a href="http://jira.qos.ch/browse/SLF4J-225">SLF4J-225</a>. Note that
* log4j-over-slf4j does not ship with a LoggerFactory implementation. If this
* method is called, the caller must provide his/her own implementation.
*
@@ -67,7 +66,7 @@ public class LogManager {
/**
* This bogus implementation returns an empty enumeration.
*
- * @return
+ * @return an Enumeration of current loggers
*/
public static Enumeration getCurrentLoggers() {
return new Vector().elements();
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java
index 12ec1761..198b4e9e 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java
@@ -24,7 +24,7 @@ import org.slf4j.spi.LocationAwareLogger;
* This class is a minimal implementation of the original
* <code>org.apache.log4j.Logger</code> class (as found in log4j 1.2)
* delegating all calls to a {@link org.slf4j.Logger} instance.
- * </p>
+ *
*
* @author Ceki G&uuml;lc&uuml;
* */
@@ -52,7 +52,7 @@ public class Logger extends Category {
/**
* Does the obvious.
*
- * @return
+ * @return the root logger
*/
public static Logger getRootLogger() {
return Log4jLoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
@@ -61,6 +61,8 @@ public class Logger extends Category {
/**
* Delegates to {@link org.slf4j.Logger#isTraceEnabled}
* method of SLF4J.
+ *
+ * @return whether this logger is enabled for the level TRACE
*/
public boolean isTraceEnabled() {
return slf4jLogger.isTraceEnabled();
@@ -68,6 +70,9 @@ public class Logger extends Category {
/**
* Delegates to {@link org.slf4j.Logger#trace(String)} method in SLF4J.
+ *
+ * @param message the message to log
+ *
*/
public void trace(Object message) {
differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null);
@@ -76,9 +81,12 @@ public class Logger extends Category {
/**
* Delegates to {@link org.slf4j.Logger#trace(String,Throwable)}
* method in SLF4J.
+ *
+ * @param message the message to log
+ * @param t a Throwable to log
*/
public void trace(Object message, Throwable t) {
- differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null);
+ differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, t);
}
}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/MDC.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/MDC.java
index c4a8eff4..32118d4d 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/MDC.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/MDC.java
@@ -49,6 +49,8 @@ public class MDC {
* This method is not part of the Log4J public API. However it
* has been called by other projects. This method is here temporarily
* until projects who are depending on this method release fixes.
+ *
+ * @return a copy of the underlying map returned as a Hashtable
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@Deprecated
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/PatternLayout.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/PatternLayout.java
index a38df63b..a65fa2b9 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/PatternLayout.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/PatternLayout.java
@@ -20,7 +20,7 @@ package org.apache.log4j;
/**
* This class is a minimal implementation of the original Log4J class.
*
- * @author Christian Trutz <christian.trutz@belaso.de>
+ * @author Christian Trutz
* */
public class PatternLayout extends Layout {
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Priority.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Priority.java
index bb4f8d4a..08eebca9 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Priority.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Priority.java
@@ -21,8 +21,8 @@ package org.apache.log4j;
// Contributors: Kitching Simon <Simon.Kitching@OOOrange.ch>
/**
- <font color="#AA4444">Refrain from using this class directly, use
- the {@link Level} class instead</font>.
+ <b>Refrain from using this class directly, use
+ the {@link Level} class instead</b>.
@author Ceki G&uuml;lc&uuml; */
public class Priority {
@@ -48,21 +48,25 @@ public class Priority {
/**
* @deprecated Use {@link Level#ERROR} instead.
*/
+ @Deprecated
final static public Priority ERROR = new Level(ERROR_INT, "ERROR", 3);
/**
* @deprecated Use {@link Level#WARN} instead.
*/
+ @Deprecated
final static public Priority WARN = new Level(WARN_INT, "WARN", 4);
/**
* @deprecated Use {@link Level#INFO} instead.
*/
+ @Deprecated
final static public Priority INFO = new Level(INFO_INT, "INFO", 6);
/**
* @deprecated Use {@link Level#DEBUG} instead.
*/
+ @Deprecated
final static public Priority DEBUG = new Level(DEBUG_INT, "DEBUG", 7);
/**
@@ -76,6 +80,15 @@ public class Priority {
/**
Instantiate a level object.
+ @param
+ */
+
+ /**
+ * Instantiate a level object.
+ *
+ * @param level a level as in int
+ * @param levelStr a levelStr
+ * @param syslogEquivalent the syslog equivalent level integer
*/
protected Priority(int level, String levelStr, int syslogEquivalent) {
this.level = level;
@@ -98,20 +111,23 @@ public class Priority {
/**
Return the syslog equivalent of this priority as an integer.
+ @return the Syslog Equivalent of this Priority
*/
public final int getSyslogEquivalent() {
return syslogEquivalent;
}
/**
- Returns <code>true</code> if this level has a higher or equal
- level than the level passed as argument, <code>false</code>
- otherwise.
-
- <p>You should think twice before overriding the default
- implementation of <code>isGreaterOrEqual</code> method.
-
- */
+ * Returns <code>true</code> if this level has a higher or equal
+ * level than the level passed as argument, <code>false</code>
+ * otherwise.
+ *
+ * <p>You should think twice before overriding the default
+ * implementation of <code>isGreaterOrEqual</code> method.
+ *
+ * @param r a priority
+ * @return a boolean
+ */
public boolean isGreaterOrEqual(Priority r) {
return level >= r.level;
}
@@ -119,9 +135,11 @@ public class Priority {
/**
Return all possible priorities as an array of Level objects in
descending order.
-
+
@deprecated This method will be removed with no replacement.
+ @return array of all possible priorities
*/
+ @Deprecated
public static Priority[] getAllPossiblePriorities() {
return new Priority[] { Priority.FATAL, Priority.ERROR, Level.WARN, Priority.INFO, Priority.DEBUG };
}
@@ -134,7 +152,9 @@ public class Priority {
}
/**
- Returns the integer representation of this level.
+ * Returns the integer representation of this level.
+ *
+ * @return integer representation of this level
*/
public final int toInt() {
return level;
@@ -142,29 +162,46 @@ public class Priority {
/**
* @deprecated Please use the {@link Level#toLevel(String)} method instead.
+ *
+ * @param sArg a string to convert to a Priority
+ * @return the corresponding Priority
*/
+ @Deprecated
public static Priority toPriority(String sArg) {
return Level.toLevel(sArg);
}
/**
* @deprecated Please use the {@link Level#toLevel(int)} method instead.
+ *
+ * @param val an integer to convert to a Priority
+ * @return the corresponding Priority
*/
+ @Deprecated
public static Priority toPriority(int val) {
return toPriority(val, Priority.DEBUG);
}
/**
* @deprecated Please use the {@link Level#toLevel(int, Level)} method instead.
- */
+ *
+ * @param val an integer value
+ * @param defaultPriority a default priority value
+ * @return corresponding Priority value
+ */
+ @Deprecated
public static Priority toPriority(int val, Priority defaultPriority) {
return Level.toLevel(val, (Level) defaultPriority);
}
/**
* @deprecated Please use the {@link Level#toLevel(String, Level)} method instead.
+ * @param sArg string value
+ * @param defaultPriority a default Priority
+ * @return a Priority
*/
+ @Deprecated
public static Priority toPriority(String sArg, Priority defaultPriority) {
return Level.toLevel(sArg, (Level) defaultPriority);
}
-} \ No newline at end of file
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/PropertyConfigurator.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/PropertyConfigurator.java
index baf4c136..6af30d06 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/PropertyConfigurator.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/PropertyConfigurator.java
@@ -23,7 +23,7 @@ import org.apache.log4j.spi.Configurator;
import org.apache.log4j.spi.LoggerRepository;
/**
- * An nop implementation of PropertyConfigurator.
+ * A no-op implementation of PropertyConfigurator.
*/
public class PropertyConfigurator implements Configurator {
public static void configure(Properties properties) {
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/RollingFileAppender.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/RollingFileAppender.java
index b3295974..7cecc550 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/RollingFileAppender.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/RollingFileAppender.java
@@ -22,7 +22,7 @@ import java.io.IOException;
/**
* This class is a minimal implementation of the original Log4J class.
*
- * @author Christian Trutz <christian.trutz@belaso.de>
+ * @author Christian Trutz
* */
public class RollingFileAppender {
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/helpers/LogLog.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/helpers/LogLog.java
index 01157ab7..0270e418 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/helpers/LogLog.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/helpers/LogLog.java
@@ -25,7 +25,7 @@ package org.apache.log4j.helpers;
<b>log4j.configDebug</b> variable.
<p>All log4j internal debug calls go to <code>System.out</code>
- where as internal error messages are sent to
+ whereas internal error messages are sent to
<code>System.err</code>. All internal messages are prepended with
the string "log4j: ".
@@ -37,20 +37,20 @@ public class LogLog {
/**
Defining this value makes log4j print log4j-internal debug
statements to <code>System.out</code>.
-
+
<p> The value of this string is <b>log4j.debug</b>.
-
- <p>Note that the search for all option names is case sensitive. */
+
+ <p>Note that the search for all option names is case-sensitive. */
public static final String DEBUG_KEY = "log4j.debug";
/**
Defining this value makes log4j components print log4j-internal
debug statements to <code>System.out</code>.
-
+
<p> The value of this string is <b>log4j.configDebug</b>.
-
- <p>Note that the search for all option names is case sensitive.
-
+
+ <p>Note that the search for all option names is case-sensitive.
+
@deprecated Use {@link #DEBUG_KEY} instead.
*/
public static final String CONFIG_DEBUG_KEY = "log4j.configDebug";
@@ -127,7 +127,7 @@ public class LogLog {
/**
In quite mode no LogLog generates strictly no output, not even
for errors.
-
+
@param quietMode A true for not
*/
public static void setQuietMode(boolean quietMode) {
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Configurator.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Configurator.java
index abf75609..f15cbf07 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Configurator.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Configurator.java
@@ -16,7 +16,6 @@
package org.apache.log4j.spi;
-import org.apache.log4j.spi.LoggerRepository;
import java.net.URL;
/**
@@ -41,10 +40,10 @@ public interface Configurator {
/**
Interpret a resource pointed by a URL and set up log4j accordingly.
-
+
The configuration is done relative to the <code>hierarchy</code>
parameter.
-
+
@param url The URL to parse
@param repository The hierarchy to operation upon.
*/
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/HierarchyEventListener.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/HierarchyEventListener.java
index a774949e..9271b70b 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/HierarchyEventListener.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/HierarchyEventListener.java
@@ -19,7 +19,7 @@ package org.apache.log4j.spi;
import org.apache.log4j.*;
/**
- Listen to events occuring within a {@link
+ Listen to events occurring within a {@link
org.apache.log4j.Hierarchy Hierarchy}.
@author Ceki G&uuml;lc&uuml;
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Layout.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Layout.java
deleted file mode 100644
index 32d49074..00000000
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Layout.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2001-2004 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.
- */
-
-package org.apache.log4j.spi;
-
-public class Layout {
-}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggerFactory.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggerFactory.java
index c3e756d7..0f008bfa 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggerFactory.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggerFactory.java
@@ -21,7 +21,7 @@ import org.apache.log4j.Logger;
/**
Implement this interface to create new instances of Logger or
- a sub-class of Logger.
+ a subclass of Logger.
<p>See <code>examples/subclass/MyLogger.java</code> for an example.
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggerRepository.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggerRepository.java
index 4decdb78..87a3b61d 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggerRepository.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggerRepository.java
@@ -25,7 +25,7 @@ import java.util.Enumeration;
* <code>Loggers</code>. The relation between loggers in a repository
* depends on the repository but typically loggers are arranged in a
* named hierarchy.
- * <p/>
+ *
* <p>In addition to the creational methods, a
* <code>LoggerRepository</code> can be queried for existing loggers,
* can act as a point of registry for events related to loggers.
@@ -37,6 +37,8 @@ public interface LoggerRepository {
/**
* Add a {@link HierarchyEventListener} event to the repository.
+ *
+ * @param listener a listener
*/
public void addHierarchyEventListener(HierarchyEventListener listener);
diff --git a/log4j-over-slf4j/src/main/java9/module-info.java b/log4j-over-slf4j/src/main/java9/module-info.java
new file mode 100755
index 00000000..35017bea
--- /dev/null
+++ b/log4j-over-slf4j/src/main/java9/module-info.java
@@ -0,0 +1,8 @@
+module log4j {
+ requires org.slf4j;
+ requires java.xml;
+ exports org.apache.log4j;
+ exports org.apache.log4j.helpers;
+ exports org.apache.log4j.spi;
+ exports org.apache.log4j.xml;
+} \ No newline at end of file
diff --git a/log4j-over-slf4j/src/main/resources/META-INF/MANIFEST.MF b/log4j-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
deleted file mode 100644
index 531f5842..00000000
--- a/log4j-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,8 +0,0 @@
-Implementation-Title: log4j-over-slf4j
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: log4j.over.slf4j
-Bundle-Name: log4j-over-slf4j
-Bundle-Vendor: SLF4J.ORG
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.apache.log4j;version=${log4j.version},org.apache.log4j.helpers;version=${log4j.version},org.apache.log4j.spi;version=${log4j.version},org.apache.log4j.xml;version=${log4j.version}
-Import-Package: org.slf4j;version=${slf4j.api.minimum.compatible.version}, org.slf4j.helpers;version=${slf4j.api.minimum.compatible.version}, org.slf4j.spi;version=${slf4j.api.minimum.compatible.version}
diff --git a/log4j-over-slf4j/src/test/java/org/apache/log4j/NDCTest.java b/log4j-over-slf4j/src/test/java/org/apache/log4j/test/NDCTest.java
index 74c2cd3b..ff87cff4 100644
--- a/log4j-over-slf4j/src/test/java/org/apache/log4j/NDCTest.java
+++ b/log4j-over-slf4j/src/test/java/org/apache/log4j/test/NDCTest.java
@@ -22,35 +22,46 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-package org.apache.log4j;
+package org.apache.log4j.test;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.log4j.NDC;
/**
- * @author Ceki G&uuml;c&uuml;
+ * @author Ceki G&uuml;lc&uuml;
*/
-public class NDCTest extends TestCase {
+public class NDCTest {
+ @Before
public void setUp() {
assertEquals(0, NDC.getDepth());
}
+ @After
public void tearDown() {
NDC.clear();
}
+ @Test
public void testSmoke() {
NDC.push("a");
String back = NDC.pop();
assertEquals("a", back);
}
+ @Test
public void testPop() {
NDC.push("peek");
String back = NDC.peek();
assertEquals("peek", back);
}
+ @Test
public void testClear() {
NDC.push("clear");
NDC.clear();
diff --git a/log4j-over-slf4j/src/test/java/org/apache/log4j/Trivial.java b/log4j-over-slf4j/src/test/java/org/apache/log4j/test/Trivial.java
index 50edf2d3..6a8fbcc5 100644
--- a/log4j-over-slf4j/src/test/java/org/apache/log4j/Trivial.java
+++ b/log4j-over-slf4j/src/test/java/org/apache/log4j/test/Trivial.java
@@ -22,7 +22,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-package org.apache.log4j;
+package org.apache.log4j.test;
import org.apache.log4j.Logger;
diff --git a/log4j-over-slf4j/src/test/java/org/dummy/Bug131.java b/log4j-over-slf4j/src/test/java/org/dummy/Bug131.java
index c97d5666..4453ac22 100644
--- a/log4j-over-slf4j/src/test/java/org/dummy/Bug131.java
+++ b/log4j-over-slf4j/src/test/java/org/dummy/Bug131.java
@@ -24,16 +24,18 @@
*/
package org.dummy;
+import static org.junit.Assert.assertEquals;
+
import java.util.logging.Level;
import java.util.logging.LogRecord;
-import junit.framework.TestCase;
-
import org.apache.log4j.Category;
import org.apache.log4j.Logger;
+import org.junit.Test;
-public class Bug131 extends TestCase {
+public class Bug131 {
+ @Test
public void testBug131() {
ListHandler listHandler = new ListHandler();
diff --git a/log4j-over-slf4j/src/test/java/org/dummy/Bug139.java b/log4j-over-slf4j/src/test/java/org/dummy/Bug139.java
index f6cfe63f..1bb280ce 100644
--- a/log4j-over-slf4j/src/test/java/org/dummy/Bug139.java
+++ b/log4j-over-slf4j/src/test/java/org/dummy/Bug139.java
@@ -24,16 +24,18 @@
*/
package org.dummy;
+import static org.junit.Assert.assertEquals;
+
import java.util.logging.Level;
import java.util.logging.LogRecord;
-import junit.framework.TestCase;
-
import org.apache.log4j.Category;
import org.apache.log4j.Logger;
+import org.junit.Test;
-public class Bug139 extends TestCase {
+public class Bug139 {
+ @Test
public void test() {
ListHandler listHandler = new ListHandler();
java.util.logging.Logger root = java.util.logging.Logger.getLogger("");
diff --git a/log4j-over-slf4j/src/test/java/org/dummy/ListHandler.java b/log4j-over-slf4j/src/test/java/org/dummy/ListHandler.java
index c29ebfa1..2a237239 100644
--- a/log4j-over-slf4j/src/test/java/org/dummy/ListHandler.java
+++ b/log4j-over-slf4j/src/test/java/org/dummy/ListHandler.java
@@ -31,7 +31,7 @@ import java.util.logging.LogRecord;
public class ListHandler extends Handler {
- List<LogRecord> list = new ArrayList<LogRecord>();
+ List<LogRecord> list = new ArrayList<>();
public void close() throws SecurityException {