diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..412eeda
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..23c65dc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,13 @@
+.settings
+target
+.classpath
+.project
+*~
+*.tmproj
+*.iml
+.idea
+.scala_dependencies
+integration/bundle/
+integration/felix-cache/
+runner
+.DS_Store
diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml
new file mode 100755
index 0000000..31cb322
--- /dev/null
+++ b/.idea/codeStyleSettings.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100755
index 0000000..74f2ed9
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+language: java
+notifications:
+ email:
+ - notification@qos.ch
diff --git a/LICENSE.txt b/LICENSE.txt
index 54f5abe..315bd49 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,24 +1,24 @@
-Copyright (c) 2004-2017 QOS.ch
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-
+Copyright (c) 2004-2017 QOS.ch
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
diff --git a/README.md b/README.md
index 1cb4a4f..6966353 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,14 @@
-# About SLF4J
-The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at deployment time.
-More information can be found on the [SLF4J website](http://www.slf4j.org).
-# Build Status
-[![Build Status](https://travis-ci.org/qos-ch/slf4j.png)](https://travis-ci.org/qos-ch/slf4j)
-
-# How to contribute pull requests
-If you are interested in improving SLF4J, great! The SLF4J community looks forward to your contribution. Please follow this process:
-
-1. Start a discussion on the [slf4j-dev mailing list](http://www.slf4j.org/mailing-lists.html) about your proposed change. Alternately file a [bug report](http://www.slf4j.org/bug-reporting.html).
-2. Fork qos-ch/slf4j. Ideally, create a new branch from your fork for your contribution to make it easier to merge your changes back.
-3. Make your changes on the branch you hopefuly created in Step 2. Be sure that your code passes existing unit tests. Please add unit tests for your work if appropriate. It usually is.
-4. Push your changes to your fork/branch in github. Don't push it to your master! If you do it will make it harder to submit new changes later.
-5. Submit a pull request to SLF4J from from your commit page on github.
+# About SLF4J
+The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at deployment time.
+More information can be found on the [SLF4J website](http://www.slf4j.org).
+# Build Status
+[![Build Status](https://travis-ci.org/qos-ch/slf4j.png)](https://travis-ci.org/qos-ch/slf4j)
+
+# How to contribute pull requests
+If you are interested in improving SLF4J, great! The SLF4J community looks forward to your contribution. Please follow this process:
+
+1. Start a discussion on the [slf4j-dev mailing list](http://www.slf4j.org/mailing-lists.html) about your proposed change. Alternately file a [bug report](http://www.slf4j.org/bug-reporting.html).
+2. Fork qos-ch/slf4j. Ideally, create a new branch from your fork for your contribution to make it easier to merge your changes back.
+3. Make your changes on the branch you hopefuly created in Step 2. Be sure that your code passes existing unit tests. Please add unit tests for your work if appropriate. It usually is.
+4. Push your changes to your fork/branch in github. Don't push it to your master! If you do it will make it harder to submit new changes later.
+5. Submit a pull request to SLF4J from from your commit page on github.
diff --git a/codeStyle.xml b/codeStyle.xml
new file mode 100644
index 0000000..355c4b1
--- /dev/null
+++ b/codeStyle.xml
@@ -0,0 +1,295 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/integration/build.xml b/integration/build.xml
old file mode 100644
new file mode 100755
index 80f3efc..6f7bb03 100755
--- a/integration/build.xml
+++ b/integration/build.xml
@@ -1,248 +1,248 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setPathToPolicy_FromTop
-
-
-
-
- setPathToPolicy_FromInegration
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setPathToPolicy_FromTop
+
+
+
+
+ setPathToPolicy_FromInegration
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/integration/osgi-build.xml b/integration/osgi-build.xml
index 00f59f7..231c2fa 100644
--- a/integration/osgi-build.xml
+++ b/integration/osgi-build.xml
@@ -1,92 +1,92 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- value of t = @{t}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ value of t = @{t}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/integration/pom.xml b/integration/pom.xml
old file mode 100644
new file mode 100755
index 6d33bc5..b612ae6 100755
--- a/integration/pom.xml
+++ b/integration/pom.xml
@@ -1,119 +1,119 @@
-
-
-
- 4.0.0
-
-
- org.slf4j
- slf4j-parent
- 1.7.25
-
-
- integration
- jar
- SLF4J Integration tests
-
- http://www.slf4j.org
- SLF4J integration tests
-
-
-
- org.slf4j
- slf4j-api
-
-
-
-
- junit
- junit
- 3.8.1
-
-
-
- ant
- ant-junit
- 1.6.5
-
-
-
-
- org.apache.felix
- org.apache.felix.main
- 5.6.1
-
-
-
-
-
-
-
- maven-antrun-plugin
- 1.2
-
-
- junit
- junit
- 3.8.1
-
-
- ant
- ant-junit
- 1.6.5
-
-
-
-
- ant-test
- package
-
-
-
-
-
-
-
-
-
-
-
- run
-
-
-
- ant-osgi-test
- package
-
-
-
-
-
-
-
-
-
- run
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- once
- plain
- false
-
- **/*Test.java
-
-
-
-
-
-
-
-
+
+
+
+ 4.0.0
+
+
+ org.slf4j
+ slf4j-parent
+ 1.7.26
+
+
+ integration
+ jar
+ SLF4J Integration tests
+
+ http://www.slf4j.org
+ SLF4J integration tests
+
+
+
+ org.slf4j
+ slf4j-api
+
+
+
+
+ junit
+ junit
+ 3.8.1
+
+
+
+ ant
+ ant-junit
+ 1.6.5
+
+
+
+
+ org.apache.felix
+ org.apache.felix.main
+ 5.6.1
+
+
+
+
+
+
+
+ maven-antrun-plugin
+ 1.2
+
+
+ junit
+ junit
+ 3.8.1
+
+
+ ant
+ ant-junit
+ 1.6.5
+
+
+
+
+ ant-test
+ package
+
+
+
+
+
+
+
+
+
+
+
+ run
+
+
+
+ ant-osgi-test
+ package
+
+
+
+
+
+
+
+
+
+ run
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ once
+ plain
+ false
+
+ **/*Test.java
+
+
+
+
+
+
+
+
diff --git a/integration/src/IBUNDLE-META-INF/MANIFEST.MF b/integration/src/IBUNDLE-META-INF/MANIFEST.MF
index 07492d4..d518a2b 100644
--- a/integration/src/IBUNDLE-META-INF/MANIFEST.MF
+++ b/integration/src/IBUNDLE-META-INF/MANIFEST.MF
@@ -1,15 +1,15 @@
-Manifest-Version: 1.0
-Archiver-Version: Plexus Archiver
-Created-By: Apache Maven
-Built-By: ceki
-Build-Jdk: 1.6.0_16
-Bundle-Description: iBundle
-Bundle-Version: 0.1
-Bundle-Activator: integrator.Activator
-Implementation-Title: iBundle
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: iBundle
-Bundle-Name: abundle
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: apack
+Manifest-Version: 1.0
+Archiver-Version: Plexus Archiver
+Created-By: Apache Maven
+Built-By: ceki
+Build-Jdk: 1.6.0_16
+Bundle-Description: iBundle
+Bundle-Version: 0.1
+Bundle-Activator: integrator.Activator
+Implementation-Title: iBundle
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: iBundle
+Bundle-Name: abundle
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: apack
Import-Package: org.osgi.framework, org.slf4j;version=1.5diff --git a/integration/src/policy/java-eclipse.policy b/integration/src/policy/java-eclipse.policy
index f196c95..9a42e4d 100644
--- a/integration/src/policy/java-eclipse.policy
+++ b/integration/src/policy/java-eclipse.policy
@@ -1,10 +1,10 @@
-
-grant {
-
- // note that java.lang.RuntimePermission createSecurityManager is NOT granted
-
- permission java.util.PropertyPermission "user.dir", "read";
- permission java.util.PropertyPermission "*", "read";
-
- permission java.net.SocketPermission "*", "connect,resolve";
+
+grant {
+
+ // note that java.lang.RuntimePermission createSecurityManager is NOT granted
+
+ permission java.util.PropertyPermission "user.dir", "read";
+ permission java.util.PropertyPermission "*", "read";
+
+ permission java.net.SocketPermission "*", "connect,resolve";
};diff --git a/integration/src/policy/java-under-ant.policy b/integration/src/policy/java-under-ant.policy
index 1077f96..41f7fcf 100644
--- a/integration/src/policy/java-under-ant.policy
+++ b/integration/src/policy/java-under-ant.policy
@@ -1,13 +1,13 @@
-
-grant {
-
- // note that java.lang.RuntimePermission createSecurityManager is NOT granted
-
- permission java.util.PropertyPermission "user.dir", "read";
-
- // permissions required for Ant's Junit runner
- permission java.util.PropertyPermission "*", "read, write";
- permission java.io.FilePermission "./-", "read";
- permission java.io.FilePermission "./-", "write";
- permission java.lang.RuntimePermission "setIO";
+
+grant {
+
+ // note that java.lang.RuntimePermission createSecurityManager is NOT granted
+
+ permission java.util.PropertyPermission "user.dir", "read";
+
+ // permissions required for Ant's Junit runner
+ permission java.util.PropertyPermission "*", "read, write";
+ permission java.io.FilePermission "./-", "read";
+ permission java.io.FilePermission "./-", "write";
+ permission java.lang.RuntimePermission "setIO";
};diff --git a/integration/src/test/java/integrator/Activator.java b/integration/src/test/java/integrator/Activator.java
index 25f7965..f1b5c78 100644
--- a/integration/src/test/java/integrator/Activator.java
+++ b/integration/src/test/java/integrator/Activator.java
@@ -1,60 +1,60 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package integrator;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A BundleActivator which invokes slf4j loggers
- * @author Ceki Gülcü
- *
- */
-public class Activator implements BundleActivator {
-
- private BundleContext m_context = null;
-
- public void start(BundleContext context) {
- Logger logger = LoggerFactory.getLogger(this.getClass());
- logger.info("Activator.start()");
- m_context = context;
- }
-
- public void stop(BundleContext context) {
- m_context = null;
- Logger logger = LoggerFactory.getLogger(this.getClass());
- logger.info("Activator.stop");
- }
-
- public Bundle[] getBundles() {
- if (m_context != null) {
- return m_context.getBundles();
- }
- return null;
- }
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package integrator;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A BundleActivator which invokes slf4j loggers
+ * @author Ceki Gülcü
+ *
+ */
+public class Activator implements BundleActivator {
+
+ private BundleContext m_context = null;
+
+ public void start(BundleContext context) {
+ Logger logger = LoggerFactory.getLogger(this.getClass());
+ logger.info("Activator.start()");
+ m_context = context;
+ }
+
+ public void stop(BundleContext context) {
+ m_context = null;
+ Logger logger = LoggerFactory.getLogger(this.getClass());
+ logger.info("Activator.stop");
+ }
+
+ public Bundle[] getBundles() {
+ if (m_context != null) {
+ return m_context.getBundles();
+ }
+ return null;
+ }
}diff --git a/integration/src/test/java/org/slf4j/CompatibilityAssertionTest.java b/integration/src/test/java/org/slf4j/CompatibilityAssertionTest.java
index 501a34b..021ef13 100644
--- a/integration/src/test/java/org/slf4j/CompatibilityAssertionTest.java
+++ b/integration/src/test/java/org/slf4j/CompatibilityAssertionTest.java
@@ -1,61 +1,61 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package org.slf4j;
-
-import java.io.PrintStream;
-import java.util.Random;
-
-import junit.framework.TestCase;
-
-public class CompatibilityAssertionTest extends TestCase {
-
- StringPrintStream sps = new StringPrintStream(System.err);
- PrintStream old = System.err;
- int diff = 1024 + new Random().nextInt(10000);
-
- public CompatibilityAssertionTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- System.setErr(sps);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- System.setErr(old);
- }
-
- public void test() throws Exception {
- Logger logger = LoggerFactory.getLogger(this.getClass());
- String msg = "hello world " + diff;
- logger.info(msg);
- assertEquals(1, sps.stringList.size());
- String s0 = (String) sps.stringList.get(0);
- assertTrue(s0.contains(msg));
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package org.slf4j;
+
+import java.io.PrintStream;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+public class CompatibilityAssertionTest extends TestCase {
+
+ StringPrintStream sps = new StringPrintStream(System.err);
+ PrintStream old = System.err;
+ int diff = 1024 + new Random().nextInt(10000);
+
+ public CompatibilityAssertionTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ System.setErr(sps);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ System.setErr(old);
+ }
+
+ public void test() throws Exception {
+ Logger logger = LoggerFactory.getLogger(this.getClass());
+ String msg = "hello world " + diff;
+ logger.info(msg);
+ assertEquals(1, sps.stringList.size());
+ String s0 = (String) sps.stringList.get(0);
+ assertTrue(s0.contains(msg));
+ }
+}
diff --git a/integration/src/test/java/org/slf4j/IncompatibleMultiBindingAssertionTest.java b/integration/src/test/java/org/slf4j/IncompatibleMultiBindingAssertionTest.java
index 001ea1b..80c9b00 100644
--- a/integration/src/test/java/org/slf4j/IncompatibleMultiBindingAssertionTest.java
+++ b/integration/src/test/java/org/slf4j/IncompatibleMultiBindingAssertionTest.java
@@ -1,74 +1,74 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j;
-
-import java.io.PrintStream;
-import java.util.List;
-import java.util.Random;
-
-import junit.framework.TestCase;
-
-public class IncompatibleMultiBindingAssertionTest extends TestCase {
-
- StringPrintStream sps = new StringPrintStream(System.err);
- PrintStream old = System.err;
- int diff = 1024 + new Random().nextInt(10000);
-
- public IncompatibleMultiBindingAssertionTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- System.setErr(sps);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- System.setErr(old);
- }
-
- public void test() throws Exception {
- try {
- Logger logger = LoggerFactory.getLogger(this.getClass());
- String msg = "hello world " + diff;
- logger.info(msg);
- fail("was expecting NoSuchMethodError");
- } catch (NoSuchMethodError e) {
- }
- List list = sps.stringList;
- assertMsgContains(list, 0, "Class path contains multiple SLF4J bindings.");
- assertMsgContains(list, 1, "Found binding in");
- assertMsgContains(list, 2, "Found binding in");
- assertMsgContains(list, 3, "See http://www.slf4j.org/codes.html");
- assertMsgContains(list, 4, "slf4j-api 1.6.x (or later) is incompatible with this binding");
- assertMsgContains(list, 5, "Your binding is version 1.5.5 or earlier.");
-
- }
-
- void assertMsgContains(List strList, int index, String msg) {
- assertTrue(((String) strList.get(index)).contains(msg));
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j;
+
+import java.io.PrintStream;
+import java.util.List;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+public class IncompatibleMultiBindingAssertionTest extends TestCase {
+
+ StringPrintStream sps = new StringPrintStream(System.err);
+ PrintStream old = System.err;
+ int diff = 1024 + new Random().nextInt(10000);
+
+ public IncompatibleMultiBindingAssertionTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ System.setErr(sps);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ System.setErr(old);
+ }
+
+ public void test() throws Exception {
+ try {
+ Logger logger = LoggerFactory.getLogger(this.getClass());
+ String msg = "hello world " + diff;
+ logger.info(msg);
+ fail("was expecting NoSuchMethodError");
+ } catch (NoSuchMethodError e) {
+ }
+ List list = sps.stringList;
+ assertMsgContains(list, 0, "Class path contains multiple SLF4J bindings.");
+ assertMsgContains(list, 1, "Found binding in");
+ assertMsgContains(list, 2, "Found binding in");
+ assertMsgContains(list, 3, "See http://www.slf4j.org/codes.html");
+ assertMsgContains(list, 4, "slf4j-api 1.6.x (or later) is incompatible with this binding");
+ assertMsgContains(list, 5, "Your binding is version 1.5.5 or earlier.");
+
+ }
+
+ void assertMsgContains(List strList, int index, String msg) {
+ assertTrue(((String) strList.get(index)).contains(msg));
+ }
+}
diff --git a/integration/src/test/java/org/slf4j/MissingSingletonMethodAssertionTest.java b/integration/src/test/java/org/slf4j/MissingSingletonMethodAssertionTest.java
index 08776f8..96c2b41 100644
--- a/integration/src/test/java/org/slf4j/MissingSingletonMethodAssertionTest.java
+++ b/integration/src/test/java/org/slf4j/MissingSingletonMethodAssertionTest.java
@@ -1,83 +1,83 @@
-/**
- * Copyright (c) 2004-2016 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j;
-
-import java.io.PrintStream;
-import java.util.Random;
-
-import junit.framework.TestCase;
-
-public class MissingSingletonMethodAssertionTest extends TestCase {
-
- StringPrintStream sps = new StringPrintStream(System.err);
- PrintStream old = System.err;
- int diff = 1024 + new Random().nextInt(10000);
-
- public MissingSingletonMethodAssertionTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- System.setErr(sps);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- System.setErr(old);
- }
-
- public void test() throws Exception {
- try {
- Logger logger = LoggerFactory.getLogger(this.getClass());
- String msg = "hello world " + diff;
- logger.info(msg);
- fail("NoSuchMethodError expected");
- } catch (NoSuchMethodError e) {
- }
-
- int lineCount = sps.stringList.size();
- assertTrue("number of lines should be 3 but was " + lineCount, lineCount == 3);
-
- // expected output:
- // SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
- // SLF4J: Your binding is version 1.4.x or earlier.
- // SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x
-
- {
- String s = (String) sps.stringList.get(0);
- assertTrue(s.contains("SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding."));
- }
- {
- String s = (String) sps.stringList.get(1);
- assertTrue(s.contains("SLF4J: Your binding is version 1.5.5 or earlier."));
- }
- {
- String s = (String) sps.stringList.get(2);
- assertTrue(s.contains("SLF4J: Upgrade your binding to version 1.6.x."));
- }
-
- }
-}
+/**
+ * Copyright (c) 2004-2016 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j;
+
+import java.io.PrintStream;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+public class MissingSingletonMethodAssertionTest extends TestCase {
+
+ StringPrintStream sps = new StringPrintStream(System.err);
+ PrintStream old = System.err;
+ int diff = 1024 + new Random().nextInt(10000);
+
+ public MissingSingletonMethodAssertionTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ System.setErr(sps);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ System.setErr(old);
+ }
+
+ public void test() throws Exception {
+ try {
+ Logger logger = LoggerFactory.getLogger(this.getClass());
+ String msg = "hello world " + diff;
+ logger.info(msg);
+ fail("NoSuchMethodError expected");
+ } catch (NoSuchMethodError e) {
+ }
+
+ int lineCount = sps.stringList.size();
+ assertTrue("number of lines should be 3 but was " + lineCount, lineCount == 3);
+
+ // expected output:
+ // SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
+ // SLF4J: Your binding is version 1.4.x or earlier.
+ // SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x
+
+ {
+ String s = (String) sps.stringList.get(0);
+ assertTrue(s.contains("SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding."));
+ }
+ {
+ String s = (String) sps.stringList.get(1);
+ assertTrue(s.contains("SLF4J: Your binding is version 1.5.5 or earlier."));
+ }
+ {
+ String s = (String) sps.stringList.get(2);
+ assertTrue(s.contains("SLF4J: Upgrade your binding to version 1.6.x."));
+ }
+
+ }
+}
diff --git a/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java b/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
index 5cbf131..8d1cb59 100644
--- a/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
+++ b/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
@@ -1,68 +1,68 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j;
-
-import java.io.PrintStream;
-import java.util.List;
-import java.util.Random;
-
-import junit.framework.TestCase;
-
-public class MultiBindingAssertionTest extends TestCase {
-
- StringPrintStream sps = new StringPrintStream(System.err);
- PrintStream old = System.err;
- int diff = 1024 + new Random().nextInt(10000);
-
- public MultiBindingAssertionTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- System.setErr(sps);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- System.setErr(old);
- }
-
- public void test() throws Exception {
- Logger logger = LoggerFactory.getLogger(this.getClass());
- String msg = "hello world " + diff;
- logger.info(msg);
- List list = sps.stringList;
- assertMsgContains(list, 0, "Class path contains multiple SLF4J bindings.");
- assertMsgContains(list, 1, "Found binding in");
- assertMsgContains(list, 2, "Found binding in");
- assertMsgContains(list, 3, "See http://www.slf4j.org/codes.html");
- assertMsgContains(list, 4, "Actual binding is of type [");
- }
-
- void assertMsgContains(List strList, int index, String msg) {
- assertTrue(((String) strList.get(index)).contains(msg));
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j;
+
+import java.io.PrintStream;
+import java.util.List;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+public class MultiBindingAssertionTest extends TestCase {
+
+ StringPrintStream sps = new StringPrintStream(System.err);
+ PrintStream old = System.err;
+ int diff = 1024 + new Random().nextInt(10000);
+
+ public MultiBindingAssertionTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ System.setErr(sps);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ System.setErr(old);
+ }
+
+ public void test() throws Exception {
+ Logger logger = LoggerFactory.getLogger(this.getClass());
+ String msg = "hello world " + diff;
+ logger.info(msg);
+ List list = sps.stringList;
+ assertMsgContains(list, 0, "Class path contains multiple SLF4J bindings.");
+ assertMsgContains(list, 1, "Found binding in");
+ assertMsgContains(list, 2, "Found binding in");
+ assertMsgContains(list, 3, "See http://www.slf4j.org/codes.html");
+ assertMsgContains(list, 4, "Actual binding is of type [");
+ }
+
+ void assertMsgContains(List strList, int index, String msg) {
+ assertTrue(((String) strList.get(index)).contains(msg));
+ }
+}
diff --git a/integration/src/test/java/org/slf4j/StringPrintStream.java b/integration/src/test/java/org/slf4j/StringPrintStream.java
index 82b6852..200b745 100644
--- a/integration/src/test/java/org/slf4j/StringPrintStream.java
+++ b/integration/src/test/java/org/slf4j/StringPrintStream.java
@@ -1,56 +1,56 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j;
-
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.List;
-
-public class StringPrintStream extends PrintStream {
-
- public static final String LINE_SEP = System.getProperty("line.separator");
- PrintStream other;
- List stringList = new ArrayList();
-
- public StringPrintStream(PrintStream ps) {
- super(ps);
- other = ps;
- }
-
- public void print(String s) {
- other.print(s);
- stringList.add(s);
- }
-
- public void println(String s) {
- other.println(s);
- stringList.add(s);
- }
-
- public void println(Object o) {
- other.println(o);
- stringList.add(o.toString());
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
+public class StringPrintStream extends PrintStream {
+
+ public static final String LINE_SEP = System.getProperty("line.separator");
+ PrintStream other;
+ List stringList = new ArrayList();
+
+ public StringPrintStream(PrintStream ps) {
+ super(ps);
+ other = ps;
+ }
+
+ public void print(String s) {
+ other.print(s);
+ stringList.add(s);
+ }
+
+ public void println(String s) {
+ other.println(s);
+ stringList.add(s);
+ }
+
+ public void println(Object o) {
+ other.println(o);
+ stringList.add(o.toString());
+ }
+}
diff --git a/integration/src/test/java/org/slf4j/VersionMismatchAssertionTest.java b/integration/src/test/java/org/slf4j/VersionMismatchAssertionTest.java
index 75ff0bd..c6d90e0 100644
--- a/integration/src/test/java/org/slf4j/VersionMismatchAssertionTest.java
+++ b/integration/src/test/java/org/slf4j/VersionMismatchAssertionTest.java
@@ -1,67 +1,67 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j;
-
-import java.io.PrintStream;
-import java.util.Random;
-
-import junit.framework.TestCase;
-
-public class VersionMismatchAssertionTest extends TestCase {
-
- StringPrintStream sps = new StringPrintStream(System.err);
- PrintStream old = System.err;
- int diff = 1024 + new Random().nextInt(10000);
-
- public VersionMismatchAssertionTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- System.setErr(sps);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- System.setErr(old);
- }
-
- public void test() throws Exception {
- Logger logger = LoggerFactory.getLogger(this.getClass());
- String msg = "hello world " + diff;
- logger.info(msg);
-
- String s0 = (String) sps.stringList.get(0);
- assertTrue(s0.matches("SLF4J: The requested version .* by your slf4j binding is not compatible with.*"));
-
- String s1 = (String) sps.stringList.get(1);
- assertTrue(s1.contains(LoggerFactory.VERSION_MISMATCH));
-
- String s2 = (String) sps.stringList.get(2);
- assertTrue(s2.contains(msg));
-
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j;
+
+import java.io.PrintStream;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+public class VersionMismatchAssertionTest extends TestCase {
+
+ StringPrintStream sps = new StringPrintStream(System.err);
+ PrintStream old = System.err;
+ int diff = 1024 + new Random().nextInt(10000);
+
+ public VersionMismatchAssertionTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ System.setErr(sps);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ System.setErr(old);
+ }
+
+ public void test() throws Exception {
+ Logger logger = LoggerFactory.getLogger(this.getClass());
+ String msg = "hello world " + diff;
+ logger.info(msg);
+
+ String s0 = (String) sps.stringList.get(0);
+ assertTrue(s0.matches("SLF4J: The requested version .* by your slf4j binding is not compatible with.*"));
+
+ String s1 = (String) sps.stringList.get(1);
+ assertTrue(s1.contains(LoggerFactory.VERSION_MISMATCH));
+
+ String s2 = (String) sps.stringList.get(2);
+ assertTrue(s2.contains(msg));
+
+ }
+}
diff --git a/integration/src/test/java/org/slf4j/issues/Issue324Test.java b/integration/src/test/java/org/slf4j/issues/Issue324Test.java
index 4093f62..a7c2d7e 100644
--- a/integration/src/test/java/org/slf4j/issues/Issue324Test.java
+++ b/integration/src/test/java/org/slf4j/issues/Issue324Test.java
@@ -1,16 +1,16 @@
-package org.slf4j.issues;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import junit.framework.TestCase;
-
-public class Issue324Test extends TestCase {
-
- public void testLoggerCreationInPresenseOfSecurityManager() {
- String currentDir = System.getProperty("user.dir");
- System.out.println("currentDir:" + currentDir);
- Logger logger = LoggerFactory.getLogger(Issue324Test.class);
- logger.debug("hello");
- }
-}
+package org.slf4j.issues;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import junit.framework.TestCase;
+
+public class Issue324Test extends TestCase {
+
+ public void testLoggerCreationInPresenseOfSecurityManager() {
+ String currentDir = System.getProperty("user.dir");
+ System.out.println("currentDir:" + currentDir);
+ Logger logger = LoggerFactory.getLogger(Issue324Test.class);
+ logger.debug("hello");
+ }
+}
diff --git a/integration/src/test/java/org/slf4j/test_osgi/BundleTest.java b/integration/src/test/java/org/slf4j/test_osgi/BundleTest.java
index 9cb70a6..920f228 100644
--- a/integration/src/test/java/org/slf4j/test_osgi/BundleTest.java
+++ b/integration/src/test/java/org/slf4j/test_osgi/BundleTest.java
@@ -1,59 +1,59 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.test_osgi;
-
-import java.io.File;
-
-import junit.framework.TestCase;
-
-public class BundleTest extends TestCase {
-
- FrameworkErrorListener fel = new FrameworkErrorListener();
- CheckingBundleListener mbl = new CheckingBundleListener();
-
- FelixHost felixHost = new FelixHost(fel, mbl);
-
- protected void setUp() throws Exception {
- super.setUp();
- felixHost.doLaunch();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- felixHost.stop();
- }
-
- public void testSmoke() {
- System.out.println("===========" + new File(".").getAbsolutePath());
- mbl.dumpAll();
- // check that the bundle was installed
- assertTrue(mbl.exists("iBundle"));
- if (fel.errorList.size() != 0) {
- fel.dumpAll();
- }
- // check that no errors occured
- assertEquals(0, fel.errorList.size());
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.test_osgi;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+public class BundleTest extends TestCase {
+
+ FrameworkErrorListener fel = new FrameworkErrorListener();
+ CheckingBundleListener mbl = new CheckingBundleListener();
+
+ FelixHost felixHost = new FelixHost(fel, mbl);
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ felixHost.doLaunch();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ felixHost.stop();
+ }
+
+ public void testSmoke() {
+ System.out.println("===========" + new File(".").getAbsolutePath());
+ mbl.dumpAll();
+ // check that the bundle was installed
+ assertTrue(mbl.exists("iBundle"));
+ if (fel.errorList.size() != 0) {
+ fel.dumpAll();
+ }
+ // check that no errors occured
+ assertEquals(0, fel.errorList.size());
+ }
+}
diff --git a/integration/src/test/java/org/slf4j/test_osgi/CheckingBundleListener.java b/integration/src/test/java/org/slf4j/test_osgi/CheckingBundleListener.java
index 2d2f573..ef4a034 100644
--- a/integration/src/test/java/org/slf4j/test_osgi/CheckingBundleListener.java
+++ b/integration/src/test/java/org/slf4j/test_osgi/CheckingBundleListener.java
@@ -1,66 +1,66 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.test_osgi;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-
-public class CheckingBundleListener implements BundleListener {
-
- List eventList = new ArrayList();
-
- public void bundleChanged(BundleEvent be) {
- eventList.add(be);
- }
-
- private void dump(BundleEvent be) {
- System.out.println("BE:" + ", source " + be.getSource() + ", bundle=" + be.getBundle() + ", type=" + be.getType());
-
- }
-
- public void dumpAll() {
- for (int i = 0; i < eventList.size(); i++) {
- BundleEvent fe = (BundleEvent) eventList.get(i);
- dump(fe);
- }
- }
-
- boolean exists(String bundleName) {
- for (int i = 0; i < eventList.size(); i++) {
- BundleEvent fe = (BundleEvent) eventList.get(i);
- Bundle b = fe.getBundle();
- System.out.println("===[" + b + "]");
- if (bundleName.equals(b.getSymbolicName())) {
- return true;
- }
- }
- return false;
- }
-
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.test_osgi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+
+public class CheckingBundleListener implements BundleListener {
+
+ List eventList = new ArrayList();
+
+ public void bundleChanged(BundleEvent be) {
+ eventList.add(be);
+ }
+
+ private void dump(BundleEvent be) {
+ System.out.println("BE:" + ", source " + be.getSource() + ", bundle=" + be.getBundle() + ", type=" + be.getType());
+
+ }
+
+ public void dumpAll() {
+ for (int i = 0; i < eventList.size(); i++) {
+ BundleEvent fe = (BundleEvent) eventList.get(i);
+ dump(fe);
+ }
+ }
+
+ boolean exists(String bundleName) {
+ for (int i = 0; i < eventList.size(); i++) {
+ BundleEvent fe = (BundleEvent) eventList.get(i);
+ Bundle b = fe.getBundle();
+ System.out.println("===[" + b + "]");
+ if (bundleName.equals(b.getSymbolicName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/integration/src/test/java/org/slf4j/test_osgi/FelixHost.java b/integration/src/test/java/org/slf4j/test_osgi/FelixHost.java
index adcd565..c2a655d 100644
--- a/integration/src/test/java/org/slf4j/test_osgi/FelixHost.java
+++ b/integration/src/test/java/org/slf4j/test_osgi/FelixHost.java
@@ -1,119 +1,119 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.test_osgi;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.felix.framework.Felix;
-import org.apache.felix.framework.util.FelixConstants;
-import org.apache.felix.framework.util.StringMap;
-import org.apache.felix.main.AutoProcessor;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-
-/**
- * Runs a hosted version of Felix for testing purposes. Any bundle errors are
- * reported via the FrameworkListener passed to the constructor.
- *
- * @author Ceki Gülcü
- */
-public class FelixHost {
-
- private Felix felix = null;
-
- Properties otherProps = new Properties();
-
- final FrameworkErrorListener frameworkErrorListener;
- final CheckingBundleListener myBundleListener;
-
- public FelixHost(FrameworkErrorListener frameworkErrorListener, CheckingBundleListener myBundleListener) {
- this.frameworkErrorListener = frameworkErrorListener;
- this.myBundleListener = myBundleListener;
- }
-
- public void doLaunch() {
- // Create a case-insensitive configuration property map.
- StringMap configMap = new StringMap();
- // Configure the Felix instance to be embedded.
- // configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
- // Add core OSGi packages to be exported from the class path
- // via the system bundle.
- configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES, "org.osgi.framework; version=1.3.0," + "org.osgi.service.packageadmin; version=1.2.0,"
- + "org.osgi.service.startlevel; version=1.0.0," + "org.osgi.service.url; version=1.0.0");
-
- configMap.put(Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);
-
- // Explicitly specify the directory to use for caching bundles.
- // configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "cache");
-
- try {
- // Create host activator;
-
- List
- *
- *
Performance is often a logging concern.
- * By examining the appropriate property,
- * a component can avoid expensive operations (producing information
- * to be logged).
- *
- *
For example,
- *
- * if (log.isDebugEnabled()) {
- * ... do something expensive ...
- * log.debug(theResult);
- * }
- *
- *
- *
- *
Configuration of the underlying logging system will generally be done
- * external to the Logging APIs, through whatever mechanism is supported by
- * that system.
- *
- *
Please note that this interface is identical to that found in JCL 1.1.1.
- *
- * @param message log this message
- * @param t log this cause
- */
- public void fatal(Object message, Throwable t);
-
-}
+/*
+ * 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.commons.logging;
+
+/**
+ *
A simple logging interface abstracting logging APIs. In order to be
+ * instantiated successfully by {@link LogFactory}, classes that implement
+ * this interface must have a constructor that takes a single String
+ * parameter representing the "name" of this Log.
+ *
+ *
The six logging levels used by Log are (in order):
+ *
+ *
trace (the least serious)
+ *
debug
+ *
info
+ *
warn
+ *
error
+ *
fatal (the most serious)
+ *
+ * The mapping of these log levels to the concepts used by the underlying
+ * logging system is implementation dependent.
+ * The implementation should ensure, though, that this ordering behaves
+ * as expected.
+ *
+ *
Performance is often a logging concern.
+ * By examining the appropriate property,
+ * a component can avoid expensive operations (producing information
+ * to be logged).
+ *
+ *
For example,
+ *
+ * if (log.isDebugEnabled()) {
+ * ... do something expensive ...
+ * log.debug(theResult);
+ * }
+ *
+ *
+ *
+ *
Configuration of the underlying logging system will generally be done
+ * external to the Logging APIs, through whatever mechanism is supported by
+ * that system.
+ *
+ *
Please note that this interface is identical to that found in JCL 1.1.1.
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ public void fatal(Object message, Throwable t);
+
+}
diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogConfigurationException.java b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogConfigurationException.java
index c61bf4a..668f413 100644
--- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogConfigurationException.java
+++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogConfigurationException.java
@@ -1,93 +1,93 @@
-/*
- * 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.commons.logging;
-
-/**
- *
- * An exception that is thrown only if a suitable LogFactory or
- * Log instance cannot be created by the corresponding factory
- * methods.
- *
- *
- *
- * In this version of JCL, this exception will never be thrown in practice.
- * However, it is included here to ensure total compile time and run time
- * compatibility with the original JCL 1.0.4.
- *
- * @author Craig R. McClanahan
- */
-
-public class LogConfigurationException extends RuntimeException {
-
- private static final long serialVersionUID = 8486587136871052495L;
-
- /**
- * Construct a new exception with null as its detail message.
- */
- public LogConfigurationException() {
- super();
- }
-
- /**
- * Construct a new exception with the specified detail message.
- *
- * @param message
- * The detail message
- */
- public LogConfigurationException(String message) {
- super(message);
- }
-
- /**
- * Construct a new exception with the specified cause and a derived detail
- * message.
- *
- * @param cause
- * The underlying cause
- */
- public LogConfigurationException(Throwable cause) {
-
- this((cause == null) ? null : cause.toString(), cause);
-
- }
-
- /**
- * Construct a new exception with the specified detail message and cause.
- *
- * @param message
- * The detail message
- * @param cause
- * The underlying cause
- */
- public LogConfigurationException(String message, Throwable cause) {
- super(message + " (Caused by " + cause + ")");
- this.cause = cause; // Two-argument version requires JDK 1.4 or later
- }
-
- /**
- * The underlying cause of this exception.
- */
- protected Throwable cause = null;
-
- /**
- * Return the underlying cause of this exception (if any).
- */
- public Throwable getCause() {
- return (this.cause);
- }
-
-}
+/*
+ * 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.commons.logging;
+
+/**
+ *
+ * An exception that is thrown only if a suitable LogFactory or
+ * Log instance cannot be created by the corresponding factory
+ * methods.
+ *
+ *
+ *
+ * In this version of JCL, this exception will never be thrown in practice.
+ * However, it is included here to ensure total compile time and run time
+ * compatibility with the original JCL 1.0.4.
+ *
+ * @author Craig R. McClanahan
+ */
+
+public class LogConfigurationException extends RuntimeException {
+
+ private static final long serialVersionUID = 8486587136871052495L;
+
+ /**
+ * Construct a new exception with null as its detail message.
+ */
+ public LogConfigurationException() {
+ super();
+ }
+
+ /**
+ * Construct a new exception with the specified detail message.
+ *
+ * @param message
+ * The detail message
+ */
+ public LogConfigurationException(String message) {
+ super(message);
+ }
+
+ /**
+ * Construct a new exception with the specified cause and a derived detail
+ * message.
+ *
+ * @param cause
+ * The underlying cause
+ */
+ public LogConfigurationException(Throwable cause) {
+
+ this((cause == null) ? null : cause.toString(), cause);
+
+ }
+
+ /**
+ * Construct a new exception with the specified detail message and cause.
+ *
+ * @param message
+ * The detail message
+ * @param cause
+ * The underlying cause
+ */
+ public LogConfigurationException(String message, Throwable cause) {
+ super(message + " (Caused by " + cause + ")");
+ this.cause = cause; // Two-argument version requires JDK 1.4 or later
+ }
+
+ /**
+ * The underlying cause of this exception.
+ */
+ protected Throwable cause = null;
+
+ /**
+ * Return the underlying cause of this exception (if any).
+ */
+ public Throwable getCause() {
+ return (this.cause);
+ }
+
+}
diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogFactory.java b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogFactory.java
index 5745d3e..313adef 100644
--- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogFactory.java
+++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogFactory.java
@@ -1,408 +1,408 @@
-/*
- * 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.commons.logging;
-
-import java.util.Hashtable;
-
-import org.apache.commons.logging.impl.SLF4JLogFactory;
-
-/**
- *
- * Factory for creating {@link Log} instances, which always delegates to an
- * instance of {@link SLF4JLogFactory}.
- *
- *
- *
- * @author Craig R. McClanahan
- * @author Costin Manolache
- * @author Richard A. Sitze
- * @author Ceki Gülcü
- */
-
-@SuppressWarnings("rawtypes")
-public abstract class LogFactory {
-
- static String UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J = "http://www.slf4j.org/codes.html#unsupported_operation_in_jcl_over_slf4j";
-
- static LogFactory logFactory = new SLF4JLogFactory();
-
- /**
- * The name (priority) of the key in the config file used to
- * specify the priority of that particular config file. The associated value
- * is a floating-point number; higher values take priority over lower values.
- *
- *
- * This property is not used but preserved here for compatibility.
- */
- public static final String PRIORITY_KEY = "priority";
-
- /**
- * The name (use_tccl) of the key in the config file used to
- * specify whether logging classes should be loaded via the thread context
- * class loader (TCCL), or not. By default, the TCCL is used.
- *
- *
- * This property is not used but preserved here for compatibility.
- */
- public static final String TCCL_KEY = "use_tccl";
-
- /**
- * The name of the property used to identify the LogFactory implementation
- * class name.
- *
- * This property is not used but preserved here for compatibility.
- */
- public static final String FACTORY_PROPERTY = "org.apache.commons.logging.LogFactory";
-
- /**
- * The fully qualified class name of the fallback LogFactory
- * implementation class to use, if no other can be found.
- *
- *
- * This property is not used but preserved here for compatibility.
- */
- public static final String FACTORY_DEFAULT = "org.apache.commons.logging.impl.SLF4JLogFactory";
-
- /**
- * The name of the properties file to search for.
- *
- * This property is not used but preserved here for compatibility.
- */
- public static final String FACTORY_PROPERTIES = "commons-logging.properties";
-
- /**
- * JDK1.3+
- * 'Service Provider' specification.
- *
- * This property is not used but preserved here for compatibility.
- */
- protected static final String SERVICE_ID = "META-INF/services/org.apache.commons.logging.LogFactory";
-
- /**
- * The name (org.apache.commons.logging.diagnostics.dest) of
- * the property used to enable internal commons-logging diagnostic output, in
- * order to get information on what logging implementations are being
- * discovered, what classloaders they are loaded through, etc.
- *
- *
- * This property is not used but preserved here for compatibility.
- */
- public static final String DIAGNOSTICS_DEST_PROPERTY = "org.apache.commons.logging.diagnostics.dest";
-
- /**
- *
- * Setting this system property value allows the Hashtable used
- * to store classloaders to be substituted by an alternative implementation.
- *
- * This property is not used but preserved here for compatibility.
- */
- public static final String HASHTABLE_IMPLEMENTATION_PROPERTY = "org.apache.commons.logging.LogFactory.HashtableImpl";
-
- /**
- * The previously constructed LogFactory instances, keyed by
- * the ClassLoader with which it was created.
- *
- *
- * This property is not used but preserved here for compatibility.
- */
- protected static Hashtable factories = null;
-
- /**
- *
- * This property is not used but preserved here for compatibility.
- */
- protected static LogFactory nullClassLoaderFactory = null;
-
- /**
- * Protected constructor that is not available for public use.
- */
- protected LogFactory() {
- }
-
- // --------------------------------------------------------- Public Methods
-
- /**
- * Return the configuration attribute with the specified name (if any), or
- * null if there is no such attribute.
- *
- * @param name Name of the attribute to return
- * @return configuration attribute
- */
- public abstract Object getAttribute(String name);
-
- /**
- * Return an array containing the names of all currently defined configuration
- * attributes. If there are no such attributes, a zero length array is
- * returned.
- *
- * @return names of all currently defined configuration attributes
- */
- public abstract String[] getAttributeNames();
-
- /**
- * Convenience method to derive a name from the specified class and call
- * getInstance(String) with it.
- *
- * @param clazz
- * Class for which a suitable Log name will be derived
- *
- * @exception LogConfigurationException
- * if a suitable Log instance cannot be
- * returned
- */
- public abstract Log getInstance(Class clazz) throws LogConfigurationException;
-
- /**
- *
- * Construct (if necessary) and return a Log instance, using
- * the factory's current set of configuration attributes.
- *
- *
- *
- * NOTE - Depending upon the implementation of the
- * LogFactory you are using, the Log instance
- * you are returned may or may not be local to the current application, and
- * may or may not be returned again on a subsequent call with the same name
- * argument.
- *
- *
- * @param name
- * Logical name of the Log instance to be
- * returned (the meaning of this name is only known to the
- * underlying logging implementation that is being wrapped)
- *
- * @exception LogConfigurationException
- * if a suitable Log instance cannot be
- * returned
- */
- public abstract Log getInstance(String name) throws LogConfigurationException;
-
- /**
- * Release any internal references to previously created {@link Log}instances
- * returned by this factory. This is useful in environments like servlet
- * containers, which implement application reloading by throwing away a
- * ClassLoader. Dangling references to objects in that class loader would
- * prevent garbage collection.
- */
- public abstract void release();
-
- /**
- * Remove any configuration attribute associated with the specified name. If
- * there is no such attribute, no action is taken.
- *
- * @param name
- * Name of the attribute to remove
- */
- public abstract void removeAttribute(String name);
-
- /**
- * Set the configuration attribute with the specified name. Calling this with
- * a null value is equivalent to calling
- * removeAttribute(name).
- *
- * @param name
- * Name of the attribute to set
- * @param value
- * Value of the attribute to set, or null to
- * remove any setting for this attribute
- */
- public abstract void setAttribute(String name, Object value);
-
- // --------------------------------------------------------- Static Methods
-
- /**
- *
- * Construct (if necessary) and return a LogFactory instance,
- * using the following ordered lookup procedure to determine the name of the
- * implementation class to be loaded.
- *
- *
- *
The org.apache.commons.logging.LogFactory system
- * property.
- *
The JDK 1.3 Service Discovery mechanism
- *
Use the properties file commons-logging.properties
- * file, if found in the class path of this class. The configuration file is
- * in standard java.util.Properties format and contains the
- * fully qualified name of the implementation class with the key being the
- * system property defined above.
- *
Fall back to a default implementation class (
- * org.apache.commons.logging.impl.SLF4FLogFactory).
- *
- *
- *
- * NOTE- If the properties file method of identifying the
- * LogFactory implementation class is utilized, all of the
- * properties defined in this file will be set as configuration attributes on
- * the corresponding LogFactory instance.
- *
- *
- * @exception LogConfigurationException
- * if the implementation class is not available or cannot
- * be instantiated.
- */
- public static LogFactory getFactory() throws LogConfigurationException {
- return logFactory;
- }
-
- /**
- * Convenience method to return a named logger, without the application having
- * to care about factories.
- *
- * @param clazz
- * Class from which a log name will be derived
- *
- * @exception LogConfigurationException
- * if a suitable Log instance cannot be
- * returned
- */
- public static Log getLog(Class clazz) throws LogConfigurationException {
- return (getFactory().getInstance(clazz));
- }
-
- /**
- * Convenience method to return a named logger, without the application having
- * to care about factories.
- *
- * @param name
- * Logical name of the Log instance to be
- * returned (the meaning of this name is only known to the
- * underlying logging implementation that is being wrapped)
- *
- * @exception LogConfigurationException
- * if a suitable Log instance cannot be
- * returned
- */
- public static Log getLog(String name) throws LogConfigurationException {
- return (getFactory().getInstance(name));
- }
-
- /**
- * Release any internal references to previously created {@link LogFactory}
- * instances that have been associated with the specified class loader (if
- * any), after calling the instance method release() on each of
- * them.
- *
- * @param classLoader
- * ClassLoader for which to release the LogFactory
- */
- public static void release(ClassLoader classLoader) {
- // since SLF4J based JCL does not make use of classloaders, there is nothing
- // to do here
- }
-
- /**
- * Release any internal references to previously created {@link LogFactory}
- * instances, after calling the instance method release() on
- * each of them. This is useful in environments like servlet containers, which
- * implement application reloading by throwing away a ClassLoader. Dangling
- * references to objects in that class loader would prevent garbage
- * collection.
- */
- public static void releaseAll() {
- // since SLF4J based JCL does not make use of classloaders, there is nothing
- // to do here
- }
-
- /**
- * Returns a string that uniquely identifies the specified object, including
- * its class.
- *
- * The returned string is of form "classname@hashcode", i.e. is the same as the
- * return value of the Object.toString() method, but works even when the
- * specified object's class has overridden the toString method.
- *
- * @param o
- * may be null.
- * @return a string of form classname@hashcode, or "null" if param o is null.
- * @since 1.1
- */
- public static String objectId(Object o) {
- if (o == null) {
- return "null";
- } else {
- return o.getClass().getName() + "@" + System.identityHashCode(o);
- }
- }
-
- // protected methods which were added in JCL 1.1. These are not used
- // by SLF4JLogFactory
-
- /**
- * This method exists to ensure signature compatibility.
- */
- protected static Object createFactory(String factoryClass, ClassLoader classLoader) {
- throw new UnsupportedOperationException("Operation [factoryClass] is not supported in jcl-over-slf4j. See also "
- + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
- }
-
- /**
- * This method exists to ensure signature compatibility.
- */
- protected static ClassLoader directGetContextClassLoader() {
- throw new UnsupportedOperationException("Operation [directGetContextClassLoader] is not supported in jcl-over-slf4j. See also "
- + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
- }
-
- /**
- * This method exists to ensure signature compatibility.
- */
- protected static ClassLoader getContextClassLoader() throws LogConfigurationException {
- throw new UnsupportedOperationException("Operation [getContextClassLoader] is not supported in jcl-over-slf4j. See also "
- + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
- }
-
- /**
- * This method exists to ensure signature compatibility.
- */
- protected static ClassLoader getClassLoader(Class clazz) {
- throw new UnsupportedOperationException("Operation [getClassLoader] is not supported in jcl-over-slf4j. See also "
- + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
- }
-
- /**
- * This method exists to ensure signature compatibility.
- */
- protected static boolean isDiagnosticsEnabled() {
- throw new UnsupportedOperationException("Operation [isDiagnosticsEnabled] is not supported in jcl-over-slf4j. See also "
- + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
- }
-
- /**
- * This method exists to ensure signature compatibility.
- */
- protected static void logRawDiagnostic(String msg) {
- throw new UnsupportedOperationException("Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also "
- + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
- }
-
- /**
- * This method exists to ensure signature compatibility.
- */
- protected static LogFactory newFactory(final String factoryClass, final ClassLoader classLoader, final ClassLoader contextClassLoader) {
- throw new UnsupportedOperationException("Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also "
- + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
- }
-
- /**
- * This method exists to ensure signature compatibility.
- */
- protected static LogFactory newFactory(final String factoryClass, final ClassLoader classLoader) {
- throw new UnsupportedOperationException("Operation [newFactory] is not supported in jcl-over-slf4j. See also "
- + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
- }
-
+/*
+ * 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.commons.logging;
+
+import java.util.Hashtable;
+
+import org.apache.commons.logging.impl.SLF4JLogFactory;
+
+/**
+ *
+ * Factory for creating {@link Log} instances, which always delegates to an
+ * instance of {@link SLF4JLogFactory}.
+ *
+ *
+ *
+ * @author Craig R. McClanahan
+ * @author Costin Manolache
+ * @author Richard A. Sitze
+ * @author Ceki Gülcü
+ */
+
+@SuppressWarnings("rawtypes")
+public abstract class LogFactory {
+
+ static String UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J = "http://www.slf4j.org/codes.html#unsupported_operation_in_jcl_over_slf4j";
+
+ static LogFactory logFactory = new SLF4JLogFactory();
+
+ /**
+ * The name (priority) of the key in the config file used to
+ * specify the priority of that particular config file. The associated value
+ * is a floating-point number; higher values take priority over lower values.
+ *
+ *
+ * This property is not used but preserved here for compatibility.
+ */
+ public static final String PRIORITY_KEY = "priority";
+
+ /**
+ * The name (use_tccl) of the key in the config file used to
+ * specify whether logging classes should be loaded via the thread context
+ * class loader (TCCL), or not. By default, the TCCL is used.
+ *
+ *
+ * This property is not used but preserved here for compatibility.
+ */
+ public static final String TCCL_KEY = "use_tccl";
+
+ /**
+ * The name of the property used to identify the LogFactory implementation
+ * class name.
+ *
+ * This property is not used but preserved here for compatibility.
+ */
+ public static final String FACTORY_PROPERTY = "org.apache.commons.logging.LogFactory";
+
+ /**
+ * The fully qualified class name of the fallback LogFactory
+ * implementation class to use, if no other can be found.
+ *
+ *
+ * This property is not used but preserved here for compatibility.
+ */
+ public static final String FACTORY_DEFAULT = "org.apache.commons.logging.impl.SLF4JLogFactory";
+
+ /**
+ * The name of the properties file to search for.
+ *
+ * This property is not used but preserved here for compatibility.
+ */
+ public static final String FACTORY_PROPERTIES = "commons-logging.properties";
+
+ /**
+ * JDK1.3+
+ * 'Service Provider' specification.
+ *
+ * This property is not used but preserved here for compatibility.
+ */
+ protected static final String SERVICE_ID = "META-INF/services/org.apache.commons.logging.LogFactory";
+
+ /**
+ * The name (org.apache.commons.logging.diagnostics.dest) of
+ * the property used to enable internal commons-logging diagnostic output, in
+ * order to get information on what logging implementations are being
+ * discovered, what classloaders they are loaded through, etc.
+ *
+ *
+ * This property is not used but preserved here for compatibility.
+ */
+ public static final String DIAGNOSTICS_DEST_PROPERTY = "org.apache.commons.logging.diagnostics.dest";
+
+ /**
+ *
+ * Setting this system property value allows the Hashtable used
+ * to store classloaders to be substituted by an alternative implementation.
+ *
+ * This property is not used but preserved here for compatibility.
+ */
+ public static final String HASHTABLE_IMPLEMENTATION_PROPERTY = "org.apache.commons.logging.LogFactory.HashtableImpl";
+
+ /**
+ * The previously constructed LogFactory instances, keyed by
+ * the ClassLoader with which it was created.
+ *
+ *
+ * This property is not used but preserved here for compatibility.
+ */
+ protected static Hashtable factories = null;
+
+ /**
+ *
+ * This property is not used but preserved here for compatibility.
+ */
+ protected static LogFactory nullClassLoaderFactory = null;
+
+ /**
+ * Protected constructor that is not available for public use.
+ */
+ protected LogFactory() {
+ }
+
+ // --------------------------------------------------------- Public Methods
+
+ /**
+ * Return the configuration attribute with the specified name (if any), or
+ * null if there is no such attribute.
+ *
+ * @param name Name of the attribute to return
+ * @return configuration attribute
+ */
+ public abstract Object getAttribute(String name);
+
+ /**
+ * Return an array containing the names of all currently defined configuration
+ * attributes. If there are no such attributes, a zero length array is
+ * returned.
+ *
+ * @return names of all currently defined configuration attributes
+ */
+ public abstract String[] getAttributeNames();
+
+ /**
+ * Convenience method to derive a name from the specified class and call
+ * getInstance(String) with it.
+ *
+ * @param clazz
+ * Class for which a suitable Log name will be derived
+ *
+ * @exception LogConfigurationException
+ * if a suitable Log instance cannot be
+ * returned
+ */
+ public abstract Log getInstance(Class clazz) throws LogConfigurationException;
+
+ /**
+ *
+ * Construct (if necessary) and return a Log instance, using
+ * the factory's current set of configuration attributes.
+ *
+ *
+ *
+ * NOTE - Depending upon the implementation of the
+ * LogFactory you are using, the Log instance
+ * you are returned may or may not be local to the current application, and
+ * may or may not be returned again on a subsequent call with the same name
+ * argument.
+ *
+ *
+ * @param name
+ * Logical name of the Log instance to be
+ * returned (the meaning of this name is only known to the
+ * underlying logging implementation that is being wrapped)
+ *
+ * @exception LogConfigurationException
+ * if a suitable Log instance cannot be
+ * returned
+ */
+ public abstract Log getInstance(String name) throws LogConfigurationException;
+
+ /**
+ * Release any internal references to previously created {@link Log}instances
+ * returned by this factory. This is useful in environments like servlet
+ * containers, which implement application reloading by throwing away a
+ * ClassLoader. Dangling references to objects in that class loader would
+ * prevent garbage collection.
+ */
+ public abstract void release();
+
+ /**
+ * Remove any configuration attribute associated with the specified name. If
+ * there is no such attribute, no action is taken.
+ *
+ * @param name
+ * Name of the attribute to remove
+ */
+ public abstract void removeAttribute(String name);
+
+ /**
+ * Set the configuration attribute with the specified name. Calling this with
+ * a null value is equivalent to calling
+ * removeAttribute(name).
+ *
+ * @param name
+ * Name of the attribute to set
+ * @param value
+ * Value of the attribute to set, or null to
+ * remove any setting for this attribute
+ */
+ public abstract void setAttribute(String name, Object value);
+
+ // --------------------------------------------------------- Static Methods
+
+ /**
+ *
+ * Construct (if necessary) and return a LogFactory instance,
+ * using the following ordered lookup procedure to determine the name of the
+ * implementation class to be loaded.
+ *
+ *
+ *
The org.apache.commons.logging.LogFactory system
+ * property.
+ *
The JDK 1.3 Service Discovery mechanism
+ *
Use the properties file commons-logging.properties
+ * file, if found in the class path of this class. The configuration file is
+ * in standard java.util.Properties format and contains the
+ * fully qualified name of the implementation class with the key being the
+ * system property defined above.
+ *
Fall back to a default implementation class (
+ * org.apache.commons.logging.impl.SLF4FLogFactory).
+ *
+ *
+ *
+ * NOTE- If the properties file method of identifying the
+ * LogFactory implementation class is utilized, all of the
+ * properties defined in this file will be set as configuration attributes on
+ * the corresponding LogFactory instance.
+ *
+ *
+ * @exception LogConfigurationException
+ * if the implementation class is not available or cannot
+ * be instantiated.
+ */
+ public static LogFactory getFactory() throws LogConfigurationException {
+ return logFactory;
+ }
+
+ /**
+ * Convenience method to return a named logger, without the application having
+ * to care about factories.
+ *
+ * @param clazz
+ * Class from which a log name will be derived
+ *
+ * @exception LogConfigurationException
+ * if a suitable Log instance cannot be
+ * returned
+ */
+ public static Log getLog(Class clazz) throws LogConfigurationException {
+ return (getFactory().getInstance(clazz));
+ }
+
+ /**
+ * Convenience method to return a named logger, without the application having
+ * to care about factories.
+ *
+ * @param name
+ * Logical name of the Log instance to be
+ * returned (the meaning of this name is only known to the
+ * underlying logging implementation that is being wrapped)
+ *
+ * @exception LogConfigurationException
+ * if a suitable Log instance cannot be
+ * returned
+ */
+ public static Log getLog(String name) throws LogConfigurationException {
+ return (getFactory().getInstance(name));
+ }
+
+ /**
+ * Release any internal references to previously created {@link LogFactory}
+ * instances that have been associated with the specified class loader (if
+ * any), after calling the instance method release() on each of
+ * them.
+ *
+ * @param classLoader
+ * ClassLoader for which to release the LogFactory
+ */
+ public static void release(ClassLoader classLoader) {
+ // since SLF4J based JCL does not make use of classloaders, there is nothing
+ // to do here
+ }
+
+ /**
+ * Release any internal references to previously created {@link LogFactory}
+ * instances, after calling the instance method release() on
+ * each of them. This is useful in environments like servlet containers, which
+ * implement application reloading by throwing away a ClassLoader. Dangling
+ * references to objects in that class loader would prevent garbage
+ * collection.
+ */
+ public static void releaseAll() {
+ // since SLF4J based JCL does not make use of classloaders, there is nothing
+ // to do here
+ }
+
+ /**
+ * Returns a string that uniquely identifies the specified object, including
+ * its class.
+ *
+ * The returned string is of form "classname@hashcode", i.e. is the same as the
+ * return value of the Object.toString() method, but works even when the
+ * specified object's class has overridden the toString method.
+ *
+ * @param o
+ * may be null.
+ * @return a string of form classname@hashcode, or "null" if param o is null.
+ * @since 1.1
+ */
+ public static String objectId(Object o) {
+ if (o == null) {
+ return "null";
+ } else {
+ return o.getClass().getName() + "@" + System.identityHashCode(o);
+ }
+ }
+
+ // protected methods which were added in JCL 1.1. These are not used
+ // by SLF4JLogFactory
+
+ /**
+ * This method exists to ensure signature compatibility.
+ */
+ protected static Object createFactory(String factoryClass, ClassLoader classLoader) {
+ throw new UnsupportedOperationException("Operation [factoryClass] is not supported in jcl-over-slf4j. See also "
+ + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
+ }
+
+ /**
+ * This method exists to ensure signature compatibility.
+ */
+ protected static ClassLoader directGetContextClassLoader() {
+ throw new UnsupportedOperationException("Operation [directGetContextClassLoader] is not supported in jcl-over-slf4j. See also "
+ + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
+ }
+
+ /**
+ * This method exists to ensure signature compatibility.
+ */
+ protected static ClassLoader getContextClassLoader() throws LogConfigurationException {
+ throw new UnsupportedOperationException("Operation [getContextClassLoader] is not supported in jcl-over-slf4j. See also "
+ + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
+ }
+
+ /**
+ * This method exists to ensure signature compatibility.
+ */
+ protected static ClassLoader getClassLoader(Class clazz) {
+ throw new UnsupportedOperationException("Operation [getClassLoader] is not supported in jcl-over-slf4j. See also "
+ + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
+ }
+
+ /**
+ * This method exists to ensure signature compatibility.
+ */
+ protected static boolean isDiagnosticsEnabled() {
+ throw new UnsupportedOperationException("Operation [isDiagnosticsEnabled] is not supported in jcl-over-slf4j. See also "
+ + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
+ }
+
+ /**
+ * This method exists to ensure signature compatibility.
+ */
+ protected static void logRawDiagnostic(String msg) {
+ throw new UnsupportedOperationException("Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also "
+ + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
+ }
+
+ /**
+ * This method exists to ensure signature compatibility.
+ */
+ protected static LogFactory newFactory(final String factoryClass, final ClassLoader classLoader, final ClassLoader contextClassLoader) {
+ throw new UnsupportedOperationException("Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also "
+ + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
+ }
+
+ /**
+ * This method exists to ensure signature compatibility.
+ */
+ protected static LogFactory newFactory(final String factoryClass, final ClassLoader classLoader) {
+ throw new UnsupportedOperationException("Operation [newFactory] is not supported in jcl-over-slf4j. See also "
+ + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
+ }
+
}diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/NoOpLog.java b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/NoOpLog.java
index c5881b2..45e99a4 100644
--- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/NoOpLog.java
+++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/NoOpLog.java
@@ -1,145 +1,145 @@
-/*
- * 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.commons.logging.impl;
-
-import java.io.Serializable;
-import org.apache.commons.logging.Log;
-
-/**
- *
- * Trivial implementation of Log that throws away all messages. No configurable
- * system properties are supported.
- *
- *
- * @author Scott Sanders
- * @author Rod Waldhoff
- * @version $Id: NoOpLog.java,v 1.8 2004/06/06 21:13:12 rdonkin Exp $
- */
-public class NoOpLog implements Log, Serializable {
- private static final long serialVersionUID = 561423906191706148L;
-
- /** Convenience constructor */
- public NoOpLog() {
- }
-
- /** Base constructor */
- public NoOpLog(String name) {
- }
-
- /** Do nothing */
- public void trace(Object message) {
- }
-
- /** Do nothing */
- public void trace(Object message, Throwable t) {
- }
-
- /** Do nothing */
- public void debug(Object message) {
- }
-
- /** Do nothing */
- public void debug(Object message, Throwable t) {
- }
-
- /** Do nothing */
- public void info(Object message) {
- }
-
- /** Do nothing */
- public void info(Object message, Throwable t) {
- }
-
- /** Do nothing */
- public void warn(Object message) {
- }
-
- /** Do nothing */
- public void warn(Object message, Throwable t) {
- }
-
- /** Do nothing */
- public void error(Object message) {
- }
-
- /** Do nothing */
- public void error(Object message, Throwable t) {
- }
-
- /** Do nothing */
- public void fatal(Object message) {
- }
-
- /** Do nothing */
- public void fatal(Object message, Throwable t) {
- }
-
- /**
- * Debug is never enabled.
- *
- * @return false
- */
- public final boolean isDebugEnabled() {
- return false;
- }
-
- /**
- * Error is never enabled.
- *
- * @return false
- */
- public final boolean isErrorEnabled() {
- return false;
- }
-
- /**
- * Fatal is never enabled.
- *
- * @return false
- */
- public final boolean isFatalEnabled() {
- return false;
- }
-
- /**
- * Info is never enabled.
- *
- * @return false
- */
- public final boolean isInfoEnabled() {
- return false;
- }
-
- /**
- * Trace is never enabled.
- *
- * @return false
- */
- public final boolean isTraceEnabled() {
- return false;
- }
-
- /**
- * Warn is never enabled.
- *
- * @return false
- */
- public final boolean isWarnEnabled() {
- return false;
- }
-
-}
+/*
+ * 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.commons.logging.impl;
+
+import java.io.Serializable;
+import org.apache.commons.logging.Log;
+
+/**
+ *
+ * Trivial implementation of Log that throws away all messages. No configurable
+ * system properties are supported.
+ *
+ *
+ * @author Scott Sanders
+ * @author Rod Waldhoff
+ * @version $Id: NoOpLog.java,v 1.8 2004/06/06 21:13:12 rdonkin Exp $
+ */
+public class NoOpLog implements Log, Serializable {
+ private static final long serialVersionUID = 561423906191706148L;
+
+ /** Convenience constructor */
+ public NoOpLog() {
+ }
+
+ /** Base constructor */
+ public NoOpLog(String name) {
+ }
+
+ /** Do nothing */
+ public void trace(Object message) {
+ }
+
+ /** Do nothing */
+ public void trace(Object message, Throwable t) {
+ }
+
+ /** Do nothing */
+ public void debug(Object message) {
+ }
+
+ /** Do nothing */
+ public void debug(Object message, Throwable t) {
+ }
+
+ /** Do nothing */
+ public void info(Object message) {
+ }
+
+ /** Do nothing */
+ public void info(Object message, Throwable t) {
+ }
+
+ /** Do nothing */
+ public void warn(Object message) {
+ }
+
+ /** Do nothing */
+ public void warn(Object message, Throwable t) {
+ }
+
+ /** Do nothing */
+ public void error(Object message) {
+ }
+
+ /** Do nothing */
+ public void error(Object message, Throwable t) {
+ }
+
+ /** Do nothing */
+ public void fatal(Object message) {
+ }
+
+ /** Do nothing */
+ public void fatal(Object message, Throwable t) {
+ }
+
+ /**
+ * Debug is never enabled.
+ *
+ * @return false
+ */
+ public final boolean isDebugEnabled() {
+ return false;
+ }
+
+ /**
+ * Error is never enabled.
+ *
+ * @return false
+ */
+ public final boolean isErrorEnabled() {
+ return false;
+ }
+
+ /**
+ * Fatal is never enabled.
+ *
+ * @return false
+ */
+ public final boolean isFatalEnabled() {
+ return false;
+ }
+
+ /**
+ * Info is never enabled.
+ *
+ * @return false
+ */
+ public final boolean isInfoEnabled() {
+ return false;
+ }
+
+ /**
+ * Trace is never enabled.
+ *
+ * @return false
+ */
+ public final boolean isTraceEnabled() {
+ return false;
+ }
+
+ /**
+ * Warn is never enabled.
+ *
+ * @return false
+ */
+ public final boolean isWarnEnabled() {
+ return false;
+ }
+
+}
diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLocationAwareLog.java b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLocationAwareLog.java
index 6c712b8..ef48be6 100644
--- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLocationAwareLog.java
+++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLocationAwareLog.java
@@ -1,254 +1,254 @@
-/*
- * 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.commons.logging.impl;
-
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-
-import org.apache.commons.logging.Log;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.spi.LocationAwareLogger;
-
-/**
- * Implementation of {@link Log org.apache.commons.logging.Log} interface which
- * delegates all processing to a wrapped {@link Logger org.slf4j.Logger}
- * instance.
- *
- *
- * JCL's FATAL level is mapped to ERROR. All other levels map one to one.
- *
- * @author Ceki Gülcü
- */
-public class SLF4JLocationAwareLog implements Log, Serializable {
-
- private static final long serialVersionUID = -2379157579039314822L;
-
- // used to store this logger's name to recreate it after serialization
- protected String name;
-
- // in both Log4jLogger and Jdk14Logger classes in the original JCL, the
- // logger instance is transient
- private transient LocationAwareLogger logger;
-
- private static final String FQCN = SLF4JLocationAwareLog.class.getName();
-
- SLF4JLocationAwareLog(LocationAwareLogger logger) {
- this.logger = logger;
- this.name = logger.getName();
- }
-
- /**
- * Delegates to the isTraceEnabled method of the wrapped
- * org.slf4j.Logger instance.
- */
- public boolean isTraceEnabled() {
- return logger.isTraceEnabled();
- }
-
- /**
- * Directly delegates to the wrapped org.slf4j.Logger instance.
- */
- public boolean isDebugEnabled() {
- return logger.isDebugEnabled();
- }
-
- /**
- * Directly delegates to the wrapped org.slf4j.Logger instance.
- */
- public boolean isInfoEnabled() {
- return logger.isInfoEnabled();
- }
-
- /**
- * Directly delegates to the wrapped org.slf4j.Logger instance.
- */
- public boolean isWarnEnabled() {
- return logger.isWarnEnabled();
- }
-
- /**
- * Directly delegates to the wrapped org.slf4j.Logger instance.
- */
- public boolean isErrorEnabled() {
- return logger.isErrorEnabled();
- }
-
- /**
- * Delegates to the isErrorEnabled method of the wrapped
- * org.slf4j.Logger instance.
- */
- public boolean isFatalEnabled() {
- return logger.isErrorEnabled();
- }
-
- /**
- * Converts the input parameter to String and then delegates to the debug
- * method of the wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void trace(Object message) {
- logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(message), null, null);
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * debug method of the wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void trace(Object message, Throwable t) {
- logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(message), null, t);
- }
-
- /**
- * Converts the input parameter to String and then delegates to the wrapped
- * org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void debug(Object message) {
- logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(message), null, null);
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void debug(Object message, Throwable t) {
- logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(message), null, t);
- }
-
- /**
- * Converts the input parameter to String and then delegates to the wrapped
- * org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void info(Object message) {
- logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(message), null, null);
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void info(Object message, Throwable t) {
- logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(message), null, t);
- }
-
- /**
- * Converts the input parameter to String and then delegates to the wrapped
- * org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void warn(Object message) {
- logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(message), null, null);
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void warn(Object message, Throwable t) {
- logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(message), null, t);
- }
-
- /**
- * Converts the input parameter to String and then delegates to the wrapped
- * org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void error(Object message) {
- logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, null);
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void error(Object message, Throwable t) {
- logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, t);
- }
-
- /**
- * Converts the input parameter to String and then delegates to the error
- * method of the wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void fatal(Object message) {
- logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, null);
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * error method of the wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void fatal(Object message, Throwable t) {
- logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, t);
- }
-
- /**
- * Replace this instance with a homonymous (same name) logger returned by
- * LoggerFactory. Note that this method is only called during deserialization.
- *
- * @return logger with same name as returned by LoggerFactory
- * @throws ObjectStreamException
- */
- protected Object readResolve() throws ObjectStreamException {
- Logger logger = LoggerFactory.getLogger(this.name);
- return new SLF4JLocationAwareLog((LocationAwareLogger) logger);
- }
+/*
+ * 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.commons.logging.impl;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.spi.LocationAwareLogger;
+
+/**
+ * Implementation of {@link Log org.apache.commons.logging.Log} interface which
+ * delegates all processing to a wrapped {@link Logger org.slf4j.Logger}
+ * instance.
+ *
+ *
+ * JCL's FATAL level is mapped to ERROR. All other levels map one to one.
+ *
+ * @author Ceki Gülcü
+ */
+public class SLF4JLocationAwareLog implements Log, Serializable {
+
+ private static final long serialVersionUID = -2379157579039314822L;
+
+ // used to store this logger's name to recreate it after serialization
+ protected String name;
+
+ // in both Log4jLogger and Jdk14Logger classes in the original JCL, the
+ // logger instance is transient
+ private transient LocationAwareLogger logger;
+
+ private static final String FQCN = SLF4JLocationAwareLog.class.getName();
+
+ SLF4JLocationAwareLog(LocationAwareLogger logger) {
+ this.logger = logger;
+ this.name = logger.getName();
+ }
+
+ /**
+ * Delegates to the isTraceEnabled method of the wrapped
+ * org.slf4j.Logger instance.
+ */
+ public boolean isTraceEnabled() {
+ return logger.isTraceEnabled();
+ }
+
+ /**
+ * Directly delegates to the wrapped org.slf4j.Logger instance.
+ */
+ public boolean isDebugEnabled() {
+ return logger.isDebugEnabled();
+ }
+
+ /**
+ * Directly delegates to the wrapped org.slf4j.Logger instance.
+ */
+ public boolean isInfoEnabled() {
+ return logger.isInfoEnabled();
+ }
+
+ /**
+ * Directly delegates to the wrapped org.slf4j.Logger instance.
+ */
+ public boolean isWarnEnabled() {
+ return logger.isWarnEnabled();
+ }
+
+ /**
+ * Directly delegates to the wrapped org.slf4j.Logger instance.
+ */
+ public boolean isErrorEnabled() {
+ return logger.isErrorEnabled();
+ }
+
+ /**
+ * Delegates to the isErrorEnabled method of the wrapped
+ * org.slf4j.Logger instance.
+ */
+ public boolean isFatalEnabled() {
+ return logger.isErrorEnabled();
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the debug
+ * method of the wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void trace(Object message) {
+ logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(message), null, null);
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * debug method of the wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void trace(Object message, Throwable t) {
+ logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(message), null, t);
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the wrapped
+ * org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void debug(Object message) {
+ logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(message), null, null);
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void debug(Object message, Throwable t) {
+ logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(message), null, t);
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the wrapped
+ * org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void info(Object message) {
+ logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(message), null, null);
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void info(Object message, Throwable t) {
+ logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(message), null, t);
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the wrapped
+ * org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void warn(Object message) {
+ logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(message), null, null);
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void warn(Object message, Throwable t) {
+ logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(message), null, t);
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the wrapped
+ * org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void error(Object message) {
+ logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, null);
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void error(Object message, Throwable t) {
+ logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, t);
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the error
+ * method of the wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void fatal(Object message) {
+ logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, null);
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * error method of the wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void fatal(Object message, Throwable t) {
+ logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, t);
+ }
+
+ /**
+ * Replace this instance with a homonymous (same name) logger returned by
+ * LoggerFactory. Note that this method is only called during deserialization.
+ *
+ * @return logger with same name as returned by LoggerFactory
+ * @throws ObjectStreamException
+ */
+ protected Object readResolve() throws ObjectStreamException {
+ Logger logger = LoggerFactory.getLogger(this.name);
+ return new SLF4JLocationAwareLog((LocationAwareLogger) logger);
+ }
}diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java
index 5a14285..5ee59f7 100644
--- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java
+++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java
@@ -1,251 +1,251 @@
-/*
- * 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.commons.logging.impl;
-
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-
-import org.apache.commons.logging.Log;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Implementation of {@link Log org.apache.commons.logging.Log} interface which
- * delegates all processing to a wrapped {@link Logger org.slf4j.Logger}
- * instance.
- *
- *
- * JCL's FATAL level is mapped to ERROR. All other levels map one to one.
- *
- * @author Ceki Gülcü
- */
-public class SLF4JLog implements Log, Serializable {
-
- private static final long serialVersionUID = 680728617011167209L;
-
- // used to store this logger's name to recreate it after serialization
- protected String name;
-
- // in both Log4jLogger and Jdk14Logger classes in the original JCL, the
- // logger instance is transient
- private transient Logger logger;
-
- SLF4JLog(Logger logger) {
- this.logger = logger;
- this.name = logger.getName();
- }
-
- /**
- * Directly delegates to the wrapped org.slf4j.Logger instance.
- */
- public boolean isDebugEnabled() {
- return logger.isDebugEnabled();
- }
-
- /**
- * Directly delegates to the wrapped org.slf4j.Logger instance.
- */
- public boolean isErrorEnabled() {
- return logger.isErrorEnabled();
- }
-
- /**
- * Delegates to the isErrorEnabled method of the wrapped
- * org.slf4j.Logger instance.
- */
- public boolean isFatalEnabled() {
- return logger.isErrorEnabled();
- }
-
- /**
- * Directly delegates to the wrapped org.slf4j.Logger instance.
- */
- public boolean isInfoEnabled() {
- return logger.isInfoEnabled();
- }
-
- /**
- * Delegates to the isDebugEnabled method of the wrapped
- * org.slf4j.Logger instance.
- */
- public boolean isTraceEnabled() {
- return logger.isTraceEnabled();
- }
-
- /**
- * Directly delegates to the wrapped org.slf4j.Logger instance.
- */
- public boolean isWarnEnabled() {
- return logger.isWarnEnabled();
- }
-
- /**
- * Converts the input parameter to String and then delegates to the debug
- * method of the wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void trace(Object message) {
- logger.trace(String.valueOf(message));
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * debug method of the wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void trace(Object message, Throwable t) {
- logger.trace(String.valueOf(message), t);
- }
-
- /**
- * Converts the input parameter to String and then delegates to the wrapped
- * org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void debug(Object message) {
- logger.debug(String.valueOf(message));
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void debug(Object message, Throwable t) {
- logger.debug(String.valueOf(message), t);
- }
-
- /**
- * Converts the input parameter to String and then delegates to the wrapped
- * org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void info(Object message) {
- logger.info(String.valueOf(message));
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void info(Object message, Throwable t) {
- logger.info(String.valueOf(message), t);
- }
-
- /**
- * Converts the input parameter to String and then delegates to the wrapped
- * org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void warn(Object message) {
- logger.warn(String.valueOf(message));
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void warn(Object message, Throwable t) {
- logger.warn(String.valueOf(message), t);
- }
-
- /**
- * Converts the input parameter to String and then delegates to the wrapped
- * org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void error(Object message) {
- logger.error(String.valueOf(message));
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void error(Object message, Throwable t) {
- logger.error(String.valueOf(message), t);
- }
-
- /**
- * Converts the input parameter to String and then delegates to the error
- * method of the wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- */
- public void fatal(Object message) {
- logger.error(String.valueOf(message));
- }
-
- /**
- * Converts the first input parameter to String and then delegates to the
- * error method of the wrapped org.slf4j.Logger instance.
- *
- * @param message
- * the message to log. Converted to {@link String}
- * @param t
- * the exception to log
- */
- public void fatal(Object message, Throwable t) {
- logger.error(String.valueOf(message), t);
- }
-
- /**
- * Replace this instance with a homonymous (same name) logger returned by
- * LoggerFactory. Note that this method is only called during deserialization.
- *
- * @return logger with same name as returned by LoggerFactory
- * @throws ObjectStreamException
- */
- protected Object readResolve() throws ObjectStreamException {
- Logger logger = LoggerFactory.getLogger(this.name);
- return new SLF4JLog(logger);
- }
+/*
+ * 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.commons.logging.impl;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of {@link Log org.apache.commons.logging.Log} interface which
+ * delegates all processing to a wrapped {@link Logger org.slf4j.Logger}
+ * instance.
+ *
+ *
+ * JCL's FATAL level is mapped to ERROR. All other levels map one to one.
+ *
+ * @author Ceki Gülcü
+ */
+public class SLF4JLog implements Log, Serializable {
+
+ private static final long serialVersionUID = 680728617011167209L;
+
+ // used to store this logger's name to recreate it after serialization
+ protected String name;
+
+ // in both Log4jLogger and Jdk14Logger classes in the original JCL, the
+ // logger instance is transient
+ private transient Logger logger;
+
+ SLF4JLog(Logger logger) {
+ this.logger = logger;
+ this.name = logger.getName();
+ }
+
+ /**
+ * Directly delegates to the wrapped org.slf4j.Logger instance.
+ */
+ public boolean isDebugEnabled() {
+ return logger.isDebugEnabled();
+ }
+
+ /**
+ * Directly delegates to the wrapped org.slf4j.Logger instance.
+ */
+ public boolean isErrorEnabled() {
+ return logger.isErrorEnabled();
+ }
+
+ /**
+ * Delegates to the isErrorEnabled method of the wrapped
+ * org.slf4j.Logger instance.
+ */
+ public boolean isFatalEnabled() {
+ return logger.isErrorEnabled();
+ }
+
+ /**
+ * Directly delegates to the wrapped org.slf4j.Logger instance.
+ */
+ public boolean isInfoEnabled() {
+ return logger.isInfoEnabled();
+ }
+
+ /**
+ * Delegates to the isDebugEnabled method of the wrapped
+ * org.slf4j.Logger instance.
+ */
+ public boolean isTraceEnabled() {
+ return logger.isTraceEnabled();
+ }
+
+ /**
+ * Directly delegates to the wrapped org.slf4j.Logger instance.
+ */
+ public boolean isWarnEnabled() {
+ return logger.isWarnEnabled();
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the debug
+ * method of the wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void trace(Object message) {
+ logger.trace(String.valueOf(message));
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * debug method of the wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void trace(Object message, Throwable t) {
+ logger.trace(String.valueOf(message), t);
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the wrapped
+ * org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void debug(Object message) {
+ logger.debug(String.valueOf(message));
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void debug(Object message, Throwable t) {
+ logger.debug(String.valueOf(message), t);
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the wrapped
+ * org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void info(Object message) {
+ logger.info(String.valueOf(message));
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void info(Object message, Throwable t) {
+ logger.info(String.valueOf(message), t);
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the wrapped
+ * org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void warn(Object message) {
+ logger.warn(String.valueOf(message));
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void warn(Object message, Throwable t) {
+ logger.warn(String.valueOf(message), t);
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the wrapped
+ * org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void error(Object message) {
+ logger.error(String.valueOf(message));
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void error(Object message, Throwable t) {
+ logger.error(String.valueOf(message), t);
+ }
+
+ /**
+ * Converts the input parameter to String and then delegates to the error
+ * method of the wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ */
+ public void fatal(Object message) {
+ logger.error(String.valueOf(message));
+ }
+
+ /**
+ * Converts the first input parameter to String and then delegates to the
+ * error method of the wrapped org.slf4j.Logger instance.
+ *
+ * @param message
+ * the message to log. Converted to {@link String}
+ * @param t
+ * the exception to log
+ */
+ public void fatal(Object message, Throwable t) {
+ logger.error(String.valueOf(message), t);
+ }
+
+ /**
+ * Replace this instance with a homonymous (same name) logger returned by
+ * LoggerFactory. Note that this method is only called during deserialization.
+ *
+ * @return logger with same name as returned by LoggerFactory
+ * @throws ObjectStreamException
+ */
+ protected Object readResolve() throws ObjectStreamException {
+ Logger logger = LoggerFactory.getLogger(this.name);
+ return new SLF4JLog(logger);
+ }
}diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLogFactory.java b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLogFactory.java
index b40b034..d715c59 100644
--- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLogFactory.java
+++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLogFactory.java
@@ -1,219 +1,219 @@
-/*
- * 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.commons.logging.impl;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogConfigurationException;
-import org.apache.commons.logging.LogFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.spi.LocationAwareLogger;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- *
- * Concrete subclass of {@link LogFactory} which always delegates to the
- * {@link LoggerFactory org.slf4j.LoggerFactory} class.
- *
- *
- * This factory generates instances of {@link SLF4JLog}. It will remember
- * previously created instances for the same name, and will return them on
- * repeated requests to the getInstance() method.
- *
- *
- * This implementation ignores any configured attributes.
- *
- *
- * @author Rod Waldhoff
- * @author Craig R. McClanahan
- * @author Richard A. Sitze
- * @author Ceki Gülcü
- */
-@SuppressWarnings("rawtypes")
-public class SLF4JLogFactory extends LogFactory {
-
- // ----------------------------------------------------------- Constructors
-
- /**
- * The {@link org.apache.commons.logging.Log}instances that have already been
- * created, keyed by logger name.
- */
- ConcurrentMap loggerMap;
-
- /**
- * Public no-arguments constructor required by the lookup mechanism.
- */
- public SLF4JLogFactory() {
- loggerMap = new ConcurrentHashMap();
- }
-
- // ----------------------------------------------------- Manifest Constants
-
- /**
- * The name of the system property identifying our {@link Log}implementation
- * class.
- */
- public static final String LOG_PROPERTY = "org.apache.commons.logging.Log";
-
- // ----------------------------------------------------- Instance Variables
-
- /**
- * Configuration attributes.
- */
- protected Hashtable attributes = new Hashtable();
-
- // --------------------------------------------------------- Public Methods
-
- /**
- * Return the configuration attribute with the specified name (if any), or
- * null if there is no such attribute.
- *
- * @param name
- * Name of the attribute to return
- */
- public Object getAttribute(String name) {
-
- return (attributes.get(name));
-
- }
-
- /**
- * Return an array containing the names of all currently defined configuration
- * attributes. If there are no such attributes, a zero length array is
- * returned.
- */
- @SuppressWarnings("unchecked")
- public String[] getAttributeNames() {
-
- List names = new ArrayList();
- Enumeration keys = attributes.keys();
- while (keys.hasMoreElements()) {
- names.add((String) keys.nextElement());
- }
- String results[] = new String[names.size()];
- for (int i = 0; i < results.length; i++) {
- results[i] = (String) names.get(i);
- }
- return (results);
-
- }
-
- /**
- * Convenience method to derive a name from the specified class and call
- * getInstance(String) with it.
- *
- * @param clazz
- * Class for which a suitable Log name will be derived
- *
- * @exception LogConfigurationException
- * if a suitable Log instance cannot be returned
- */
- public Log getInstance(Class clazz) throws LogConfigurationException {
- return (getInstance(clazz.getName()));
- }
-
- /**
- *
- * Construct (if necessary) and return a Log instance, using
- * the factory's current set of configuration attributes.
- *
- *
- * @param name
- * Logical name of the Log instance to be returned
- * (the meaning of this name is only known to the underlying logging
- * implementation that is being wrapped)
- *
- * @exception LogConfigurationException
- * if a suitable Log instance cannot be returned
- */
- public Log getInstance(String name) throws LogConfigurationException {
- Log instance = loggerMap.get(name);
- if (instance != null) {
- return instance;
- } else {
- Log newInstance;
- Logger slf4jLogger = LoggerFactory.getLogger(name);
- if (slf4jLogger instanceof LocationAwareLogger) {
- newInstance = new SLF4JLocationAwareLog((LocationAwareLogger) slf4jLogger);
- } else {
- newInstance = new SLF4JLog(slf4jLogger);
- }
- Log oldInstance = loggerMap.putIfAbsent(name, newInstance);
- return oldInstance == null ? newInstance : oldInstance;
- }
- }
-
- /**
- * Release any internal references to previously created
- * {@link org.apache.commons.logging.Log}instances returned by this factory.
- * This is useful in environments like servlet containers, which implement
- * application reloading by throwing away a ClassLoader. Dangling references
- * to objects in that class loader would prevent garbage collection.
- */
- public void release() {
- // This method is never called by jcl-over-slf4j classes. However,
- // in certain deployment scenarios, in particular if jcl-over-slf4j.jar
- // is
- // in the the web-app class loader and the official commons-logging.jar is
- // deployed in some parent class loader (e.g. commons/lib), then it is
- // possible
- // for the parent class loader to mask the classes shipping in
- // jcl-over-slf4j.jar.
- System.out.println("WARN: The method " + SLF4JLogFactory.class + "#release() was invoked.");
- System.out.println("WARN: Please see http://www.slf4j.org/codes.html#release for an explanation.");
- System.out.flush();
- }
-
- /**
- * Remove any configuration attribute associated with the specified name. If
- * there is no such attribute, no action is taken.
- *
- * @param name
- * Name of the attribute to remove
- */
- public void removeAttribute(String name) {
- attributes.remove(name);
- }
-
- /**
- * Set the configuration attribute with the specified name. Calling this with
- * a null value is equivalent to calling
- * removeAttribute(name).
- *
- * @param name
- * Name of the attribute to set
- * @param value
- * Value of the attribute to set, or null to remove
- * any setting for this attribute
- */
- @SuppressWarnings("unchecked")
- public void setAttribute(String name, Object value) {
-
- if (value == null) {
- attributes.remove(name);
- } else {
- attributes.put(name, value);
- }
-
- }
+/*
+ * 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.commons.logging.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogConfigurationException;
+import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.spi.LocationAwareLogger;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ *
+ * Concrete subclass of {@link LogFactory} which always delegates to the
+ * {@link LoggerFactory org.slf4j.LoggerFactory} class.
+ *
+ *
+ * This factory generates instances of {@link SLF4JLog}. It will remember
+ * previously created instances for the same name, and will return them on
+ * repeated requests to the getInstance() method.
+ *
+ *
+ * This implementation ignores any configured attributes.
+ *
+ *
+ * @author Rod Waldhoff
+ * @author Craig R. McClanahan
+ * @author Richard A. Sitze
+ * @author Ceki Gülcü
+ */
+@SuppressWarnings("rawtypes")
+public class SLF4JLogFactory extends LogFactory {
+
+ // ----------------------------------------------------------- Constructors
+
+ /**
+ * The {@link org.apache.commons.logging.Log}instances that have already been
+ * created, keyed by logger name.
+ */
+ ConcurrentMap loggerMap;
+
+ /**
+ * Public no-arguments constructor required by the lookup mechanism.
+ */
+ public SLF4JLogFactory() {
+ loggerMap = new ConcurrentHashMap();
+ }
+
+ // ----------------------------------------------------- Manifest Constants
+
+ /**
+ * The name of the system property identifying our {@link Log}implementation
+ * class.
+ */
+ public static final String LOG_PROPERTY = "org.apache.commons.logging.Log";
+
+ // ----------------------------------------------------- Instance Variables
+
+ /**
+ * Configuration attributes.
+ */
+ protected Hashtable attributes = new Hashtable();
+
+ // --------------------------------------------------------- Public Methods
+
+ /**
+ * Return the configuration attribute with the specified name (if any), or
+ * null if there is no such attribute.
+ *
+ * @param name
+ * Name of the attribute to return
+ */
+ public Object getAttribute(String name) {
+
+ return (attributes.get(name));
+
+ }
+
+ /**
+ * Return an array containing the names of all currently defined configuration
+ * attributes. If there are no such attributes, a zero length array is
+ * returned.
+ */
+ @SuppressWarnings("unchecked")
+ public String[] getAttributeNames() {
+
+ List names = new ArrayList();
+ Enumeration keys = attributes.keys();
+ while (keys.hasMoreElements()) {
+ names.add((String) keys.nextElement());
+ }
+ String results[] = new String[names.size()];
+ for (int i = 0; i < results.length; i++) {
+ results[i] = (String) names.get(i);
+ }
+ return (results);
+
+ }
+
+ /**
+ * Convenience method to derive a name from the specified class and call
+ * getInstance(String) with it.
+ *
+ * @param clazz
+ * Class for which a suitable Log name will be derived
+ *
+ * @exception LogConfigurationException
+ * if a suitable Log instance cannot be returned
+ */
+ public Log getInstance(Class clazz) throws LogConfigurationException {
+ return (getInstance(clazz.getName()));
+ }
+
+ /**
+ *
+ * Construct (if necessary) and return a Log instance, using
+ * the factory's current set of configuration attributes.
+ *
+ *
+ * @param name
+ * Logical name of the Log instance to be returned
+ * (the meaning of this name is only known to the underlying logging
+ * implementation that is being wrapped)
+ *
+ * @exception LogConfigurationException
+ * if a suitable Log instance cannot be returned
+ */
+ public Log getInstance(String name) throws LogConfigurationException {
+ Log instance = loggerMap.get(name);
+ if (instance != null) {
+ return instance;
+ } else {
+ Log newInstance;
+ Logger slf4jLogger = LoggerFactory.getLogger(name);
+ if (slf4jLogger instanceof LocationAwareLogger) {
+ newInstance = new SLF4JLocationAwareLog((LocationAwareLogger) slf4jLogger);
+ } else {
+ newInstance = new SLF4JLog(slf4jLogger);
+ }
+ Log oldInstance = loggerMap.putIfAbsent(name, newInstance);
+ return oldInstance == null ? newInstance : oldInstance;
+ }
+ }
+
+ /**
+ * Release any internal references to previously created
+ * {@link org.apache.commons.logging.Log}instances returned by this factory.
+ * This is useful in environments like servlet containers, which implement
+ * application reloading by throwing away a ClassLoader. Dangling references
+ * to objects in that class loader would prevent garbage collection.
+ */
+ public void release() {
+ // This method is never called by jcl-over-slf4j classes. However,
+ // in certain deployment scenarios, in particular if jcl-over-slf4j.jar
+ // is
+ // in the the web-app class loader and the official commons-logging.jar is
+ // deployed in some parent class loader (e.g. commons/lib), then it is
+ // possible
+ // for the parent class loader to mask the classes shipping in
+ // jcl-over-slf4j.jar.
+ System.out.println("WARN: The method " + SLF4JLogFactory.class + "#release() was invoked.");
+ System.out.println("WARN: Please see http://www.slf4j.org/codes.html#release for an explanation.");
+ System.out.flush();
+ }
+
+ /**
+ * Remove any configuration attribute associated with the specified name. If
+ * there is no such attribute, no action is taken.
+ *
+ * @param name
+ * Name of the attribute to remove
+ */
+ public void removeAttribute(String name) {
+ attributes.remove(name);
+ }
+
+ /**
+ * Set the configuration attribute with the specified name. Calling this with
+ * a null value is equivalent to calling
+ * removeAttribute(name).
+ *
+ * @param name
+ * Name of the attribute to set
+ * @param value
+ * Value of the attribute to set, or null to remove
+ * any setting for this attribute
+ */
+ @SuppressWarnings("unchecked")
+ public void setAttribute(String name, Object value) {
+
+ if (value == null) {
+ attributes.remove(name);
+ } else {
+ attributes.put(name, value);
+ }
+
+ }
}diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SimpleLog.java b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
index 4a9bd0d..96b6422 100644
--- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
+++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
@@ -1,688 +1,688 @@
-/*
- * 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.commons.logging.impl;
-
-import java.io.InputStream;
-import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Properties;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogConfigurationException;
-
-/**
- *
- * Simple implementation of Log that sends all enabled log messages, for all
- * defined loggers, to System.err. The following system properties are supported
- * to configure the behavior of this logger:
- *
- *
- *
org.apache.commons.logging.simplelog.defaultlog - Default
- * logging detail level for all instances of SimpleLog. Must be one of ("trace",
- * "debug", "info", "warn", "error", or "fatal"). If not specified, defaults to
- * "info".
- *
org.apache.commons.logging.simplelog.log.xxxxx - Logging
- * detail level for a SimpleLog instance named "xxxxx". Must be one of ("trace",
- * "debug", "info", "warn", "error", or "fatal"). If not specified, the default
- * logging detail level is used.
- *
org.apache.commons.logging.simplelog.showlogname - Set to
- * true if you want the Log instance name to be included in output
- * messages. Defaults to false.
- *
org.apache.commons.logging.simplelog.showShortLogname - Set
- * to true if you want the last component of the name to be
- * included in output messages. Defaults to true.
- *
org.apache.commons.logging.simplelog.showdatetime - Set to
- * true if you want the current date and time to be included in
- * output messages. Default is false.
- *
org.apache.commons.logging.simplelog.dateTimeFormat - The
- * date and time format to be used in the output messages. The pattern
- * describing the date and time format is the same that is used in
- * java.text.SimpleDateFormat. If the format is not specified or is
- * invalid, the default format is used. The default format is
- * yyyy/MM/dd HH:mm:ss:SSS zzz.
- *
- *
- *
- * In addition to looking for system properties with the names specified above,
- * this implementation also checks for a class loader resource named
- * "simplelog.properties", and includes any matching definitions
- * from this resource (if it exists).
- *
- *
- * @author Scott Sanders
- * @author Rod Waldhoff
- * @author Robert Burrell Donkin
- *
- * @version $Id: SimpleLog.java,v 1.21 2004/06/06 20:47:56 rdonkin Exp $
- */
-public class SimpleLog implements Log, Serializable {
-
- private static final long serialVersionUID = 136942970684951178L;
-
- // ------------------------------------------------------- Class Attributes
-
- /** All system properties used by SimpleLog start with this */
- static protected final String systemPrefix = "org.apache.commons.logging.simplelog.";
-
- /** Properties loaded from simplelog.properties */
- static protected final Properties simpleLogProps = new Properties();
-
- /** The default format to use when formatting dates */
- static protected final String DEFAULT_DATE_TIME_FORMAT = "yyyy/MM/dd HH:mm:ss:SSS zzz";
-
- /** Include the instance name in the log message? */
- static protected boolean showLogName = false;
- /**
- * Include the short name ( last component ) of the logger in the log message.
- * Defaults to true - otherwise we'll be lost in a flood of messages without
- * knowing who sends them.
- */
- static protected boolean showShortName = true;
- /** Include the current time in the log message */
- static protected boolean showDateTime = false;
- /** The date and time format to use in the log message */
- static protected String dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
- /** Used to format times */
- static protected DateFormat dateFormatter = null;
-
- // ---------------------------------------------------- Log Level Constants
-
- /** "Trace" level logging. */
- public static final int LOG_LEVEL_TRACE = 1;
- /** "Debug" level logging. */
- public static final int LOG_LEVEL_DEBUG = 2;
- /** "Info" level logging. */
- public static final int LOG_LEVEL_INFO = 3;
- /** "Warn" level logging. */
- public static final int LOG_LEVEL_WARN = 4;
- /** "Error" level logging. */
- public static final int LOG_LEVEL_ERROR = 5;
- /** "Fatal" level logging. */
- public static final int LOG_LEVEL_FATAL = 6;
-
- /** Enable all logging levels */
- public static final int LOG_LEVEL_ALL = (LOG_LEVEL_TRACE - 1);
-
- /** Enable no logging levels */
- public static final int LOG_LEVEL_OFF = (LOG_LEVEL_FATAL + 1);
-
- // ------------------------------------------------------------ Initializer
-
- private static String getStringProperty(String name) {
- String prop = null;
- try {
- prop = System.getProperty(name);
- } catch (SecurityException e) {
- ; // Ignore
- }
- return (prop == null) ? simpleLogProps.getProperty(name) : prop;
- }
-
- private static String getStringProperty(String name, String dephault) {
- String prop = getStringProperty(name);
- return (prop == null) ? dephault : prop;
- }
-
- private static boolean getBooleanProperty(String name, boolean dephault) {
- String prop = getStringProperty(name);
- return (prop == null) ? dephault : "true".equalsIgnoreCase(prop);
- }
-
- // Initialize class attributes.
- // Load properties file, if found.
- // Override with system properties.
- static {
- // Add props from the resource simplelog.properties
- InputStream in = getResourceAsStream("simplelog.properties");
- if (null != in) {
- try {
- simpleLogProps.load(in);
- } catch (java.io.IOException e) {
- // ignored
- } finally {
- try {
- in.close();
- } catch (java.io.IOException e) {
- // ignored
- }
- }
- }
-
- showLogName = getBooleanProperty(systemPrefix + "showlogname", showLogName);
- showShortName = getBooleanProperty(systemPrefix + "showShortLogname", showShortName);
- showDateTime = getBooleanProperty(systemPrefix + "showdatetime", showDateTime);
-
- if (showDateTime) {
- dateTimeFormat = getStringProperty(systemPrefix + "dateTimeFormat", dateTimeFormat);
- try {
- dateFormatter = new SimpleDateFormat(dateTimeFormat);
- } catch (IllegalArgumentException e) {
- // If the format pattern is invalid - use the default format
- dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
- dateFormatter = new SimpleDateFormat(dateTimeFormat);
- }
- }
- }
-
- // ------------------------------------------------------------- Attributes
-
- /** The name of this simple log instance */
- protected String logName = null;
- /** The current log level */
- protected int currentLogLevel;
- /** The short name of this simple log instance */
- private String shortLogName = null;
-
- // ------------------------------------------------------------ Constructor
-
- /**
- * Construct a simple log with given name.
- *
- * @param name
- * log name
- */
- public SimpleLog(String name) {
-
- logName = name;
-
- // Set initial log level
- // Used to be: set default log level to ERROR
- // IMHO it should be lower, but at least info ( costin ).
- setLevel(SimpleLog.LOG_LEVEL_INFO);
-
- // Set log level from properties
- String lvl = getStringProperty(systemPrefix + "log." + logName);
- int i = String.valueOf(name).lastIndexOf(".");
- while (null == lvl && i > -1) {
- name = name.substring(0, i);
- lvl = getStringProperty(systemPrefix + "log." + name);
- i = String.valueOf(name).lastIndexOf(".");
- }
-
- if (null == lvl) {
- lvl = getStringProperty(systemPrefix + "defaultlog");
- }
-
- if ("all".equalsIgnoreCase(lvl)) {
- setLevel(SimpleLog.LOG_LEVEL_ALL);
- } else if ("trace".equalsIgnoreCase(lvl)) {
- setLevel(SimpleLog.LOG_LEVEL_TRACE);
- } else if ("debug".equalsIgnoreCase(lvl)) {
- setLevel(SimpleLog.LOG_LEVEL_DEBUG);
- } else if ("info".equalsIgnoreCase(lvl)) {
- setLevel(SimpleLog.LOG_LEVEL_INFO);
- } else if ("warn".equalsIgnoreCase(lvl)) {
- setLevel(SimpleLog.LOG_LEVEL_WARN);
- } else if ("error".equalsIgnoreCase(lvl)) {
- setLevel(SimpleLog.LOG_LEVEL_ERROR);
- } else if ("fatal".equalsIgnoreCase(lvl)) {
- setLevel(SimpleLog.LOG_LEVEL_FATAL);
- } else if ("off".equalsIgnoreCase(lvl)) {
- setLevel(SimpleLog.LOG_LEVEL_OFF);
- }
-
- }
-
- // -------------------------------------------------------- Properties
-
- /**
- *
- * Do the actual logging. This method assembles the message and then calls
- * write() to cause it to be written.
- *
- *
- * @param type
- * One of the LOG_LEVEL_XXX constants defining the log level
- * @param message
- * The message itself (typically a String)
- * @param t
- * The exception whose stack trace should be logged
- */
- protected void log(int type, Object message, Throwable t) {
- // Use a string buffer for better performance
- StringBuffer buf = new StringBuffer();
-
- // Append date-time if so configured
- if (showDateTime) {
- buf.append(dateFormatter.format(new Date()));
- buf.append(" ");
- }
-
- // Append a readable representation of the log level
- switch (type) {
- case SimpleLog.LOG_LEVEL_TRACE:
- buf.append("[TRACE] ");
- break;
- case SimpleLog.LOG_LEVEL_DEBUG:
- buf.append("[DEBUG] ");
- break;
- case SimpleLog.LOG_LEVEL_INFO:
- buf.append("[INFO] ");
- break;
- case SimpleLog.LOG_LEVEL_WARN:
- buf.append("[WARN] ");
- break;
- case SimpleLog.LOG_LEVEL_ERROR:
- buf.append("[ERROR] ");
- break;
- case SimpleLog.LOG_LEVEL_FATAL:
- buf.append("[FATAL] ");
- break;
- }
-
- // Append the name of the log instance if so configured
- if (showShortName) {
- if (shortLogName == null) {
- // Cut all but the last component of the name for both styles
- shortLogName = logName.substring(logName.lastIndexOf(".") + 1);
- shortLogName = shortLogName.substring(shortLogName.lastIndexOf("/") + 1);
- }
- buf.append(String.valueOf(shortLogName)).append(" - ");
- } else if (showLogName) {
- buf.append(String.valueOf(logName)).append(" - ");
- }
-
- // Append the message
- buf.append(String.valueOf(message));
-
- // Append stack trace if not null
- if (t != null) {
- buf.append(" <");
- buf.append(t.toString());
- buf.append(">");
-
- java.io.StringWriter sw = new java.io.StringWriter(1024);
- java.io.PrintWriter pw = new java.io.PrintWriter(sw);
- t.printStackTrace(pw);
- pw.close();
- buf.append(sw.toString());
- }
-
- // Print to the appropriate destination
- write(buf);
-
- }
-
- /**
- *
- * Write the content of the message accumulated in the specified
- * StringBuffer to the appropriate output destination. The
- * default implementation writes to System.err.
- *
- *
- * @param buffer
- * A StringBuffer containing the accumulated text to be
- * logged
- */
- protected void write(StringBuffer buffer) {
-
- System.err.println(buffer.toString());
-
- }
-
- /**
- * Is the given log level currently enabled?
- *
- * @param logLevel
- * is this level enabled?
- */
- protected boolean isLevelEnabled(int logLevel) {
- // log level are numerically ordered so can use simple numeric
- // comparison
- return (logLevel >= currentLogLevel);
- }
-
- // -------------------------------------------------------- Log Implementation
-
- /**
- *
- * Log a message with debug log level.
- *
- */
- public final void debug(Object message) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG)) {
- log(SimpleLog.LOG_LEVEL_DEBUG, message, null);
- }
- }
-
- /**
- *
- * Log an error with debug log level.
- *
- */
- public final void debug(Object message, Throwable t) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG)) {
- log(SimpleLog.LOG_LEVEL_DEBUG, message, t);
- }
- }
-
- /**
- *
- * Log a message with trace log level.
- *
- */
- public final void trace(Object message) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE)) {
- log(SimpleLog.LOG_LEVEL_TRACE, message, null);
- }
- }
-
- /**
- *
- * Log an error with trace log level.
- *
- */
- public final void trace(Object message, Throwable t) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE)) {
- log(SimpleLog.LOG_LEVEL_TRACE, message, t);
- }
- }
-
- /**
- *
- * Log a message with info log level.
- *
- */
- public final void info(Object message) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_INFO)) {
- log(SimpleLog.LOG_LEVEL_INFO, message, null);
- }
- }
-
- /**
- *
- * Log an error with info log level.
- *
- */
- public final void info(Object message, Throwable t) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_INFO)) {
- log(SimpleLog.LOG_LEVEL_INFO, message, t);
- }
- }
-
- /**
- *
- * Log a message with warn log level.
- *
- */
- public final void warn(Object message) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_WARN)) {
- log(SimpleLog.LOG_LEVEL_WARN, message, null);
- }
- }
-
- /**
- *
- * Log an error with warn log level.
- *
- */
- public final void warn(Object message, Throwable t) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_WARN)) {
- log(SimpleLog.LOG_LEVEL_WARN, message, t);
- }
- }
-
- /**
- *
- * Log a message with error log level.
- *
- */
- public final void error(Object message) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR)) {
- log(SimpleLog.LOG_LEVEL_ERROR, message, null);
- }
- }
-
- /**
- *
- * Log an error with error log level.
- *
- */
- public final void error(Object message, Throwable t) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR)) {
- log(SimpleLog.LOG_LEVEL_ERROR, message, t);
- }
- }
-
- /**
- *
- * Log a message with fatal log level.
- *
- */
- public final void fatal(Object message) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL)) {
- log(SimpleLog.LOG_LEVEL_FATAL, message, null);
- }
- }
-
- /**
- *
- * Log an error with fatal log level.
- *
- */
- public final void fatal(Object message, Throwable t) {
-
- if (isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL)) {
- log(SimpleLog.LOG_LEVEL_FATAL, message, t);
- }
- }
-
- /**
- *
- * Are debug messages currently enabled?
- *
- *
- *
- * This allows expensive operations such as String concatenation
- * to be avoided when the message will be ignored by the logger.
- *
- */
- public final boolean isDebugEnabled() {
-
- return isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG);
- }
-
- /**
- *
- * Are error messages currently enabled?
- *
- *
- *
- * This allows expensive operations such as String concatenation
- * to be avoided when the message will be ignored by the logger.
- *
- */
- public final boolean isErrorEnabled() {
-
- return isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR);
- }
-
- /**
- *
- * Are fatal messages currently enabled?
- *
- *
- *
- * This allows expensive operations such as String concatenation
- * to be avoided when the message will be ignored by the logger.
- *
- */
- public final boolean isFatalEnabled() {
-
- return isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL);
- }
-
- /**
- *
- * Are info messages currently enabled?
- *
- *
- *
- * This allows expensive operations such as String concatenation
- * to be avoided when the message will be ignored by the logger.
- *
- */
- public final boolean isInfoEnabled() {
-
- return isLevelEnabled(SimpleLog.LOG_LEVEL_INFO);
- }
-
- /**
- *
- * Are trace messages currently enabled?
- *
- *
- *
- * This allows expensive operations such as String concatenation
- * to be avoided when the message will be ignored by the logger.
- *
- */
- public final boolean isTraceEnabled() {
-
- return isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE);
- }
-
- /**
- *
- * Are warn messages currently enabled?
- *
- *
- *
- * This allows expensive operations such as String concatenation
- * to be avoided when the message will be ignored by the logger.
- *
- */
- public final boolean isWarnEnabled() {
-
- return isLevelEnabled(SimpleLog.LOG_LEVEL_WARN);
- }
-
- /**
- * Return the thread context class loader if available. Otherwise return null.
- *
- * The thread context class loader is available for JDK 1.2 or later, if
- * certain security conditions are met.
- *
- * @exception LogConfigurationException
- * if a suitable class loader cannot be identified.
- */
- private static ClassLoader getContextClassLoader() {
- ClassLoader classLoader = null;
-
- if (classLoader == null) {
- try {
- // Are we running on a JDK 1.2 or later system?
- Method method = Thread.class.getMethod("getContextClassLoader");
-
- // Get the thread context class loader (if there is one)
- try {
- classLoader = (ClassLoader) method.invoke(Thread.currentThread());
- } catch (IllegalAccessException e) {
- ; // ignore
- } catch (InvocationTargetException e) {
- /**
- * InvocationTargetException is thrown by 'invoke' when the method
- * being invoked (getContextClassLoader) throws an exception.
- *
- * getContextClassLoader() throws SecurityException when the context
- * class loader isn't an ancestor of the calling class's class loader,
- * or if security permissions are restricted.
- *
- * In the first case (not related), we want to ignore and keep going.
- * We cannot help but also ignore the second with the logic below, but
- * other calls elsewhere (to obtain a class loader) will trigger this
- * exception where we can make a distinction.
- */
- if (e.getTargetException() instanceof SecurityException) {
- ; // ignore
- } else {
- // Capture 'e.getTargetException()' exception for details
- // alternate: log 'e.getTargetException()', and pass back 'e'.
- throw new LogConfigurationException("Unexpected InvocationTargetException", e.getTargetException());
- }
- }
- } catch (NoSuchMethodException e) {
- // Assume we are running on JDK 1.1
- ; // ignore
- }
- }
-
- if (classLoader == null) {
- classLoader = SimpleLog.class.getClassLoader();
- }
-
- // Return the selected class loader
- return classLoader;
- }
-
- private static InputStream getResourceAsStream(final String name) {
- return AccessController.doPrivileged(new PrivilegedAction() {
- public InputStream run() {
- ClassLoader threadCL = getContextClassLoader();
-
- if (threadCL != null) {
- return threadCL.getResourceAsStream(name);
- } else {
- return ClassLoader.getSystemResourceAsStream(name);
- }
- }
- });
- }
-}
+/*
+ * 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.commons.logging.impl;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogConfigurationException;
+
+/**
+ *
+ * Simple implementation of Log that sends all enabled log messages, for all
+ * defined loggers, to System.err. The following system properties are supported
+ * to configure the behavior of this logger:
+ *
+ *
+ *
org.apache.commons.logging.simplelog.defaultlog - Default
+ * logging detail level for all instances of SimpleLog. Must be one of ("trace",
+ * "debug", "info", "warn", "error", or "fatal"). If not specified, defaults to
+ * "info".
+ *
org.apache.commons.logging.simplelog.log.xxxxx - Logging
+ * detail level for a SimpleLog instance named "xxxxx". Must be one of ("trace",
+ * "debug", "info", "warn", "error", or "fatal"). If not specified, the default
+ * logging detail level is used.
+ *
org.apache.commons.logging.simplelog.showlogname - Set to
+ * true if you want the Log instance name to be included in output
+ * messages. Defaults to false.
+ *
org.apache.commons.logging.simplelog.showShortLogname - Set
+ * to true if you want the last component of the name to be
+ * included in output messages. Defaults to true.
+ *
org.apache.commons.logging.simplelog.showdatetime - Set to
+ * true if you want the current date and time to be included in
+ * output messages. Default is false.
+ *
org.apache.commons.logging.simplelog.dateTimeFormat - The
+ * date and time format to be used in the output messages. The pattern
+ * describing the date and time format is the same that is used in
+ * java.text.SimpleDateFormat. If the format is not specified or is
+ * invalid, the default format is used. The default format is
+ * yyyy/MM/dd HH:mm:ss:SSS zzz.
+ *
+ *
+ *
+ * In addition to looking for system properties with the names specified above,
+ * this implementation also checks for a class loader resource named
+ * "simplelog.properties", and includes any matching definitions
+ * from this resource (if it exists).
+ *
+ *
+ * @author Scott Sanders
+ * @author Rod Waldhoff
+ * @author Robert Burrell Donkin
+ *
+ * @version $Id: SimpleLog.java,v 1.21 2004/06/06 20:47:56 rdonkin Exp $
+ */
+public class SimpleLog implements Log, Serializable {
+
+ private static final long serialVersionUID = 136942970684951178L;
+
+ // ------------------------------------------------------- Class Attributes
+
+ /** All system properties used by SimpleLog start with this */
+ static protected final String systemPrefix = "org.apache.commons.logging.simplelog.";
+
+ /** Properties loaded from simplelog.properties */
+ static protected final Properties simpleLogProps = new Properties();
+
+ /** The default format to use when formatting dates */
+ static protected final String DEFAULT_DATE_TIME_FORMAT = "yyyy/MM/dd HH:mm:ss:SSS zzz";
+
+ /** Include the instance name in the log message? */
+ static protected boolean showLogName = false;
+ /**
+ * Include the short name ( last component ) of the logger in the log message.
+ * Defaults to true - otherwise we'll be lost in a flood of messages without
+ * knowing who sends them.
+ */
+ static protected boolean showShortName = true;
+ /** Include the current time in the log message */
+ static protected boolean showDateTime = false;
+ /** The date and time format to use in the log message */
+ static protected String dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
+ /** Used to format times */
+ static protected DateFormat dateFormatter = null;
+
+ // ---------------------------------------------------- Log Level Constants
+
+ /** "Trace" level logging. */
+ public static final int LOG_LEVEL_TRACE = 1;
+ /** "Debug" level logging. */
+ public static final int LOG_LEVEL_DEBUG = 2;
+ /** "Info" level logging. */
+ public static final int LOG_LEVEL_INFO = 3;
+ /** "Warn" level logging. */
+ public static final int LOG_LEVEL_WARN = 4;
+ /** "Error" level logging. */
+ public static final int LOG_LEVEL_ERROR = 5;
+ /** "Fatal" level logging. */
+ public static final int LOG_LEVEL_FATAL = 6;
+
+ /** Enable all logging levels */
+ public static final int LOG_LEVEL_ALL = (LOG_LEVEL_TRACE - 1);
+
+ /** Enable no logging levels */
+ public static final int LOG_LEVEL_OFF = (LOG_LEVEL_FATAL + 1);
+
+ // ------------------------------------------------------------ Initializer
+
+ private static String getStringProperty(String name) {
+ String prop = null;
+ try {
+ prop = System.getProperty(name);
+ } catch (SecurityException e) {
+ ; // Ignore
+ }
+ return (prop == null) ? simpleLogProps.getProperty(name) : prop;
+ }
+
+ private static String getStringProperty(String name, String dephault) {
+ String prop = getStringProperty(name);
+ return (prop == null) ? dephault : prop;
+ }
+
+ private static boolean getBooleanProperty(String name, boolean dephault) {
+ String prop = getStringProperty(name);
+ return (prop == null) ? dephault : "true".equalsIgnoreCase(prop);
+ }
+
+ // Initialize class attributes.
+ // Load properties file, if found.
+ // Override with system properties.
+ static {
+ // Add props from the resource simplelog.properties
+ InputStream in = getResourceAsStream("simplelog.properties");
+ if (null != in) {
+ try {
+ simpleLogProps.load(in);
+ } catch (java.io.IOException e) {
+ // ignored
+ } finally {
+ try {
+ in.close();
+ } catch (java.io.IOException e) {
+ // ignored
+ }
+ }
+ }
+
+ showLogName = getBooleanProperty(systemPrefix + "showlogname", showLogName);
+ showShortName = getBooleanProperty(systemPrefix + "showShortLogname", showShortName);
+ showDateTime = getBooleanProperty(systemPrefix + "showdatetime", showDateTime);
+
+ if (showDateTime) {
+ dateTimeFormat = getStringProperty(systemPrefix + "dateTimeFormat", dateTimeFormat);
+ try {
+ dateFormatter = new SimpleDateFormat(dateTimeFormat);
+ } catch (IllegalArgumentException e) {
+ // If the format pattern is invalid - use the default format
+ dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
+ dateFormatter = new SimpleDateFormat(dateTimeFormat);
+ }
+ }
+ }
+
+ // ------------------------------------------------------------- Attributes
+
+ /** The name of this simple log instance */
+ protected String logName = null;
+ /** The current log level */
+ protected int currentLogLevel;
+ /** The short name of this simple log instance */
+ private String shortLogName = null;
+
+ // ------------------------------------------------------------ Constructor
+
+ /**
+ * Construct a simple log with given name.
+ *
+ * @param name
+ * log name
+ */
+ public SimpleLog(String name) {
+
+ logName = name;
+
+ // Set initial log level
+ // Used to be: set default log level to ERROR
+ // IMHO it should be lower, but at least info ( costin ).
+ setLevel(SimpleLog.LOG_LEVEL_INFO);
+
+ // Set log level from properties
+ String lvl = getStringProperty(systemPrefix + "log." + logName);
+ int i = String.valueOf(name).lastIndexOf(".");
+ while (null == lvl && i > -1) {
+ name = name.substring(0, i);
+ lvl = getStringProperty(systemPrefix + "log." + name);
+ i = String.valueOf(name).lastIndexOf(".");
+ }
+
+ if (null == lvl) {
+ lvl = getStringProperty(systemPrefix + "defaultlog");
+ }
+
+ if ("all".equalsIgnoreCase(lvl)) {
+ setLevel(SimpleLog.LOG_LEVEL_ALL);
+ } else if ("trace".equalsIgnoreCase(lvl)) {
+ setLevel(SimpleLog.LOG_LEVEL_TRACE);
+ } else if ("debug".equalsIgnoreCase(lvl)) {
+ setLevel(SimpleLog.LOG_LEVEL_DEBUG);
+ } else if ("info".equalsIgnoreCase(lvl)) {
+ setLevel(SimpleLog.LOG_LEVEL_INFO);
+ } else if ("warn".equalsIgnoreCase(lvl)) {
+ setLevel(SimpleLog.LOG_LEVEL_WARN);
+ } else if ("error".equalsIgnoreCase(lvl)) {
+ setLevel(SimpleLog.LOG_LEVEL_ERROR);
+ } else if ("fatal".equalsIgnoreCase(lvl)) {
+ setLevel(SimpleLog.LOG_LEVEL_FATAL);
+ } else if ("off".equalsIgnoreCase(lvl)) {
+ setLevel(SimpleLog.LOG_LEVEL_OFF);
+ }
+
+ }
+
+ // -------------------------------------------------------- Properties
+
+ /**
+ *
+ * Do the actual logging. This method assembles the message and then calls
+ * write() to cause it to be written.
+ *
+ *
+ * @param type
+ * One of the LOG_LEVEL_XXX constants defining the log level
+ * @param message
+ * The message itself (typically a String)
+ * @param t
+ * The exception whose stack trace should be logged
+ */
+ protected void log(int type, Object message, Throwable t) {
+ // Use a string buffer for better performance
+ StringBuffer buf = new StringBuffer();
+
+ // Append date-time if so configured
+ if (showDateTime) {
+ buf.append(dateFormatter.format(new Date()));
+ buf.append(" ");
+ }
+
+ // Append a readable representation of the log level
+ switch (type) {
+ case SimpleLog.LOG_LEVEL_TRACE:
+ buf.append("[TRACE] ");
+ break;
+ case SimpleLog.LOG_LEVEL_DEBUG:
+ buf.append("[DEBUG] ");
+ break;
+ case SimpleLog.LOG_LEVEL_INFO:
+ buf.append("[INFO] ");
+ break;
+ case SimpleLog.LOG_LEVEL_WARN:
+ buf.append("[WARN] ");
+ break;
+ case SimpleLog.LOG_LEVEL_ERROR:
+ buf.append("[ERROR] ");
+ break;
+ case SimpleLog.LOG_LEVEL_FATAL:
+ buf.append("[FATAL] ");
+ break;
+ }
+
+ // Append the name of the log instance if so configured
+ if (showShortName) {
+ if (shortLogName == null) {
+ // Cut all but the last component of the name for both styles
+ shortLogName = logName.substring(logName.lastIndexOf(".") + 1);
+ shortLogName = shortLogName.substring(shortLogName.lastIndexOf("/") + 1);
+ }
+ buf.append(String.valueOf(shortLogName)).append(" - ");
+ } else if (showLogName) {
+ buf.append(String.valueOf(logName)).append(" - ");
+ }
+
+ // Append the message
+ buf.append(String.valueOf(message));
+
+ // Append stack trace if not null
+ if (t != null) {
+ buf.append(" <");
+ buf.append(t.toString());
+ buf.append(">");
+
+ java.io.StringWriter sw = new java.io.StringWriter(1024);
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ t.printStackTrace(pw);
+ pw.close();
+ buf.append(sw.toString());
+ }
+
+ // Print to the appropriate destination
+ write(buf);
+
+ }
+
+ /**
+ *
+ * Write the content of the message accumulated in the specified
+ * StringBuffer to the appropriate output destination. The
+ * default implementation writes to System.err.
+ *
+ *
+ * @param buffer
+ * A StringBuffer containing the accumulated text to be
+ * logged
+ */
+ protected void write(StringBuffer buffer) {
+
+ System.err.println(buffer.toString());
+
+ }
+
+ /**
+ * Is the given log level currently enabled?
+ *
+ * @param logLevel
+ * is this level enabled?
+ */
+ protected boolean isLevelEnabled(int logLevel) {
+ // log level are numerically ordered so can use simple numeric
+ // comparison
+ return (logLevel >= currentLogLevel);
+ }
+
+ // -------------------------------------------------------- Log Implementation
+
+ /**
+ *
+ * Log a message with debug log level.
+ *
+ */
+ public final void debug(Object message) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG)) {
+ log(SimpleLog.LOG_LEVEL_DEBUG, message, null);
+ }
+ }
+
+ /**
+ *
+ * Log an error with debug log level.
+ *
+ */
+ public final void debug(Object message, Throwable t) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG)) {
+ log(SimpleLog.LOG_LEVEL_DEBUG, message, t);
+ }
+ }
+
+ /**
+ *
+ * Log a message with trace log level.
+ *
+ */
+ public final void trace(Object message) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE)) {
+ log(SimpleLog.LOG_LEVEL_TRACE, message, null);
+ }
+ }
+
+ /**
+ *
+ * Log an error with trace log level.
+ *
+ */
+ public final void trace(Object message, Throwable t) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE)) {
+ log(SimpleLog.LOG_LEVEL_TRACE, message, t);
+ }
+ }
+
+ /**
+ *
+ * Log a message with info log level.
+ *
+ */
+ public final void info(Object message) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_INFO)) {
+ log(SimpleLog.LOG_LEVEL_INFO, message, null);
+ }
+ }
+
+ /**
+ *
+ * Log an error with info log level.
+ *
+ */
+ public final void info(Object message, Throwable t) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_INFO)) {
+ log(SimpleLog.LOG_LEVEL_INFO, message, t);
+ }
+ }
+
+ /**
+ *
+ * Log a message with warn log level.
+ *
+ */
+ public final void warn(Object message) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_WARN)) {
+ log(SimpleLog.LOG_LEVEL_WARN, message, null);
+ }
+ }
+
+ /**
+ *
+ * Log an error with warn log level.
+ *
+ */
+ public final void warn(Object message, Throwable t) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_WARN)) {
+ log(SimpleLog.LOG_LEVEL_WARN, message, t);
+ }
+ }
+
+ /**
+ *
+ * Log a message with error log level.
+ *
+ */
+ public final void error(Object message) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR)) {
+ log(SimpleLog.LOG_LEVEL_ERROR, message, null);
+ }
+ }
+
+ /**
+ *
+ * Log an error with error log level.
+ *
+ */
+ public final void error(Object message, Throwable t) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR)) {
+ log(SimpleLog.LOG_LEVEL_ERROR, message, t);
+ }
+ }
+
+ /**
+ *
+ * Log a message with fatal log level.
+ *
+ */
+ public final void fatal(Object message) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL)) {
+ log(SimpleLog.LOG_LEVEL_FATAL, message, null);
+ }
+ }
+
+ /**
+ *
+ * Log an error with fatal log level.
+ *
+ */
+ public final void fatal(Object message, Throwable t) {
+
+ if (isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL)) {
+ log(SimpleLog.LOG_LEVEL_FATAL, message, t);
+ }
+ }
+
+ /**
+ *
+ * Are debug messages currently enabled?
+ *
+ *
+ *
+ * This allows expensive operations such as String concatenation
+ * to be avoided when the message will be ignored by the logger.
+ *
+ */
+ public final boolean isDebugEnabled() {
+
+ return isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG);
+ }
+
+ /**
+ *
+ * Are error messages currently enabled?
+ *
+ *
+ *
+ * This allows expensive operations such as String concatenation
+ * to be avoided when the message will be ignored by the logger.
+ *
+ */
+ public final boolean isErrorEnabled() {
+
+ return isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR);
+ }
+
+ /**
+ *
+ * Are fatal messages currently enabled?
+ *
+ *
+ *
+ * This allows expensive operations such as String concatenation
+ * to be avoided when the message will be ignored by the logger.
+ *
+ */
+ public final boolean isFatalEnabled() {
+
+ return isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL);
+ }
+
+ /**
+ *
+ * Are info messages currently enabled?
+ *
+ *
+ *
+ * This allows expensive operations such as String concatenation
+ * to be avoided when the message will be ignored by the logger.
+ *
+ */
+ public final boolean isInfoEnabled() {
+
+ return isLevelEnabled(SimpleLog.LOG_LEVEL_INFO);
+ }
+
+ /**
+ *
+ * Are trace messages currently enabled?
+ *
+ *
+ *
+ * This allows expensive operations such as String concatenation
+ * to be avoided when the message will be ignored by the logger.
+ *
+ */
+ public final boolean isTraceEnabled() {
+
+ return isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE);
+ }
+
+ /**
+ *
+ * Are warn messages currently enabled?
+ *
+ *
+ *
+ * This allows expensive operations such as String concatenation
+ * to be avoided when the message will be ignored by the logger.
+ *
+ */
+ public final boolean isWarnEnabled() {
+
+ return isLevelEnabled(SimpleLog.LOG_LEVEL_WARN);
+ }
+
+ /**
+ * Return the thread context class loader if available. Otherwise return null.
+ *
+ * The thread context class loader is available for JDK 1.2 or later, if
+ * certain security conditions are met.
+ *
+ * @exception LogConfigurationException
+ * if a suitable class loader cannot be identified.
+ */
+ private static ClassLoader getContextClassLoader() {
+ ClassLoader classLoader = null;
+
+ if (classLoader == null) {
+ try {
+ // Are we running on a JDK 1.2 or later system?
+ Method method = Thread.class.getMethod("getContextClassLoader");
+
+ // Get the thread context class loader (if there is one)
+ try {
+ classLoader = (ClassLoader) method.invoke(Thread.currentThread());
+ } catch (IllegalAccessException e) {
+ ; // ignore
+ } catch (InvocationTargetException e) {
+ /**
+ * InvocationTargetException is thrown by 'invoke' when the method
+ * being invoked (getContextClassLoader) throws an exception.
+ *
+ * getContextClassLoader() throws SecurityException when the context
+ * class loader isn't an ancestor of the calling class's class loader,
+ * or if security permissions are restricted.
+ *
+ * In the first case (not related), we want to ignore and keep going.
+ * We cannot help but also ignore the second with the logic below, but
+ * other calls elsewhere (to obtain a class loader) will trigger this
+ * exception where we can make a distinction.
+ */
+ if (e.getTargetException() instanceof SecurityException) {
+ ; // ignore
+ } else {
+ // Capture 'e.getTargetException()' exception for details
+ // alternate: log 'e.getTargetException()', and pass back 'e'.
+ throw new LogConfigurationException("Unexpected InvocationTargetException", e.getTargetException());
+ }
+ }
+ } catch (NoSuchMethodException e) {
+ // Assume we are running on JDK 1.1
+ ; // ignore
+ }
+ }
+
+ if (classLoader == null) {
+ classLoader = SimpleLog.class.getClassLoader();
+ }
+
+ // Return the selected class loader
+ return classLoader;
+ }
+
+ private static InputStream getResourceAsStream(final String name) {
+ return AccessController.doPrivileged(new PrivilegedAction() {
+ public InputStream run() {
+ ClassLoader threadCL = getContextClassLoader();
+
+ if (threadCL != null) {
+ return threadCL.getResourceAsStream(name);
+ } else {
+ return ClassLoader.getSystemResourceAsStream(name);
+ }
+ }
+ });
+ }
+}
diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/package.html b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/package.html
index 128d15f..ec177dd 100644
--- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/package.html
+++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/package.html
@@ -1,5 +1,5 @@
-
-
-
SLF4J based implementation of commons-logging wrapper APIs.
-
-
+
+
+
SLF4J based implementation of commons-logging wrapper APIs.
+
+
diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/package.html b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/package.html
old file mode 100644
new file mode 100755
index 735d6cf..014e85a 100755
--- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/package.html
+++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/package.html
@@ -1,169 +1,169 @@
-
-
-
-
Jakarta Commons Logging implemented over SLF4J.
-
-
-
Overview
-
-
This package contains the same public user interface as Jakarta Commons
-Logging (JCL). It is intended as a 100% compatible drop-in
-replacement for the original JCL version 1.0.4.
-
-
-
As the original JCL version 1.0.4, the present version supports
-various logging APIs. It differs from the original in implementation
-but not the public API. This implementation uses SLF4J under the
-covers. As as such, all the logging systems that SLF4J supports,
-e.g. NOP, Simple, JDK14, nlog4j are supported by this version of JCL.
-
-
-
Quick Start Guide
-
-
For those impatient to just get on with it, the following example
-illustrates the typical declaration and use of a logger that is named (by
-convention) after the calling class:
-
-
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
-
- public class Foo {
-
- static Log log = LogFactory.getLog(Foo.class);
-
- public void foo() {
- ...
- try {
- if (log.isDebugEnabled()) {
- log.debug("About to do something to object " + name);
- }
- name.bar();
- } catch (IllegalStateException e) {
- log.error("Something bad happened to " + name, e);
- }
- ...
- }
-
-
-
Configuring the Commons Logging Package
-
-
In this version of JCL, the selection of the logging system to use
-is chosen by the underlying SLF4J API. Consequently, all JCL-specific
-configuration parameters are ignored.
-
-
-
Choosing a LogFactory Implementation
-
-
From an application perspective, the first requirement is to
-retrieve an object reference to the LogFactory instance
-that will be used to create Log
-instances for this application. This is normally accomplished by
-calling the static getFactory() method. This method
-always returns the same factory, i.e. a unique instance of the SLF4FLogFactory class.
-
-
-
-
-
Configuring the Underlying Logging System
-
-
The basic principle is that the user is totally responsible for the
-configuration of the underlying logging system.
-Commons-logging should not change the existing configuration.
-
-
Each individual Log implementation may
-support its own configuration properties. These will be documented in the
-class descriptions for the corresponding implementation class.
-
-
Finally, some Log implementations (such as the one for Log4J)
-require an external configuration file for the entire logging environment.
-This file should be prepared in a manner that is specific to the actual logging
-technology being used.
-
-
-
Using the Logging Package APIs
-
-
Use of the Logging Package APIs, from the perspective of an application
-component, consists of the following steps:
-
-
Acquire a reference to an instance of
- org.apache.commons.logging.Log, by calling the
- factory method
-
- LogFactory.getInstance(String name). Your application can contain
- references to multiple loggers that are used for different
- purposes. A typical scenario for a server application is to have each
- major component of the server use its own Log instance.
-
Cause messages to be logged (if the corresponding detail level is enabled)
- by calling appropriate methods (trace(), debug(),
- info(), warn(), error, and
- fatal()).
-
-
-
For convenience, LogFactory also offers a static method
-getLog() that combines the typical two-step pattern:
For example, you might use the following technique to initialize and
-use a Log instance in an application component:
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class MyComponent {
-
- protected static Log log =
- LogFactory.getLog(MyComponent.class);
-
- // Called once at startup time
- public void start() {
- ...
- log.info("MyComponent started");
- ...
- }
-
- // Called once at shutdown time
- public void stop() {
- ...
- log.info("MyComponent stopped");
- ...
- }
-
- // Called repeatedly to process a particular argument value
- // which you want logged if debugging is enabled
- public void process(String value) {
- ...
- // Do the string concatenation only if logging is enabled
- if (log.isDebugEnabled())
- log.debug("MyComponent processing " + value);
- ...
- }
-
-}
-
-
-
+
+
+
+
Jakarta Commons Logging implemented over SLF4J.
+
+
+
Overview
+
+
This package contains the same public user interface as Jakarta Commons
+Logging (JCL). It is intended as a 100% compatible drop-in
+replacement for the original JCL version 1.0.4.
+
+
+
As the original JCL version 1.0.4, the present version supports
+various logging APIs. It differs from the original in implementation
+but not the public API. This implementation uses SLF4J under the
+covers. As as such, all the logging systems that SLF4J supports,
+e.g. NOP, Simple, JDK14, nlog4j are supported by this version of JCL.
+
+
+
Quick Start Guide
+
+
For those impatient to just get on with it, the following example
+illustrates the typical declaration and use of a logger that is named (by
+convention) after the calling class:
+
+
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+
+ public class Foo {
+
+ static Log log = LogFactory.getLog(Foo.class);
+
+ public void foo() {
+ ...
+ try {
+ if (log.isDebugEnabled()) {
+ log.debug("About to do something to object " + name);
+ }
+ name.bar();
+ } catch (IllegalStateException e) {
+ log.error("Something bad happened to " + name, e);
+ }
+ ...
+ }
+
+
+
Configuring the Commons Logging Package
+
+
In this version of JCL, the selection of the logging system to use
+is chosen by the underlying SLF4J API. Consequently, all JCL-specific
+configuration parameters are ignored.
+
+
+
Choosing a LogFactory Implementation
+
+
From an application perspective, the first requirement is to
+retrieve an object reference to the LogFactory instance
+that will be used to create Log
+instances for this application. This is normally accomplished by
+calling the static getFactory() method. This method
+always returns the same factory, i.e. a unique instance of the SLF4FLogFactory class.
+
+
+
+
+
Configuring the Underlying Logging System
+
+
The basic principle is that the user is totally responsible for the
+configuration of the underlying logging system.
+Commons-logging should not change the existing configuration.
+
+
Each individual Log implementation may
+support its own configuration properties. These will be documented in the
+class descriptions for the corresponding implementation class.
+
+
Finally, some Log implementations (such as the one for Log4J)
+require an external configuration file for the entire logging environment.
+This file should be prepared in a manner that is specific to the actual logging
+technology being used.
+
+
+
Using the Logging Package APIs
+
+
Use of the Logging Package APIs, from the perspective of an application
+component, consists of the following steps:
+
+
Acquire a reference to an instance of
+ org.apache.commons.logging.Log, by calling the
+ factory method
+
+ LogFactory.getInstance(String name). Your application can contain
+ references to multiple loggers that are used for different
+ purposes. A typical scenario for a server application is to have each
+ major component of the server use its own Log instance.
+
Cause messages to be logged (if the corresponding detail level is enabled)
+ by calling appropriate methods (trace(), debug(),
+ info(), warn(), error, and
+ fatal()).
+
+
+
For convenience, LogFactory also offers a static method
+getLog() that combines the typical two-step pattern:
For example, you might use the following technique to initialize and
+use a Log instance in an application component:
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class MyComponent {
+
+ protected static Log log =
+ LogFactory.getLog(MyComponent.class);
+
+ // Called once at startup time
+ public void start() {
+ ...
+ log.info("MyComponent started");
+ ...
+ }
+
+ // Called once at shutdown time
+ public void stop() {
+ ...
+ log.info("MyComponent stopped");
+ ...
+ }
+
+ // Called repeatedly to process a particular argument value
+ // which you want logged if debugging is enabled
+ public void process(String value) {
+ ...
+ // Do the string concatenation only if logging is enabled
+ if (log.isDebugEnabled())
+ log.debug("MyComponent processing " + value);
+ ...
+ }
+
+}
+
+
+
diff --git a/jcl-over-slf4j/src/main/resources/META-INF/MANIFEST.MF b/jcl-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
old file mode 100644
new file mode 100755
index ae8f969..bb1d43e 100755
--- a/jcl-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
+++ b/jcl-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
@@ -1,9 +1,9 @@
-Implementation-Title: jcl-over-slf4j
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: jcl.over.slf4j
-Bundle-Name: jcl-over-slf4j
-Bundle-Vendor: SLF4J.ORG
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.apache.commons.logging;version=1.2,
- org.apache.commons.logging.impl;version=1.2
-Import-Package: org.slf4j;version=${parsedVersion.osgiVersion}, org.slf4j.spi;version=${parsedVersion.osgiVersion}
+Implementation-Title: jcl-over-slf4j
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: jcl.over.slf4j
+Bundle-Name: jcl-over-slf4j
+Bundle-Vendor: SLF4J.ORG
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.apache.commons.logging;version=1.2,
+ org.apache.commons.logging.impl;version=1.2
+Import-Package: org.slf4j;version=${parsedVersion.osgiVersion}, org.slf4j.spi;version=${parsedVersion.osgiVersion}
diff --git a/jcl-over-slf4j/src/main/resources/META-INF/services/org.apache.commons.logging.LogFactory b/jcl-over-slf4j/src/main/resources/META-INF/services/org.apache.commons.logging.LogFactory
index 50a7c3b..8cece6f 100644
--- a/jcl-over-slf4j/src/main/resources/META-INF/services/org.apache.commons.logging.LogFactory
+++ b/jcl-over-slf4j/src/main/resources/META-INF/services/org.apache.commons.logging.LogFactory
@@ -1,5 +1,5 @@
-org.apache.commons.logging.impl.SLF4JLogFactory
-
-# Axis gets at JCL through its own mechanism as defined by Commons Discovery, which
-# in turn follows the instructions found at:
-# http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service Provider
+org.apache.commons.logging.impl.SLF4JLogFactory
+
+# Axis gets at JCL through its own mechanism as defined by Commons Discovery, which
+# in turn follows the instructions found at:
+# http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service Provider
diff --git a/jcl-over-slf4j/src/test/java/org/apache/commons/logging/InvokeJCLTest.java b/jcl-over-slf4j/src/test/java/org/apache/commons/logging/InvokeJCLTest.java
index f75240a..1cef216 100644
--- a/jcl-over-slf4j/src/test/java/org/apache/commons/logging/InvokeJCLTest.java
+++ b/jcl-over-slf4j/src/test/java/org/apache/commons/logging/InvokeJCLTest.java
@@ -1,88 +1,88 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package org.apache.commons.logging;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-public class InvokeJCLTest {
-
- @Test
- public void testIsEnabledAPI() {
- // assume that we are running over slf4j-jdk14
- Log log = LogFactory.getLog(InvokeJCLTest.class);
- assertFalse(log.isTraceEnabled());
- assertFalse(log.isDebugEnabled());
- assertTrue(log.isInfoEnabled());
- assertTrue(log.isWarnEnabled());
- assertTrue(log.isErrorEnabled());
- assertTrue(log.isFatalEnabled());
- }
-
- @Test
- public void testPrintAPI() {
- Log log = LogFactory.getLog(InvokeJCLTest.class);
- Exception e = new Exception("just testing");
-
- log.trace(null);
- log.trace("trace message");
-
- log.debug(null);
- log.debug("debug message");
-
- log.info(null);
- log.info("info message");
-
- log.warn(null);
- log.warn("warn message");
-
- log.error(null);
- log.error("error message");
-
- log.fatal(null);
- log.fatal("fatal message");
-
- log.trace(null, e);
- log.trace("trace message", e);
-
- log.debug(null, e);
- log.debug("debug message", e);
-
- log.info(null, e);
- log.info("info message", e);
-
- log.warn(null, e);
- log.warn("warn message", e);
-
- log.error(null, e);
- log.error("error message", e);
-
- log.fatal(null, e);
- log.fatal("fatal message", e);
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package org.apache.commons.logging;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class InvokeJCLTest {
+
+ @Test
+ public void testIsEnabledAPI() {
+ // assume that we are running over slf4j-jdk14
+ Log log = LogFactory.getLog(InvokeJCLTest.class);
+ assertFalse(log.isTraceEnabled());
+ assertFalse(log.isDebugEnabled());
+ assertTrue(log.isInfoEnabled());
+ assertTrue(log.isWarnEnabled());
+ assertTrue(log.isErrorEnabled());
+ assertTrue(log.isFatalEnabled());
+ }
+
+ @Test
+ public void testPrintAPI() {
+ Log log = LogFactory.getLog(InvokeJCLTest.class);
+ Exception e = new Exception("just testing");
+
+ log.trace(null);
+ log.trace("trace message");
+
+ log.debug(null);
+ log.debug("debug message");
+
+ log.info(null);
+ log.info("info message");
+
+ log.warn(null);
+ log.warn("warn message");
+
+ log.error(null);
+ log.error("error message");
+
+ log.fatal(null);
+ log.fatal("fatal message");
+
+ log.trace(null, e);
+ log.trace("trace message", e);
+
+ log.debug(null, e);
+ log.debug("debug message", e);
+
+ log.info(null, e);
+ log.info("info message", e);
+
+ log.warn(null, e);
+ log.warn("warn message", e);
+
+ log.error(null, e);
+ log.error("error message", e);
+
+ log.fatal(null, e);
+ log.fatal("fatal message", e);
+ }
+}
diff --git a/jcl-over-slf4j/src/test/java/org/apache/commons/logging/impl/SerializationTest.java b/jcl-over-slf4j/src/test/java/org/apache/commons/logging/impl/SerializationTest.java
index d0e6a20..4b67861 100644
--- a/jcl-over-slf4j/src/test/java/org/apache/commons/logging/impl/SerializationTest.java
+++ b/jcl-over-slf4j/src/test/java/org/apache/commons/logging/impl/SerializationTest.java
@@ -1,89 +1,89 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.apache.commons.logging.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.impl.JDK14LoggerFactory;
-import org.slf4j.spi.LocationAwareLogger;
-
-public class SerializationTest {
-
- ObjectInputStream ois;
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos;
-
- @Before
- public void setUp() throws Exception {
- oos = new ObjectOutputStream(baos);
- }
-
- @After
- public void tearDown() throws Exception {
- oos.close();
- }
-
- public void verify() throws IOException, ClassNotFoundException {
- ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
- ois = new ObjectInputStream(bis);
-
- Log resuscitatedLog = (Log) ois.readObject();
- // tests that the "private transient Logger logger" field is non-null
- resuscitatedLog.debug("");
- resuscitatedLog.isDebugEnabled();
- }
-
- @Test
- public void testSLF4JLog() throws Exception {
- JDK14LoggerFactory factory = new JDK14LoggerFactory();
- SLF4JLog log = new SLF4JLog(factory.getLogger("x"));
- oos.writeObject(log);
- verify();
- }
-
- @Test
- public void testSmoke() throws Exception {
- Log log = LogFactory.getLog("testing");
- oos.writeObject(log);
- verify();
- }
-
- @Test
- public void testLocationAware() throws Exception {
- JDK14LoggerFactory factory = new JDK14LoggerFactory();
- SLF4JLocationAwareLog log = new SLF4JLocationAwareLog((LocationAwareLogger) factory.getLogger("x"));
- oos.writeObject(log);
- verify();
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.apache.commons.logging.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.impl.JDK14LoggerFactory;
+import org.slf4j.spi.LocationAwareLogger;
+
+public class SerializationTest {
+
+ ObjectInputStream ois;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos;
+
+ @Before
+ public void setUp() throws Exception {
+ oos = new ObjectOutputStream(baos);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ oos.close();
+ }
+
+ public void verify() throws IOException, ClassNotFoundException {
+ ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
+ ois = new ObjectInputStream(bis);
+
+ Log resuscitatedLog = (Log) ois.readObject();
+ // tests that the "private transient Logger logger" field is non-null
+ resuscitatedLog.debug("");
+ resuscitatedLog.isDebugEnabled();
+ }
+
+ @Test
+ public void testSLF4JLog() throws Exception {
+ JDK14LoggerFactory factory = new JDK14LoggerFactory();
+ SLF4JLog log = new SLF4JLog(factory.getLogger("x"));
+ oos.writeObject(log);
+ verify();
+ }
+
+ @Test
+ public void testSmoke() throws Exception {
+ Log log = LogFactory.getLog("testing");
+ oos.writeObject(log);
+ verify();
+ }
+
+ @Test
+ public void testLocationAware() throws Exception {
+ JDK14LoggerFactory factory = new JDK14LoggerFactory();
+ SLF4JLocationAwareLog log = new SLF4JLocationAwareLog((LocationAwareLogger) factory.getLogger("x"));
+ oos.writeObject(log);
+ verify();
+ }
+}
diff --git a/jul-to-slf4j/pom.xml b/jul-to-slf4j/pom.xml
old file mode 100644
new file mode 100755
index d9ed8c5..9f1c8b2 100755
--- a/jul-to-slf4j/pom.xml
+++ b/jul-to-slf4j/pom.xml
@@ -1,34 +1,34 @@
-
-
-
- 4.0.0
-
-
- org.slf4j
- slf4j-parent
- 1.7.25
-
-
- jul-to-slf4j
-
- jar
- JUL to SLF4J bridge
- JUL to SLF4J bridge
-
- http://www.slf4j.org
-
-
-
- org.slf4j
- slf4j-api
-
-
- org.slf4j
- slf4j-log4j12
- ${project.version}
- test
-
-
-
-
\ No newline at end of file
+
+
+
+ 4.0.0
+
+
+ org.slf4j
+ slf4j-parent
+ 1.7.26
+
+
+ jul-to-slf4j
+
+ jar
+ JUL to SLF4J bridge
+ JUL to SLF4J bridge
+
+ http://www.slf4j.org
+
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-log4j12
+ ${project.version}
+ test
+
+
+
+
diff --git a/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java b/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java
old file mode 100644
new file mode 100755
index fe62f19..8e125cf 100755
--- a/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java
+++ b/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java
@@ -1,309 +1,309 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.bridge;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.LogRecord;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.spi.LocationAwareLogger;
-
-// Based on http://jira.qos.ch/browse/SLF4J-30
-
-/**
- *
Bridge/route all JUL log records to the SLF4J API.
- *
Essentially, the idea is to install on the root logger an instance of
- * SLF4JBridgeHandler as the sole JUL handler in the system. Subsequently, the
- * SLF4JBridgeHandler instance will redirect all JUL log records are redirected
- * to the SLF4J API based on the following mapping of levels:
- *
- *
- * FINEST -> TRACE
- * FINER -> DEBUG
- * FINE -> DEBUG
- * INFO -> INFO
- * WARNING -> WARN
- * SEVERE -> ERROR
- *
Programmatic installation:
- *
- * // Optionally remove existing handlers attached to j.u.l root logger
- * SLF4JBridgeHandler.removeHandlersForRootLogger(); // (since SLF4J 1.6.5)
-
- * // add SLF4JBridgeHandler to j.u.l's root logger, should be done once during
- * // the initialization phase of your application
- * SLF4JBridgeHandler.install();
- *
Installation via logging.properties configuration file:
- *
- * // register SLF4JBridgeHandler as handler for the j.u.l. root logger
- * handlers = org.slf4j.bridge.SLF4JBridgeHandler
- *
Once SLF4JBridgeHandler is installed, logging by j.u.l. loggers will be directed to
- * SLF4J. Example:
- *
- * import java.util.logging.Logger;
- * ...
- * // usual pattern: get a Logger and then log a message
- * Logger julLogger = Logger.getLogger("org.wombat");
- * julLogger.fine("hello world"); // this will get redirected to SLF4J
- *
- *
Please note that translating a java.util.logging event into SLF4J incurs the
- * cost of constructing {@link LogRecord} instance regardless of whether the
- * SLF4J logger is disabled for the given level. Consequently, j.u.l. to
- * SLF4J translation can seriously increase the cost of disabled logging
- * statements (60 fold or 6000% increase) and measurably impact the performance of enabled log
- * statements (20% overall increase). Please note that as of logback-version 0.9.25,
- * it is possible to completely eliminate the 60 fold translation overhead for disabled
- * log statements with the help of LevelChangePropagator.
- *
- *
- *
If you are concerned about application performance, then use of SLF4JBridgeHandler
- * is appropriate only if any one the following two conditions is true:
- *
- *
few j.u.l. logging statements are in play
- *
LevelChangePropagator has been installed
- *
- *
- * @author Christian Stein
- * @author Joern Huxhorn
- * @author Ceki Gülcü
- * @author Darryl Smith
- * @since 1.5.1
- */
-public class SLF4JBridgeHandler extends Handler {
-
- // The caller is java.util.logging.Logger
- private static final String FQCN = java.util.logging.Logger.class.getName();
- private static final String UNKNOWN_LOGGER_NAME = "unknown.jul.logger";
-
- private static final int TRACE_LEVEL_THRESHOLD = Level.FINEST.intValue();
- private static final int DEBUG_LEVEL_THRESHOLD = Level.FINE.intValue();
- private static final int INFO_LEVEL_THRESHOLD = Level.INFO.intValue();
- private static final int WARN_LEVEL_THRESHOLD = Level.WARNING.intValue();
-
- /**
- * Adds a SLF4JBridgeHandler instance to jul's root logger.
- *
- *
- * This handler will redirect j.u.l. logging to SLF4J. However, only logs enabled
- * in j.u.l. will be redirected. For example, if a log statement invoking a
- * j.u.l. logger is disabled, then the corresponding non-event will not
- * reach SLF4JBridgeHandler and cannot be redirected.
- */
- public static void install() {
- LogManager.getLogManager().getLogger("").addHandler(new SLF4JBridgeHandler());
- }
-
- private static java.util.logging.Logger getRootLogger() {
- return LogManager.getLogManager().getLogger("");
- }
-
- /**
- * Removes previously installed SLF4JBridgeHandler instances. See also
- * {@link #install()}.
- *
- * @throws SecurityException A SecurityException is thrown, if a security manager
- * exists and if the caller does not have
- * LoggingPermission("control").
- */
- public static void uninstall() throws SecurityException {
- java.util.logging.Logger rootLogger = getRootLogger();
- Handler[] handlers = rootLogger.getHandlers();
- for (int i = 0; i < handlers.length; i++) {
- if (handlers[i] instanceof SLF4JBridgeHandler) {
- rootLogger.removeHandler(handlers[i]);
- }
- }
- }
-
- /**
- * Returns true if SLF4JBridgeHandler has been previously installed, returns false otherwise.
- *
- * @return true if SLF4JBridgeHandler is already installed, false other wise
- * @throws SecurityException
- */
- public static boolean isInstalled() throws SecurityException {
- java.util.logging.Logger rootLogger = getRootLogger();
- Handler[] handlers = rootLogger.getHandlers();
- for (int i = 0; i < handlers.length; i++) {
- if (handlers[i] instanceof SLF4JBridgeHandler) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Invoking this method removes/unregisters/detaches all handlers currently attached to the root logger
- * @since 1.6.5
- */
- public static void removeHandlersForRootLogger() {
- java.util.logging.Logger rootLogger = getRootLogger();
- java.util.logging.Handler[] handlers = rootLogger.getHandlers();
- for (int i = 0; i < handlers.length; i++) {
- rootLogger.removeHandler(handlers[i]);
- }
- }
-
- /**
- * Initialize this handler.
- */
- public SLF4JBridgeHandler() {
- }
-
- /**
- * No-op implementation.
- */
- public void close() {
- // empty
- }
-
- /**
- * No-op implementation.
- */
- public void flush() {
- // empty
- }
-
- /**
- * Return the Logger instance that will be used for logging.
- */
- protected Logger getSLF4JLogger(LogRecord record) {
- String name = record.getLoggerName();
- if (name == null) {
- name = UNKNOWN_LOGGER_NAME;
- }
- return LoggerFactory.getLogger(name);
- }
-
- protected void callLocationAwareLogger(LocationAwareLogger lal, LogRecord record) {
- int julLevelValue = record.getLevel().intValue();
- int slf4jLevel;
-
- if (julLevelValue <= TRACE_LEVEL_THRESHOLD) {
- slf4jLevel = LocationAwareLogger.TRACE_INT;
- } else if (julLevelValue <= DEBUG_LEVEL_THRESHOLD) {
- slf4jLevel = LocationAwareLogger.DEBUG_INT;
- } else if (julLevelValue <= INFO_LEVEL_THRESHOLD) {
- slf4jLevel = LocationAwareLogger.INFO_INT;
- } else if (julLevelValue <= WARN_LEVEL_THRESHOLD) {
- slf4jLevel = LocationAwareLogger.WARN_INT;
- } else {
- slf4jLevel = LocationAwareLogger.ERROR_INT;
- }
- String i18nMessage = getMessageI18N(record);
- lal.log(null, FQCN, slf4jLevel, i18nMessage, null, record.getThrown());
- }
-
- protected void callPlainSLF4JLogger(Logger slf4jLogger, LogRecord record) {
- String i18nMessage = getMessageI18N(record);
- int julLevelValue = record.getLevel().intValue();
- if (julLevelValue <= TRACE_LEVEL_THRESHOLD) {
- slf4jLogger.trace(i18nMessage, record.getThrown());
- } else if (julLevelValue <= DEBUG_LEVEL_THRESHOLD) {
- slf4jLogger.debug(i18nMessage, record.getThrown());
- } else if (julLevelValue <= INFO_LEVEL_THRESHOLD) {
- slf4jLogger.info(i18nMessage, record.getThrown());
- } else if (julLevelValue <= WARN_LEVEL_THRESHOLD) {
- slf4jLogger.warn(i18nMessage, record.getThrown());
- } else {
- slf4jLogger.error(i18nMessage, record.getThrown());
- }
- }
-
- /**
- * Get the record's message, possibly via a resource bundle.
- *
- * @param record
- * @return
- */
- private String getMessageI18N(LogRecord record) {
- String message = record.getMessage();
-
- if (message == null) {
- return null;
- }
-
- ResourceBundle bundle = record.getResourceBundle();
- if (bundle != null) {
- try {
- message = bundle.getString(message);
- } catch (MissingResourceException e) {
- }
- }
- Object[] params = record.getParameters();
- // avoid formatting when there are no or 0 parameters. see also
- // http://jira.qos.ch/browse/SLF4J-203
- if (params != null && params.length > 0) {
- try {
- message = MessageFormat.format(message, params);
- } catch (IllegalArgumentException e) {
- // default to the same behavior as in java.util.logging.Formatter.formatMessage(LogRecord)
- // see also http://jira.qos.ch/browse/SLF4J-337
- return message;
- }
- }
- return message;
- }
-
- /**
- * Publish a LogRecord.
- *
- * The logging request was made initially to a Logger object, which
- * initialized the LogRecord and forwarded it here.
- *
- * This handler ignores the Level attached to the LogRecord, as SLF4J cares
- * about discarding log statements.
- *
- * @param record Description of the log event. A null record is silently ignored
- * and is not published.
- */
- public void publish(LogRecord record) {
- // Silently ignore null records.
- if (record == null) {
- return;
- }
-
- Logger slf4jLogger = getSLF4JLogger(record);
- String message = record.getMessage(); // can be null!
- // this is a check to avoid calling the underlying logging system
- // with a null message. While it is legitimate to invoke j.u.l. with
- // a null message, other logging frameworks do not support this.
- // see also http://jira.qos.ch/browse/SLF4J-99
- if (message == null) {
- message = "";
- }
- if (slf4jLogger instanceof LocationAwareLogger) {
- callLocationAwareLogger((LocationAwareLogger) slf4jLogger, record);
- } else {
- callPlainSLF4JLogger(slf4jLogger, record);
- }
- }
-
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.bridge;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.LogRecord;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.spi.LocationAwareLogger;
+
+// Based on http://jira.qos.ch/browse/SLF4J-30
+
+/**
+ *
Bridge/route all JUL log records to the SLF4J API.
+ *
Essentially, the idea is to install on the root logger an instance of
+ * SLF4JBridgeHandler as the sole JUL handler in the system. Subsequently, the
+ * SLF4JBridgeHandler instance will redirect all JUL log records are redirected
+ * to the SLF4J API based on the following mapping of levels:
+ *
+ *
+ * FINEST -> TRACE
+ * FINER -> DEBUG
+ * FINE -> DEBUG
+ * INFO -> INFO
+ * WARNING -> WARN
+ * SEVERE -> ERROR
+ *
Programmatic installation:
+ *
+ * // Optionally remove existing handlers attached to j.u.l root logger
+ * SLF4JBridgeHandler.removeHandlersForRootLogger(); // (since SLF4J 1.6.5)
+
+ * // add SLF4JBridgeHandler to j.u.l's root logger, should be done once during
+ * // the initialization phase of your application
+ * SLF4JBridgeHandler.install();
+ *
Installation via logging.properties configuration file:
+ *
+ * // register SLF4JBridgeHandler as handler for the j.u.l. root logger
+ * handlers = org.slf4j.bridge.SLF4JBridgeHandler
+ *
Once SLF4JBridgeHandler is installed, logging by j.u.l. loggers will be directed to
+ * SLF4J. Example:
+ *
+ * import java.util.logging.Logger;
+ * ...
+ * // usual pattern: get a Logger and then log a message
+ * Logger julLogger = Logger.getLogger("org.wombat");
+ * julLogger.fine("hello world"); // this will get redirected to SLF4J
+ *
+ *
Please note that translating a java.util.logging event into SLF4J incurs the
+ * cost of constructing {@link LogRecord} instance regardless of whether the
+ * SLF4J logger is disabled for the given level. Consequently, j.u.l. to
+ * SLF4J translation can seriously increase the cost of disabled logging
+ * statements (60 fold or 6000% increase) and measurably impact the performance of enabled log
+ * statements (20% overall increase). Please note that as of logback-version 0.9.25,
+ * it is possible to completely eliminate the 60 fold translation overhead for disabled
+ * log statements with the help of LevelChangePropagator.
+ *
+ *
+ *
If you are concerned about application performance, then use of SLF4JBridgeHandler
+ * is appropriate only if any one the following two conditions is true:
+ *
+ *
few j.u.l. logging statements are in play
+ *
LevelChangePropagator has been installed
+ *
+ *
+ * @author Christian Stein
+ * @author Joern Huxhorn
+ * @author Ceki Gülcü
+ * @author Darryl Smith
+ * @since 1.5.1
+ */
+public class SLF4JBridgeHandler extends Handler {
+
+ // The caller is java.util.logging.Logger
+ private static final String FQCN = java.util.logging.Logger.class.getName();
+ private static final String UNKNOWN_LOGGER_NAME = "unknown.jul.logger";
+
+ private static final int TRACE_LEVEL_THRESHOLD = Level.FINEST.intValue();
+ private static final int DEBUG_LEVEL_THRESHOLD = Level.FINE.intValue();
+ private static final int INFO_LEVEL_THRESHOLD = Level.INFO.intValue();
+ private static final int WARN_LEVEL_THRESHOLD = Level.WARNING.intValue();
+
+ /**
+ * Adds a SLF4JBridgeHandler instance to jul's root logger.
+ *
+ *
+ * This handler will redirect j.u.l. logging to SLF4J. However, only logs enabled
+ * in j.u.l. will be redirected. For example, if a log statement invoking a
+ * j.u.l. logger is disabled, then the corresponding non-event will not
+ * reach SLF4JBridgeHandler and cannot be redirected.
+ */
+ public static void install() {
+ LogManager.getLogManager().getLogger("").addHandler(new SLF4JBridgeHandler());
+ }
+
+ private static java.util.logging.Logger getRootLogger() {
+ return LogManager.getLogManager().getLogger("");
+ }
+
+ /**
+ * Removes previously installed SLF4JBridgeHandler instances. See also
+ * {@link #install()}.
+ *
+ * @throws SecurityException A SecurityException is thrown, if a security manager
+ * exists and if the caller does not have
+ * LoggingPermission("control").
+ */
+ public static void uninstall() throws SecurityException {
+ java.util.logging.Logger rootLogger = getRootLogger();
+ Handler[] handlers = rootLogger.getHandlers();
+ for (int i = 0; i < handlers.length; i++) {
+ if (handlers[i] instanceof SLF4JBridgeHandler) {
+ rootLogger.removeHandler(handlers[i]);
+ }
+ }
+ }
+
+ /**
+ * Returns true if SLF4JBridgeHandler has been previously installed, returns false otherwise.
+ *
+ * @return true if SLF4JBridgeHandler is already installed, false other wise
+ * @throws SecurityException
+ */
+ public static boolean isInstalled() throws SecurityException {
+ java.util.logging.Logger rootLogger = getRootLogger();
+ Handler[] handlers = rootLogger.getHandlers();
+ for (int i = 0; i < handlers.length; i++) {
+ if (handlers[i] instanceof SLF4JBridgeHandler) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Invoking this method removes/unregisters/detaches all handlers currently attached to the root logger
+ * @since 1.6.5
+ */
+ public static void removeHandlersForRootLogger() {
+ java.util.logging.Logger rootLogger = getRootLogger();
+ java.util.logging.Handler[] handlers = rootLogger.getHandlers();
+ for (int i = 0; i < handlers.length; i++) {
+ rootLogger.removeHandler(handlers[i]);
+ }
+ }
+
+ /**
+ * Initialize this handler.
+ */
+ public SLF4JBridgeHandler() {
+ }
+
+ /**
+ * No-op implementation.
+ */
+ public void close() {
+ // empty
+ }
+
+ /**
+ * No-op implementation.
+ */
+ public void flush() {
+ // empty
+ }
+
+ /**
+ * Return the Logger instance that will be used for logging.
+ */
+ protected Logger getSLF4JLogger(LogRecord record) {
+ String name = record.getLoggerName();
+ if (name == null) {
+ name = UNKNOWN_LOGGER_NAME;
+ }
+ return LoggerFactory.getLogger(name);
+ }
+
+ protected void callLocationAwareLogger(LocationAwareLogger lal, LogRecord record) {
+ int julLevelValue = record.getLevel().intValue();
+ int slf4jLevel;
+
+ if (julLevelValue <= TRACE_LEVEL_THRESHOLD) {
+ slf4jLevel = LocationAwareLogger.TRACE_INT;
+ } else if (julLevelValue <= DEBUG_LEVEL_THRESHOLD) {
+ slf4jLevel = LocationAwareLogger.DEBUG_INT;
+ } else if (julLevelValue <= INFO_LEVEL_THRESHOLD) {
+ slf4jLevel = LocationAwareLogger.INFO_INT;
+ } else if (julLevelValue <= WARN_LEVEL_THRESHOLD) {
+ slf4jLevel = LocationAwareLogger.WARN_INT;
+ } else {
+ slf4jLevel = LocationAwareLogger.ERROR_INT;
+ }
+ String i18nMessage = getMessageI18N(record);
+ lal.log(null, FQCN, slf4jLevel, i18nMessage, null, record.getThrown());
+ }
+
+ protected void callPlainSLF4JLogger(Logger slf4jLogger, LogRecord record) {
+ String i18nMessage = getMessageI18N(record);
+ int julLevelValue = record.getLevel().intValue();
+ if (julLevelValue <= TRACE_LEVEL_THRESHOLD) {
+ slf4jLogger.trace(i18nMessage, record.getThrown());
+ } else if (julLevelValue <= DEBUG_LEVEL_THRESHOLD) {
+ slf4jLogger.debug(i18nMessage, record.getThrown());
+ } else if (julLevelValue <= INFO_LEVEL_THRESHOLD) {
+ slf4jLogger.info(i18nMessage, record.getThrown());
+ } else if (julLevelValue <= WARN_LEVEL_THRESHOLD) {
+ slf4jLogger.warn(i18nMessage, record.getThrown());
+ } else {
+ slf4jLogger.error(i18nMessage, record.getThrown());
+ }
+ }
+
+ /**
+ * Get the record's message, possibly via a resource bundle.
+ *
+ * @param record
+ * @return
+ */
+ private String getMessageI18N(LogRecord record) {
+ String message = record.getMessage();
+
+ if (message == null) {
+ return null;
+ }
+
+ ResourceBundle bundle = record.getResourceBundle();
+ if (bundle != null) {
+ try {
+ message = bundle.getString(message);
+ } catch (MissingResourceException e) {
+ }
+ }
+ Object[] params = record.getParameters();
+ // avoid formatting when there are no or 0 parameters. see also
+ // http://jira.qos.ch/browse/SLF4J-203
+ if (params != null && params.length > 0) {
+ try {
+ message = MessageFormat.format(message, params);
+ } catch (IllegalArgumentException e) {
+ // default to the same behavior as in java.util.logging.Formatter.formatMessage(LogRecord)
+ // see also http://jira.qos.ch/browse/SLF4J-337
+ return message;
+ }
+ }
+ return message;
+ }
+
+ /**
+ * Publish a LogRecord.
+ *
+ * The logging request was made initially to a Logger object, which
+ * initialized the LogRecord and forwarded it here.
+ *
+ * This handler ignores the Level attached to the LogRecord, as SLF4J cares
+ * about discarding log statements.
+ *
+ * @param record Description of the log event. A null record is silently ignored
+ * and is not published.
+ */
+ public void publish(LogRecord record) {
+ // Silently ignore null records.
+ if (record == null) {
+ return;
+ }
+
+ Logger slf4jLogger = getSLF4JLogger(record);
+ String message = record.getMessage(); // can be null!
+ // this is a check to avoid calling the underlying logging system
+ // with a null message. While it is legitimate to invoke j.u.l. with
+ // a null message, other logging frameworks do not support this.
+ // see also http://jira.qos.ch/browse/SLF4J-99
+ if (message == null) {
+ message = "";
+ }
+ if (slf4jLogger instanceof LocationAwareLogger) {
+ callLocationAwareLogger((LocationAwareLogger) slf4jLogger, record);
+ } else {
+ callPlainSLF4JLogger(slf4jLogger, record);
+ }
+ }
+
+}
diff --git a/jul-to-slf4j/src/main/java/org/slf4j/bridge/package.html b/jul-to-slf4j/src/main/java/org/slf4j/bridge/package.html
index 37927ff..2b643c3 100644
--- a/jul-to-slf4j/src/main/java/org/slf4j/bridge/package.html
+++ b/jul-to-slf4j/src/main/java/org/slf4j/bridge/package.html
@@ -1,15 +1,15 @@
-
-
-
-
-
-
-
-
-
-
-
Bridge/route all JUL log records to the SLF4J API.
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
Bridge/route all JUL log records to the SLF4J API.
+
+
+
+
diff --git a/jul-to-slf4j/src/main/resources/META-INF/MANIFEST.MF b/jul-to-slf4j/src/main/resources/META-INF/MANIFEST.MF
index 3cca8c6..e1ab4c0 100644
--- a/jul-to-slf4j/src/main/resources/META-INF/MANIFEST.MF
+++ b/jul-to-slf4j/src/main/resources/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: jul.to.slf4j
-Bundle-Name: jul-to-slf4j
-Bundle-Vendor: SLF4J.ORG
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.slf4j.bridge;version=${parsedVersion.osgiVersion};uses:="org.slf4j,org.slf4j.spi"
-Import-Package: org.slf4j;version=${parsedVersion.osgiVersion},org.slf4j.spi;version=${parsedVersion.osgiVersion}
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: jul.to.slf4j
+Bundle-Name: jul-to-slf4j
+Bundle-Vendor: SLF4J.ORG
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.slf4j.bridge;version=${parsedVersion.osgiVersion};uses:="org.slf4j,org.slf4j.spi"
+Import-Package: org.slf4j;version=${parsedVersion.osgiVersion},org.slf4j.spi;version=${parsedVersion.osgiVersion}
diff --git a/jul-to-slf4j/src/test/java/org/slf4j/bridge/ListAppender.java b/jul-to-slf4j/src/test/java/org/slf4j/bridge/ListAppender.java
index 07f3786..e5fb5f3 100644
--- a/jul-to-slf4j/src/test/java/org/slf4j/bridge/ListAppender.java
+++ b/jul-to-slf4j/src/test/java/org/slf4j/bridge/ListAppender.java
@@ -1,53 +1,53 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.bridge;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.AppenderSkeleton;
-import org.apache.log4j.spi.LoggingEvent;
-
-public class ListAppender extends AppenderSkeleton {
-
- public List list = new ArrayList();
-
- public boolean extractLocationInfo = false;
-
- protected void append(LoggingEvent event) {
- list.add(event);
- if (extractLocationInfo) {
- event.getLocationInformation();
- }
- }
-
- public void close() {
- }
-
- public boolean requiresLayout() {
- return false;
- }
-
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.bridge;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.spi.LoggingEvent;
+
+public class ListAppender extends AppenderSkeleton {
+
+ public List list = new ArrayList();
+
+ public boolean extractLocationInfo = false;
+
+ protected void append(LoggingEvent event) {
+ list.add(event);
+ if (extractLocationInfo) {
+ event.getLocationInformation();
+ }
+ }
+
+ public void close() {
+ }
+
+ public boolean requiresLayout() {
+ return false;
+ }
+
+}
diff --git a/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerPerfTest.java b/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerPerfTest.java
index fa20411..604ec1d 100644
--- a/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerPerfTest.java
+++ b/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerPerfTest.java
@@ -1,110 +1,110 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.bridge;
-
-import java.util.logging.Handler;
-import java.util.logging.LogManager;
-
-import org.apache.log4j.FileAppender;
-import org.apache.log4j.PatternLayout;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.LoggerFactory;
-
-public class SLF4JBridgeHandlerPerfTest {
-
- static String LOGGER_NAME = "yay";
- static int RUN_LENGTH = 100 * 1000;
-
- // set to false to test enabled logging performance
- boolean disabledLogger = true;
-
- FileAppender fileAppender;
- org.apache.log4j.Logger log4jRoot;
- java.util.logging.Logger julRootLogger = LogManager.getLogManager().getLogger("");
-
- java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(LOGGER_NAME);
- org.slf4j.Logger slf4jLogger = LoggerFactory.getLogger(LOGGER_NAME);
-
- Handler[] existingHandlers;
-
- @Before
- public void setUp() throws Exception {
- fileAppender = new FileAppender(new PatternLayout("%r [%t] %p %c %x - %m%n"), "target/test-output/toto.log");
-
- existingHandlers = julRootLogger.getHandlers();
- for (int i = 0; i < existingHandlers.length; i++) {
- julRootLogger.removeHandler(existingHandlers[i]);
- }
- log4jRoot = org.apache.log4j.Logger.getRootLogger();
- log4jRoot.addAppender(fileAppender);
- }
-
- @After
- public void tearDown() throws Exception {
- SLF4JBridgeHandler.uninstall();
- fileAppender.close();
- log4jRoot.getLoggerRepository().resetConfiguration();
- for (int i = 0; i < existingHandlers.length; i++) {
- julRootLogger.addHandler(existingHandlers[i]);
- }
- }
-
- double julLoggerLoop() {
- long start = System.nanoTime();
- for (int i = 0; i < RUN_LENGTH; i++) {
- julLogger.info("jul");
- }
- long end = System.nanoTime();
- return (end - start) * 1.0 / RUN_LENGTH;
- }
-
- double slf4jLoggerLoop() {
- long start = System.nanoTime();
- for (int i = 0; i < RUN_LENGTH; i++) {
- slf4jLogger.info("slf4j");
- }
- long end = System.nanoTime();
- return (end - start) * 1.0 / RUN_LENGTH;
- }
-
- @Test
- public void testPerf() {
- SLF4JBridgeHandler.install();
-
- if (disabledLogger) {
- log4jRoot.setLevel(org.apache.log4j.Level.ERROR);
- }
- julLoggerLoop();
- double julAvg = julLoggerLoop();
- System.out.println("Average cost per call (JUL->SLF4J->log4j): " + julAvg + " nanos");
-
- slf4jLoggerLoop();
- double slf4jAvg = slf4jLoggerLoop();
- System.out.println("Average cost per call (SLF4J->log4j): " + slf4jAvg + " nanos");
- System.out.println("Ratio " + (julAvg / slf4jAvg));
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.bridge;
+
+import java.util.logging.Handler;
+import java.util.logging.LogManager;
+
+import org.apache.log4j.FileAppender;
+import org.apache.log4j.PatternLayout;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.LoggerFactory;
+
+public class SLF4JBridgeHandlerPerfTest {
+
+ static String LOGGER_NAME = "yay";
+ static int RUN_LENGTH = 100 * 1000;
+
+ // set to false to test enabled logging performance
+ boolean disabledLogger = true;
+
+ FileAppender fileAppender;
+ org.apache.log4j.Logger log4jRoot;
+ java.util.logging.Logger julRootLogger = LogManager.getLogManager().getLogger("");
+
+ java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(LOGGER_NAME);
+ org.slf4j.Logger slf4jLogger = LoggerFactory.getLogger(LOGGER_NAME);
+
+ Handler[] existingHandlers;
+
+ @Before
+ public void setUp() throws Exception {
+ fileAppender = new FileAppender(new PatternLayout("%r [%t] %p %c %x - %m%n"), "target/test-output/toto.log");
+
+ existingHandlers = julRootLogger.getHandlers();
+ for (int i = 0; i < existingHandlers.length; i++) {
+ julRootLogger.removeHandler(existingHandlers[i]);
+ }
+ log4jRoot = org.apache.log4j.Logger.getRootLogger();
+ log4jRoot.addAppender(fileAppender);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ SLF4JBridgeHandler.uninstall();
+ fileAppender.close();
+ log4jRoot.getLoggerRepository().resetConfiguration();
+ for (int i = 0; i < existingHandlers.length; i++) {
+ julRootLogger.addHandler(existingHandlers[i]);
+ }
+ }
+
+ double julLoggerLoop() {
+ long start = System.nanoTime();
+ for (int i = 0; i < RUN_LENGTH; i++) {
+ julLogger.info("jul");
+ }
+ long end = System.nanoTime();
+ return (end - start) * 1.0 / RUN_LENGTH;
+ }
+
+ double slf4jLoggerLoop() {
+ long start = System.nanoTime();
+ for (int i = 0; i < RUN_LENGTH; i++) {
+ slf4jLogger.info("slf4j");
+ }
+ long end = System.nanoTime();
+ return (end - start) * 1.0 / RUN_LENGTH;
+ }
+
+ @Test
+ public void testPerf() {
+ SLF4JBridgeHandler.install();
+
+ if (disabledLogger) {
+ log4jRoot.setLevel(org.apache.log4j.Level.ERROR);
+ }
+ julLoggerLoop();
+ double julAvg = julLoggerLoop();
+ System.out.println("Average cost per call (JUL->SLF4J->log4j): " + julAvg + " nanos");
+
+ slf4jLoggerLoop();
+ double slf4jAvg = slf4jLoggerLoop();
+ System.out.println("Average cost per call (SLF4J->log4j): " + slf4jAvg + " nanos");
+ System.out.println("Ratio " + (julAvg / slf4jAvg));
+ }
+}
diff --git a/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerTest.java b/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerTest.java
old file mode 100644
new file mode 100755
index d78fbdf..71e4bc5 100755
--- a/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerTest.java
+++ b/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerTest.java
@@ -1,198 +1,198 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.bridge;
-
-import static org.junit.Assert.assertEquals;
-
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-import java.util.logging.Level;
-
-import org.apache.log4j.spi.LocationInfo;
-import org.apache.log4j.spi.LoggingEvent;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SLF4JBridgeHandlerTest {
-
- static String LOGGER_NAME = "yay";
-
- ListAppender listAppender = new ListAppender();
- org.apache.log4j.Logger log4jRoot;
- java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger("yay");
-
- @Before
- public void setUp() throws Exception {
- listAppender.extractLocationInfo = true;
- log4jRoot = org.apache.log4j.Logger.getRootLogger();
- log4jRoot.addAppender(listAppender);
- log4jRoot.setLevel(org.apache.log4j.Level.TRACE);
- }
-
- @After
- public void tearDown() throws Exception {
- SLF4JBridgeHandler.uninstall();
- log4jRoot.getLoggerRepository().resetConfiguration();
- }
-
- @Test
- public void testSmoke() {
- SLF4JBridgeHandler.install();
- String msg = "msg";
- julLogger.info(msg);
- assertEquals(1, listAppender.list.size());
- LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
- assertEquals(LOGGER_NAME, le.getLoggerName());
- assertEquals(msg, le.getMessage());
-
- // get the location info in the event.
- // Note that this must have been computed previously
- // within an appender for the following assertion to
- // work properly
- LocationInfo li = le.getLocationInformation();
- System.out.println(li.fullInfo);
- assertEquals("SLF4JBridgeHandlerTest.java", li.getFileName());
- assertEquals("testSmoke", li.getMethodName());
- }
-
- @Test
- public void testLevels() {
- SLF4JBridgeHandler.install();
- String msg = "msg";
- julLogger.setLevel(Level.ALL);
-
- julLogger.finest(msg);
- julLogger.finer(msg);
- julLogger.fine(msg);
- julLogger.info(msg);
- julLogger.warning(msg);
- julLogger.severe(msg);
-
- assertEquals(6, listAppender.list.size());
- int i = 0;
- assertLevel(i++, org.apache.log4j.Level.TRACE);
- assertLevel(i++, org.apache.log4j.Level.DEBUG);
- assertLevel(i++, org.apache.log4j.Level.DEBUG);
- assertLevel(i++, org.apache.log4j.Level.INFO);
- assertLevel(i++, org.apache.log4j.Level.WARN);
- assertLevel(i++, org.apache.log4j.Level.ERROR);
- }
-
- @Test
- public void testLogWithResourceBundle() {
- SLF4JBridgeHandler.install();
-
- String resourceBundleName = "org.slf4j.bridge.testLogStrings";
- ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleName);
- String resourceKey = "resource_key";
- String expectedMsg = bundle.getString(resourceKey);
- String msg = resourceKey;
-
- java.util.logging.Logger julResourceBundleLogger = java.util.logging.Logger.getLogger("yay", resourceBundleName);
-
- julResourceBundleLogger.info(msg);
- assertEquals(1, listAppender.list.size());
- LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
- assertEquals(LOGGER_NAME, le.getLoggerName());
- assertEquals(expectedMsg, le.getMessage());
- }
-
- @Test
- public void testLogWithResourceBundleWithParameters() {
- SLF4JBridgeHandler.install();
-
- String resourceBundleName = "org.slf4j.bridge.testLogStrings";
- ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleName);
-
- java.util.logging.Logger julResourceBundleLogger = java.util.logging.Logger.getLogger("foo", resourceBundleName);
-
- String resourceKey1 = "resource_key_1";
- String expectedMsg1 = bundle.getString(resourceKey1);
- julResourceBundleLogger.info(resourceKey1); // 1st log
-
- String resourceKey2 = "resource_key_2";
- Object[] params2 = new Object[] { "foo", "bar" };
- String expectedMsg2 = MessageFormat.format(bundle.getString(resourceKey2), params2);
- julResourceBundleLogger.log(Level.INFO, resourceKey2, params2); // 2nd log
-
- String resourceKey3 = "invalidKey {0}";
- Object[] params3 = new Object[] { "John" };
- String expectedMsg3 = MessageFormat.format(resourceKey3, params3);
- julResourceBundleLogger.log(Level.INFO, resourceKey3, params3); // 3rd log
-
- julLogger.log(Level.INFO, resourceKey3, params3); // 4th log
-
- assertEquals(4, listAppender.list.size());
-
- LoggingEvent le = null;
-
- le = (LoggingEvent) listAppender.list.get(0);
- assertEquals("foo", le.getLoggerName());
- assertEquals(expectedMsg1, le.getMessage());
-
- le = (LoggingEvent) listAppender.list.get(1);
- assertEquals("foo", le.getLoggerName());
- assertEquals(expectedMsg2, le.getMessage());
-
- le = (LoggingEvent) listAppender.list.get(2);
- assertEquals("foo", le.getLoggerName());
- assertEquals(expectedMsg3, le.getMessage());
-
- le = (LoggingEvent) listAppender.list.get(3);
- assertEquals("yay", le.getLoggerName());
- assertEquals(expectedMsg3, le.getMessage());
- }
-
- @Test
- public void testLogWithPlaceholderNoParameters() {
- SLF4JBridgeHandler.install();
- String msg = "msg {non-number-string}";
- julLogger.logp(Level.INFO, "SLF4JBridgeHandlerTest", "testLogWithPlaceholderNoParameters", msg, new Object[0]);
-
- assertEquals(1, listAppender.list.size());
- LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
- assertEquals(LOGGER_NAME, le.getLoggerName());
- assertEquals(msg, le.getMessage());
- }
-
- // See http://jira.qos.ch/browse/SLF4J-337
-
- @Test
- public void illFormattedInputShouldBeReturnedAsIs() {
- SLF4JBridgeHandler.install();
- String msg = "foo {18=bad} {0}";
-
- julLogger.log(Level.INFO, msg, "ignored parameter due to IllegalArgumentException");
- assertEquals(1, listAppender.list.size());
- LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
- assertEquals(msg, le.getMessage());
- }
-
- void assertLevel(int index, org.apache.log4j.Level expectedLevel) {
- LoggingEvent le = (LoggingEvent) listAppender.list.get(index);
- assertEquals(expectedLevel, le.getLevel());
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.bridge;
+
+import static org.junit.Assert.assertEquals;
+
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+
+import org.apache.log4j.spi.LocationInfo;
+import org.apache.log4j.spi.LoggingEvent;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SLF4JBridgeHandlerTest {
+
+ static String LOGGER_NAME = "yay";
+
+ ListAppender listAppender = new ListAppender();
+ org.apache.log4j.Logger log4jRoot;
+ java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger("yay");
+
+ @Before
+ public void setUp() throws Exception {
+ listAppender.extractLocationInfo = true;
+ log4jRoot = org.apache.log4j.Logger.getRootLogger();
+ log4jRoot.addAppender(listAppender);
+ log4jRoot.setLevel(org.apache.log4j.Level.TRACE);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ SLF4JBridgeHandler.uninstall();
+ log4jRoot.getLoggerRepository().resetConfiguration();
+ }
+
+ @Test
+ public void testSmoke() {
+ SLF4JBridgeHandler.install();
+ String msg = "msg";
+ julLogger.info(msg);
+ assertEquals(1, listAppender.list.size());
+ LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
+ assertEquals(LOGGER_NAME, le.getLoggerName());
+ assertEquals(msg, le.getMessage());
+
+ // get the location info in the event.
+ // Note that this must have been computed previously
+ // within an appender for the following assertion to
+ // work properly
+ LocationInfo li = le.getLocationInformation();
+ System.out.println(li.fullInfo);
+ assertEquals("SLF4JBridgeHandlerTest.java", li.getFileName());
+ assertEquals("testSmoke", li.getMethodName());
+ }
+
+ @Test
+ public void testLevels() {
+ SLF4JBridgeHandler.install();
+ String msg = "msg";
+ julLogger.setLevel(Level.ALL);
+
+ julLogger.finest(msg);
+ julLogger.finer(msg);
+ julLogger.fine(msg);
+ julLogger.info(msg);
+ julLogger.warning(msg);
+ julLogger.severe(msg);
+
+ assertEquals(6, listAppender.list.size());
+ int i = 0;
+ assertLevel(i++, org.apache.log4j.Level.TRACE);
+ assertLevel(i++, org.apache.log4j.Level.DEBUG);
+ assertLevel(i++, org.apache.log4j.Level.DEBUG);
+ assertLevel(i++, org.apache.log4j.Level.INFO);
+ assertLevel(i++, org.apache.log4j.Level.WARN);
+ assertLevel(i++, org.apache.log4j.Level.ERROR);
+ }
+
+ @Test
+ public void testLogWithResourceBundle() {
+ SLF4JBridgeHandler.install();
+
+ String resourceBundleName = "org.slf4j.bridge.testLogStrings";
+ ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleName);
+ String resourceKey = "resource_key";
+ String expectedMsg = bundle.getString(resourceKey);
+ String msg = resourceKey;
+
+ java.util.logging.Logger julResourceBundleLogger = java.util.logging.Logger.getLogger("yay", resourceBundleName);
+
+ julResourceBundleLogger.info(msg);
+ assertEquals(1, listAppender.list.size());
+ LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
+ assertEquals(LOGGER_NAME, le.getLoggerName());
+ assertEquals(expectedMsg, le.getMessage());
+ }
+
+ @Test
+ public void testLogWithResourceBundleWithParameters() {
+ SLF4JBridgeHandler.install();
+
+ String resourceBundleName = "org.slf4j.bridge.testLogStrings";
+ ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleName);
+
+ java.util.logging.Logger julResourceBundleLogger = java.util.logging.Logger.getLogger("foo", resourceBundleName);
+
+ String resourceKey1 = "resource_key_1";
+ String expectedMsg1 = bundle.getString(resourceKey1);
+ julResourceBundleLogger.info(resourceKey1); // 1st log
+
+ String resourceKey2 = "resource_key_2";
+ Object[] params2 = new Object[] { "foo", "bar" };
+ String expectedMsg2 = MessageFormat.format(bundle.getString(resourceKey2), params2);
+ julResourceBundleLogger.log(Level.INFO, resourceKey2, params2); // 2nd log
+
+ String resourceKey3 = "invalidKey {0}";
+ Object[] params3 = new Object[] { "John" };
+ String expectedMsg3 = MessageFormat.format(resourceKey3, params3);
+ julResourceBundleLogger.log(Level.INFO, resourceKey3, params3); // 3rd log
+
+ julLogger.log(Level.INFO, resourceKey3, params3); // 4th log
+
+ assertEquals(4, listAppender.list.size());
+
+ LoggingEvent le = null;
+
+ le = (LoggingEvent) listAppender.list.get(0);
+ assertEquals("foo", le.getLoggerName());
+ assertEquals(expectedMsg1, le.getMessage());
+
+ le = (LoggingEvent) listAppender.list.get(1);
+ assertEquals("foo", le.getLoggerName());
+ assertEquals(expectedMsg2, le.getMessage());
+
+ le = (LoggingEvent) listAppender.list.get(2);
+ assertEquals("foo", le.getLoggerName());
+ assertEquals(expectedMsg3, le.getMessage());
+
+ le = (LoggingEvent) listAppender.list.get(3);
+ assertEquals("yay", le.getLoggerName());
+ assertEquals(expectedMsg3, le.getMessage());
+ }
+
+ @Test
+ public void testLogWithPlaceholderNoParameters() {
+ SLF4JBridgeHandler.install();
+ String msg = "msg {non-number-string}";
+ julLogger.logp(Level.INFO, "SLF4JBridgeHandlerTest", "testLogWithPlaceholderNoParameters", msg, new Object[0]);
+
+ assertEquals(1, listAppender.list.size());
+ LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
+ assertEquals(LOGGER_NAME, le.getLoggerName());
+ assertEquals(msg, le.getMessage());
+ }
+
+ // See http://jira.qos.ch/browse/SLF4J-337
+
+ @Test
+ public void illFormattedInputShouldBeReturnedAsIs() {
+ SLF4JBridgeHandler.install();
+ String msg = "foo {18=bad} {0}";
+
+ julLogger.log(Level.INFO, msg, "ignored parameter due to IllegalArgumentException");
+ assertEquals(1, listAppender.list.size());
+ LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
+ assertEquals(msg, le.getMessage());
+ }
+
+ void assertLevel(int index, org.apache.log4j.Level expectedLevel) {
+ LoggingEvent le = (LoggingEvent) listAppender.list.get(index);
+ assertEquals(expectedLevel, le.getLevel());
+ }
+}
diff --git a/jul-to-slf4j/src/test/resources/org/slf4j/bridge/testLogStrings.properties b/jul-to-slf4j/src/test/resources/org/slf4j/bridge/testLogStrings.properties
index 2b0d143..e0deb62 100644
--- a/jul-to-slf4j/src/test/resources/org/slf4j/bridge/testLogStrings.properties
+++ b/jul-to-slf4j/src/test/resources/org/slf4j/bridge/testLogStrings.properties
@@ -1,3 +1,3 @@
-resource_key=msg
-resource_key_1=msg
-resource_key_2=msg {0} {1}
+resource_key=msg
+resource_key_1=msg
+resource_key_2=msg {0} {1}
diff --git a/log4j-over-slf4j/compatibility/build.xml b/log4j-over-slf4j/compatibility/build.xml
new file mode 100644
index 0000000..5115a42
--- /dev/null
+++ b/log4j-over-slf4j/compatibility/build.xml
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ These are some of the targets supported by this ANT build scpript:
+
+ 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
new file mode 100644
index 0000000..6554cc6
--- /dev/null
+++ b/log4j-over-slf4j/compatibility/readme.txt
@@ -0,0 +1,17 @@
+
+This directory is used to test the module against various log4j calls.
+Two test cases simulate the typical calls that one can find in an application
+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
+logback jars instead.
+
+To run the tests, one must have ant installed. Issuing the following command,
+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
diff --git a/log4j-over-slf4j/compatibility/src/main/java/test/DummyObject.java b/log4j-over-slf4j/compatibility/src/main/java/test/DummyObject.java
new file mode 100644
index 0000000..3a11790
--- /dev/null
+++ b/log4j-over-slf4j/compatibility/src/main/java/test/DummyObject.java
@@ -0,0 +1,8 @@
+package test;
+
+public class DummyObject {
+
+ public String toString() {
+ return "dummy";
+ }
+}
diff --git a/log4j-over-slf4j/compatibility/src/main/java/test/Log4j12Calls.java b/log4j-over-slf4j/compatibility/src/main/java/test/Log4j12Calls.java
new file mode 100644
index 0000000..eeff93b
--- /dev/null
+++ b/log4j-over-slf4j/compatibility/src/main/java/test/Log4j12Calls.java
@@ -0,0 +1,39 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ *
+ * Copyright (C) 1999-2006, QOS.ch
+ *
+ * This library is free software, you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation.
+ */
+package test;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.MDC;
+
+/**
+ *
+ * A test case that issues the typical calls
+ * that an application using log4j 1.2 would do.
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+public class Log4j12Calls extends TestCase {
+ public static final Logger logger = Logger.getLogger(Log4j12Calls.class);
+
+ public void testLog() {
+ MDC.put("key", "value1");
+
+ logger.trace("Trace level can be noisy");
+ logger.debug("Entering application");
+ logger.info("Violets are blue");
+ logger.warn("Here is a warning");
+ logger.error("Exiting application", new Exception("just testing"));
+
+ MDC.remove("key");
+ }
+}
diff --git a/log4j-over-slf4j/compatibility/src/main/java/test/Log4j13Calls.java b/log4j-over-slf4j/compatibility/src/main/java/test/Log4j13Calls.java
new file mode 100644
index 0000000..54c6e9f
--- /dev/null
+++ b/log4j-over-slf4j/compatibility/src/main/java/test/Log4j13Calls.java
@@ -0,0 +1,46 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ *
+ * Copyright (C) 1999-2006, QOS.ch
+ *
+ * This library is free software, you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation.
+ */
+
+package test;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.MDC;
+
+/**
+ *
+ * A test case that issues the typical calls
+ * that an application using log4j 1.3 would do.
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+
+public class Log4j13Calls extends TestCase {
+ public static final Logger logger = Logger.getLogger(Log4j12Calls.class);
+
+ public void testLog() {
+ MDC.put("key", "value1");
+
+ logger.trace("Trace level can be noisy");
+ logger.debug("Entering application");
+ logger.info("Violets are blue");
+ logger.warn("Here is a warning");
+ logger.info("The answer is {}.", new Integer(42));
+ logger.info("Number: {} and another one: {}.", new Integer(42), new Integer(24));
+
+ logger.error("Exiting application", new Exception("just testing"));
+
+ MDC.remove("key");
+
+ MDC.clear();
+ }
+}
diff --git a/log4j-over-slf4j/compatibility/src/main/java/test/LoggerTest.java b/log4j-over-slf4j/compatibility/src/main/java/test/LoggerTest.java
new file mode 100644
index 0000000..29c8a46
--- /dev/null
+++ b/log4j-over-slf4j/compatibility/src/main/java/test/LoggerTest.java
@@ -0,0 +1,169 @@
+package test;
+
+import junit.framework.TestCase;
+
+import org.slf4j.LoggerFactory;
+
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.read.ListAppender;
+import org.apache.log4j.Level;
+
+/**
+ * A class that tests the invocation of the org.apache.log4j.Logger class that
+ * belongs to the log4j-bridge package
+ *
+ * @author Sébastien Pennec
+ * @author Ceki Gülcü
+ */
+
+public class LoggerTest extends TestCase {
+
+ LoggerContext context;
+ ListAppender appender;
+ ch.qos.logback.classic.Logger logbackLogger;
+ org.apache.log4j.Logger log4jLogger;
+
+ public void setUp() throws Exception {
+ context = (LoggerContext) LoggerFactory.getILoggerFactory();
+ context.shutdownAndReset();
+ appender = new ListAppender();
+ appender.setContext(context);
+ appender.setName("listAppender");
+ appender.start();
+ ch.qos.logback.classic.Logger lbLogger = context
+ .getLogger(LoggerContext.ROOT_NAME);
+ lbLogger.addAppender(appender);
+
+ log4jLogger = org.apache.log4j.Logger.getLogger(LoggerTest.class);
+ logbackLogger = context.getLogger(LoggerTest.class);
+ super.setUp();
+ }
+
+ public void tearDown() throws Exception {
+ appender.stop();
+ context.stop();
+ appender = null;
+ context = null;
+ logbackLogger = null;
+ log4jLogger = null;
+ super.tearDown();
+ }
+
+ public void testLogWithObjectMessages() {
+ LoggingEvent event;
+
+ log4jLogger.debug("test");
+ event = appender.list.get(0);
+ assertEquals("test", event.getMessage());
+ appender.list.clear();
+
+ log4jLogger.debug(null);
+ event = appender.list.get(0);
+ assertEquals(null, event.getMessage());
+ appender.list.clear();
+
+ DummyObject dummy = new DummyObject();
+ log4jLogger.debug(dummy);
+ event = appender.list.get(0);
+ assertEquals(dummy.toString(), event.getMessage());
+ appender.list.clear();
+ }
+
+ public void testIsEnabledAPI() {
+ assertFalse(log4jLogger.isTraceEnabled());
+ assertTrue(log4jLogger.isDebugEnabled());
+ assertTrue(log4jLogger.isInfoEnabled());
+ assertTrue(log4jLogger.isWarnEnabled());
+ assertTrue(log4jLogger.isErrorEnabled());
+ }
+
+ public void testPrintAPI() {
+ Exception e = new Exception("just testing");
+
+ log4jLogger.trace(null);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.debug(null);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.debug("debug message");
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.info(null);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.info("info message");
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.warn(null);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.warn("warn message");
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.error(null);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.error("error message");
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.debug(null, e);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.debug("debug message", e);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.info(null, e);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.info("info message", e);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.warn(null, e);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.warn("warn message", e);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.error(null, e);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ log4jLogger.error("error message", e);
+ assertEquals(1, appender.list.size());
+ appender.list.clear();
+
+ }
+
+ public void testLogAPI() {
+ log4jLogger.log("x", Level.TRACE, "x", null);
+ assertEquals(0, appender.list.size());
+
+ log4jLogger.log("x", Level.DEBUG, "x", null);
+ log4jLogger.log("x", Level.INFO, "x", null);
+ log4jLogger.log("x", Level.WARN, "x", null);
+ log4jLogger.log("x", Level.ERROR, "x", null);
+ log4jLogger.log("x", Level.FATAL, "x", null);
+
+ assertEquals(5, appender.list.size());
+ appender.list.clear();
+
+ }
+
+}
diff --git a/log4j-over-slf4j/pom.xml b/log4j-over-slf4j/pom.xml
old file mode 100644
new file mode 100755
index 53a3a48..2e6f87f 100755
--- a/log4j-over-slf4j/pom.xml
+++ b/log4j-over-slf4j/pom.xml
@@ -1,40 +1,40 @@
-
-
-
- 4.0.0
-
-
- org.slf4j
- slf4j-parent
- 1.7.25
-
-
-
- log4j-over-slf4j
- jar
- Log4j Implemented Over SLF4J
- Log4j implemented over SLF4J
-
- http://www.slf4j.org
-
-
-
- Apache Software Licenses
- http://www.apache.org/licenses/LICENSE-2.0.txt
-
-
-
-
-
- org.slf4j
- slf4j-api
-
-
- org.slf4j
- slf4j-jdk14
- test
-
-
-
-
\ No newline at end of file
+
+
+
+ 4.0.0
+
+
+ org.slf4j
+ slf4j-parent
+ 1.7.26
+
+
+
+ log4j-over-slf4j
+ jar
+ Log4j Implemented Over SLF4J
+ Log4j implemented over SLF4J
+
+ http://www.slf4j.org
+
+
+
+ Apache Software Licenses
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+
+
+
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-jdk14
+ test
+
+
+
+
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 824513c..f391cef 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
@@ -1,130 +1,130 @@
-/*
- * 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;
-
-import org.apache.log4j.spi.Filter;
-import org.apache.log4j.spi.ErrorHandler;
-import org.apache.log4j.spi.LoggingEvent;
-
-/**
- * Implement this interface for your own strategies for outputting log
- * statements.
- *
- * @author Ceki Gülcü
- */
-public interface Appender {
-
- /**
- * Add a filter to the end of the filter list.
- *
- * @since 0.9.0
- */
- void addFilter(Filter newFilter);
-
- /**
- * Returns the head Filter. The Filters are organized in a linked list
- * and so all Filters on this Appender are available through the result.
- *
- * @return the head Filter or null, if no Filters are present
- * @since 1.1
- */
- public Filter getFilter();
-
- /**
- * Clear the list of filters by removing all the filters in it.
- *
- * @since 0.9.0
- */
- public void clearFilters();
-
- /**
- * Release any resources allocated within the appender such as file
- * handles, network connections, etc.
- *
- *
It is a programming error to append to a closed appender.
- *
- * @since 0.8.4
- */
- public void close();
-
- /**
- * Log in Appender specific way. When appropriate,
- * Loggers will call the doAppend method of appender
- * implementations in order to log.
- */
- public void doAppend(LoggingEvent event);
-
- /**
- * Get the name of this appender. The name uniquely identifies the
- * appender.
- */
- public String getName();
-
- /**
- * Set the {@link ErrorHandler} for this appender.
- *
- * @since 0.9.0
- */
- public void setErrorHandler(ErrorHandler errorHandler);
-
- /**
- * Returns the {@link ErrorHandler} for this appender.
- *
- * @since 1.1
- */
- public ErrorHandler getErrorHandler();
-
- /**
- * Set the {@link Layout} for this appender.
- *
- * @since 0.8.1
- */
- public void setLayout(Layout layout);
-
- /**
- * Returns this appenders layout.
- *
- * @since 1.1
- */
- public Layout getLayout();
-
- /**
- * Set the name of this appender. The name is used by other
- * components to identify this appender.
- *
- * @since 0.8.1
- */
- public void setName(String name);
-
- /**
- * Configurators call this method to determine if the appender
- * requires a layout. If this method returns true,
- * meaning that layout is required, then the configurator will
- * configure an layout using the configuration information at its
- * disposal. If this method returns false, 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.
- *
- *
In the rather exceptional case, where the appender
- * implementation admits a layout but can also work without it, then
- * the appender should return true.
- *
- * @since 0.8.4
- */
- public boolean requiresLayout();
-}
+/*
+ * 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;
+
+import org.apache.log4j.spi.Filter;
+import org.apache.log4j.spi.ErrorHandler;
+import org.apache.log4j.spi.LoggingEvent;
+
+/**
+ * Implement this interface for your own strategies for outputting log
+ * statements.
+ *
+ * @author Ceki Gülcü
+ */
+public interface Appender {
+
+ /**
+ * Add a filter to the end of the filter list.
+ *
+ * @since 0.9.0
+ */
+ void addFilter(Filter newFilter);
+
+ /**
+ * Returns the head Filter. The Filters are organized in a linked list
+ * and so all Filters on this Appender are available through the result.
+ *
+ * @return the head Filter or null, if no Filters are present
+ * @since 1.1
+ */
+ public Filter getFilter();
+
+ /**
+ * Clear the list of filters by removing all the filters in it.
+ *
+ * @since 0.9.0
+ */
+ public void clearFilters();
+
+ /**
+ * Release any resources allocated within the appender such as file
+ * handles, network connections, etc.
+ *
+ *
It is a programming error to append to a closed appender.
+ *
+ * @since 0.8.4
+ */
+ public void close();
+
+ /**
+ * Log in Appender specific way. When appropriate,
+ * Loggers will call the doAppend method of appender
+ * implementations in order to log.
+ */
+ public void doAppend(LoggingEvent event);
+
+ /**
+ * Get the name of this appender. The name uniquely identifies the
+ * appender.
+ */
+ public String getName();
+
+ /**
+ * Set the {@link ErrorHandler} for this appender.
+ *
+ * @since 0.9.0
+ */
+ public void setErrorHandler(ErrorHandler errorHandler);
+
+ /**
+ * Returns the {@link ErrorHandler} for this appender.
+ *
+ * @since 1.1
+ */
+ public ErrorHandler getErrorHandler();
+
+ /**
+ * Set the {@link Layout} for this appender.
+ *
+ * @since 0.8.1
+ */
+ public void setLayout(Layout layout);
+
+ /**
+ * Returns this appenders layout.
+ *
+ * @since 1.1
+ */
+ public Layout getLayout();
+
+ /**
+ * Set the name of this appender. The name is used by other
+ * components to identify this appender.
+ *
+ * @since 0.8.1
+ */
+ public void setName(String name);
+
+ /**
+ * Configurators call this method to determine if the appender
+ * requires a layout. If this method returns true,
+ * meaning that layout is required, then the configurator will
+ * configure an layout using the configuration information at its
+ * disposal. If this method returns false, 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.
+ *
+ *
In the rather exceptional case, where the appender
+ * implementation admits a layout but can also work without it, then
+ * the appender should return true.
+ *
+ * @since 0.8.4
+ */
+ public boolean requiresLayout();
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/AppenderSkeleton.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/AppenderSkeleton.java
index 184a47f..447c3b5 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/AppenderSkeleton.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/AppenderSkeleton.java
@@ -1,33 +1,33 @@
-/*
- * 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;
-
-import org.apache.log4j.spi.OptionHandler;
-
-public class AppenderSkeleton implements OptionHandler {
-
- public void setLayout(Layout layout) {
- }
-
- public void setName(String name) {
- }
-
- public void activateOptions() {
- }
-
- public void setThreshold(Priority threshold) {
- }
-}
+/*
+ * 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;
+
+import org.apache.log4j.spi.OptionHandler;
+
+public class AppenderSkeleton implements OptionHandler {
+
+ public void setLayout(Layout layout) {
+ }
+
+ public void setName(String name) {
+ }
+
+ public void activateOptions() {
+ }
+
+ public void setThreshold(Priority threshold) {
+ }
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/BasicConfigurator.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/BasicConfigurator.java
index 46beb29..4209ca5 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/BasicConfigurator.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/BasicConfigurator.java
@@ -1,31 +1,31 @@
-/*
- * 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;
-
-/**
- * A minimal (nop) implementation of BasicConfigurator.
- */
-public class BasicConfigurator {
- public static void configure() {
- }
-
- public static void configure(Appender appender) {
- }
-
- public static void resetConfiguration() {
- }
-}
+/*
+ * 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;
+
+/**
+ * A minimal (nop) implementation of BasicConfigurator.
+ */
+public class BasicConfigurator {
+ public static void configure() {
+ }
+
+ public static void configure(Appender appender) {
+ }
+
+ public static void resetConfiguration() {
+ }
+}
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 23230ea..fc8b50c 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
@@ -1,359 +1,359 @@
-/*
- * 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;
-
-import org.apache.log4j.helpers.NullEnumeration;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Marker;
-import org.slf4j.MarkerFactory;
-import org.slf4j.spi.LocationAwareLogger;
-
-import java.util.Enumeration;
-
-/**
- *
- * This class is a minimal implementation of the original
- * org.apache.log4j.Category class (as found in log4j 1.2) by
- * delegation of all calls to a {@link org.slf4j.Logger} instance.
- *
- *
- *
- * Log4j's trace, debug(), info(),
- * warn(), error() printing methods are directly
- * mapped to their SLF4J equivalents. Log4j's fatal() printing
- * method is mapped to SLF4J's error() method with a FATAL marker.
- *
- * @author Sébastien Pennec
- * @author Ceki Gülcü
- */
-@SuppressWarnings("rawtypes")
-public class Category {
-
- private static final String CATEGORY_FQCN = Category.class.getName();
-
- private String name;
-
- protected org.slf4j.Logger slf4jLogger;
- private org.slf4j.spi.LocationAwareLogger locationAwareLogger;
-
- private static Marker FATAL_MARKER = MarkerFactory.getMarker("FATAL");
-
- Category(String name) {
- this.name = name;
- slf4jLogger = LoggerFactory.getLogger(name);
- if (slf4jLogger instanceof LocationAwareLogger) {
- locationAwareLogger = (LocationAwareLogger) slf4jLogger;
- }
- }
-
- public static Category getInstance(Class clazz) {
- return Log4jLoggerFactory.getLogger(clazz.getName());
- }
-
- public static Category getInstance(String name) {
- return Log4jLoggerFactory.getLogger(name);
- }
-
- public final Category getParent() {
- return null;
- }
-
- /**
- * Returns the obvious.
- *
- * @return
- */
- public String getName() {
- return name;
- }
-
- public Appender getAppender(String name) {
- return null;
- }
-
- public Enumeration getAllAppenders() {
- return NullEnumeration.getInstance();
- }
-
- /**
- * Return the level in effect for this category/logger.
- *
- *
- * The result is computed by simulation.
- *
- * @return
- */
- public Level getEffectiveLevel() {
- if (slf4jLogger.isTraceEnabled()) {
- return Level.TRACE;
- }
- if (slf4jLogger.isDebugEnabled()) {
- return Level.DEBUG;
- }
- if (slf4jLogger.isInfoEnabled()) {
- return Level.INFO;
- }
- if (slf4jLogger.isWarnEnabled()) {
- return Level.WARN;
- }
- return Level.ERROR;
- }
-
- /**
- * Returns the assigned {@link Level}, if any, for this Category. This
- * implementation always returns null.
- *
- * @return Level - the assigned Level, can be null.
- */
- final public Level getLevel() {
- return null;
- }
-
- /**
- * @deprecated Please use {@link #getLevel} instead.
- */
- final public Level getPriority() {
- return null;
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#isDebugEnabled} method in SLF4J
- */
- public boolean isDebugEnabled() {
- return slf4jLogger.isDebugEnabled();
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#isInfoEnabled} method in SLF4J
- */
- public boolean isInfoEnabled() {
- return slf4jLogger.isInfoEnabled();
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#isWarnEnabled} method in SLF4J
- */
- public boolean isWarnEnabled() {
- return slf4jLogger.isWarnEnabled();
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#isErrorEnabled} method in SLF4J
- */
- public boolean isErrorEnabled() {
- return slf4jLogger.isErrorEnabled();
- }
-
- /**
- * 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.
- *
- * @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) {
- case Level.TRACE_INT:
- return slf4jLogger.isTraceEnabled();
- case Level.DEBUG_INT:
- return slf4jLogger.isDebugEnabled();
- case Level.INFO_INT:
- return slf4jLogger.isInfoEnabled();
- case Level.WARN_INT:
- return slf4jLogger.isWarnEnabled();
- case Level.ERROR_INT:
- return slf4jLogger.isErrorEnabled();
- case Priority.FATAL_INT:
- return slf4jLogger.isErrorEnabled();
- }
- return false;
- }
-
- void differentiatedLog(Marker marker, String fqcn, int level, Object message, Throwable t) {
-
- String m = convertToString(message);
- if (locationAwareLogger != null) {
- locationAwareLogger.log(marker, fqcn, level, m, null, t);
- } else {
- switch (level) {
- case LocationAwareLogger.TRACE_INT:
- slf4jLogger.trace(marker, m);
- break;
- case LocationAwareLogger.DEBUG_INT:
- slf4jLogger.debug(marker, m);
- break;
- case LocationAwareLogger.INFO_INT:
- slf4jLogger.info(marker, m);
- break;
- case LocationAwareLogger.WARN_INT:
- slf4jLogger.warn(marker, m);
- break;
- case LocationAwareLogger.ERROR_INT:
- slf4jLogger.error(marker, m);
- break;
- }
- }
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#debug(String)} method of SLF4J.
- */
- public void debug(Object message) {
- differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.DEBUG_INT, message, null);
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#debug(String,Throwable)} method in
- * SLF4J.
- */
- public void debug(Object message, Throwable t) {
- differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.DEBUG_INT, message, t);
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#info(String)} method in SLF4J.
- */
- 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.
- */
- public void info(Object message, Throwable t) {
- differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.INFO_INT, message, t);
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#warn(String)} method in SLF4J.
- */
- 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.
- */
- public void warn(Object message, Throwable t) {
- differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.WARN_INT, message, t);
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#error(String)} method in SLF4J.
- */
- public void error(Object message) {
- differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, null);
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#error(String,Throwable)} method in
- * SLF4J.
- */
- public void error(Object message, Throwable t) {
- differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, t);
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#error(String)} method in SLF4J.
- */
- public void fatal(Object message) {
- differentiatedLog(FATAL_MARKER, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, null);
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#error(String,Throwable)} method in
- * SLF4J. In addition, the call is marked with a marker named "FATAL".
- */
- public void fatal(Object message, Throwable t) {
- differentiatedLog(FATAL_MARKER, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, t);
- }
-
- protected void forcedLog(String FQCN, Priority p, Object msg, Throwable t) {
- log(FQCN, p, msg, t);
- }
-
- // 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);
- }
-
- public void log(Priority p, Object message, Throwable t) {
- int levelInt = priorityToLevelInt(p);
- differentiatedLog(null, CATEGORY_FQCN, levelInt, message, t);
- }
-
- public void log(Priority p, Object message) {
- int levelInt = priorityToLevelInt(p);
- differentiatedLog(null, CATEGORY_FQCN, levelInt, message, null);
- }
-
- private int priorityToLevelInt(Priority p) {
- switch (p.level) {
- case Level.TRACE_INT:
- case Level.X_TRACE_INT:
- return LocationAwareLogger.TRACE_INT;
- case Priority.DEBUG_INT:
- return LocationAwareLogger.DEBUG_INT;
- case Priority.INFO_INT:
- return LocationAwareLogger.INFO_INT;
- case Priority.WARN_INT:
- return LocationAwareLogger.WARN_INT;
- case Priority.ERROR_INT:
- return LocationAwareLogger.ERROR_INT;
- case Priority.FATAL_INT:
- return LocationAwareLogger.ERROR_INT;
- default:
- throw new IllegalStateException("Unknown Priority " + p);
- }
- }
-
- protected final String convertToString(Object message) {
- if (message == null) {
- return (String) message;
- } else {
- return message.toString();
- }
- }
-
- public void setAdditivity(boolean additive) {
- // nothing to do
- }
-
- public void addAppender(Appender newAppender) {
- // nothing to do
- }
-
- public void setLevel(Level level) {
- // nothing to do
- }
-
- public boolean getAdditivity() {
- return false;
- }
-
- public void assertLog(boolean assertion, String msg) {
- if (!assertion)
- error(msg);
- }
-
-}
+/*
+ * 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;
+
+import org.apache.log4j.helpers.NullEnumeration;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+import org.slf4j.spi.LocationAwareLogger;
+
+import java.util.Enumeration;
+
+/**
+ *
+ * This class is a minimal implementation of the original
+ * org.apache.log4j.Category class (as found in log4j 1.2) by
+ * delegation of all calls to a {@link org.slf4j.Logger} instance.
+ *
+ *
+ *
+ * Log4j's trace, debug(), info(),
+ * warn(), error() printing methods are directly
+ * mapped to their SLF4J equivalents. Log4j's fatal() printing
+ * method is mapped to SLF4J's error() method with a FATAL marker.
+ *
+ * @author Sébastien Pennec
+ * @author Ceki Gülcü
+ */
+@SuppressWarnings("rawtypes")
+public class Category {
+
+ private static final String CATEGORY_FQCN = Category.class.getName();
+
+ private String name;
+
+ protected org.slf4j.Logger slf4jLogger;
+ private org.slf4j.spi.LocationAwareLogger locationAwareLogger;
+
+ private static Marker FATAL_MARKER = MarkerFactory.getMarker("FATAL");
+
+ Category(String name) {
+ this.name = name;
+ slf4jLogger = LoggerFactory.getLogger(name);
+ if (slf4jLogger instanceof LocationAwareLogger) {
+ locationAwareLogger = (LocationAwareLogger) slf4jLogger;
+ }
+ }
+
+ public static Category getInstance(Class clazz) {
+ return Log4jLoggerFactory.getLogger(clazz.getName());
+ }
+
+ public static Category getInstance(String name) {
+ return Log4jLoggerFactory.getLogger(name);
+ }
+
+ public final Category getParent() {
+ return null;
+ }
+
+ /**
+ * Returns the obvious.
+ *
+ * @return
+ */
+ public String getName() {
+ return name;
+ }
+
+ public Appender getAppender(String name) {
+ return null;
+ }
+
+ public Enumeration getAllAppenders() {
+ return NullEnumeration.getInstance();
+ }
+
+ /**
+ * Return the level in effect for this category/logger.
+ *
+ *
+ * The result is computed by simulation.
+ *
+ * @return
+ */
+ public Level getEffectiveLevel() {
+ if (slf4jLogger.isTraceEnabled()) {
+ return Level.TRACE;
+ }
+ if (slf4jLogger.isDebugEnabled()) {
+ return Level.DEBUG;
+ }
+ if (slf4jLogger.isInfoEnabled()) {
+ return Level.INFO;
+ }
+ if (slf4jLogger.isWarnEnabled()) {
+ return Level.WARN;
+ }
+ return Level.ERROR;
+ }
+
+ /**
+ * Returns the assigned {@link Level}, if any, for this Category. This
+ * implementation always returns null.
+ *
+ * @return Level - the assigned Level, can be null.
+ */
+ final public Level getLevel() {
+ return null;
+ }
+
+ /**
+ * @deprecated Please use {@link #getLevel} instead.
+ */
+ final public Level getPriority() {
+ return null;
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#isDebugEnabled} method in SLF4J
+ */
+ public boolean isDebugEnabled() {
+ return slf4jLogger.isDebugEnabled();
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#isInfoEnabled} method in SLF4J
+ */
+ public boolean isInfoEnabled() {
+ return slf4jLogger.isInfoEnabled();
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#isWarnEnabled} method in SLF4J
+ */
+ public boolean isWarnEnabled() {
+ return slf4jLogger.isWarnEnabled();
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#isErrorEnabled} method in SLF4J
+ */
+ public boolean isErrorEnabled() {
+ return slf4jLogger.isErrorEnabled();
+ }
+
+ /**
+ * 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.
+ *
+ * @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) {
+ case Level.TRACE_INT:
+ return slf4jLogger.isTraceEnabled();
+ case Level.DEBUG_INT:
+ return slf4jLogger.isDebugEnabled();
+ case Level.INFO_INT:
+ return slf4jLogger.isInfoEnabled();
+ case Level.WARN_INT:
+ return slf4jLogger.isWarnEnabled();
+ case Level.ERROR_INT:
+ return slf4jLogger.isErrorEnabled();
+ case Priority.FATAL_INT:
+ return slf4jLogger.isErrorEnabled();
+ }
+ return false;
+ }
+
+ void differentiatedLog(Marker marker, String fqcn, int level, Object message, Throwable t) {
+
+ String m = convertToString(message);
+ if (locationAwareLogger != null) {
+ locationAwareLogger.log(marker, fqcn, level, m, null, t);
+ } else {
+ switch (level) {
+ case LocationAwareLogger.TRACE_INT:
+ slf4jLogger.trace(marker, m);
+ break;
+ case LocationAwareLogger.DEBUG_INT:
+ slf4jLogger.debug(marker, m);
+ break;
+ case LocationAwareLogger.INFO_INT:
+ slf4jLogger.info(marker, m);
+ break;
+ case LocationAwareLogger.WARN_INT:
+ slf4jLogger.warn(marker, m);
+ break;
+ case LocationAwareLogger.ERROR_INT:
+ slf4jLogger.error(marker, m);
+ break;
+ }
+ }
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#debug(String)} method of SLF4J.
+ */
+ public void debug(Object message) {
+ differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.DEBUG_INT, message, null);
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#debug(String,Throwable)} method in
+ * SLF4J.
+ */
+ public void debug(Object message, Throwable t) {
+ differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.DEBUG_INT, message, t);
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#info(String)} method in SLF4J.
+ */
+ 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.
+ */
+ public void info(Object message, Throwable t) {
+ differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.INFO_INT, message, t);
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#warn(String)} method in SLF4J.
+ */
+ 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.
+ */
+ public void warn(Object message, Throwable t) {
+ differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.WARN_INT, message, t);
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#error(String)} method in SLF4J.
+ */
+ public void error(Object message) {
+ differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, null);
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#error(String,Throwable)} method in
+ * SLF4J.
+ */
+ public void error(Object message, Throwable t) {
+ differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, t);
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#error(String)} method in SLF4J.
+ */
+ public void fatal(Object message) {
+ differentiatedLog(FATAL_MARKER, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, null);
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#error(String,Throwable)} method in
+ * SLF4J. In addition, the call is marked with a marker named "FATAL".
+ */
+ public void fatal(Object message, Throwable t) {
+ differentiatedLog(FATAL_MARKER, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, t);
+ }
+
+ protected void forcedLog(String FQCN, Priority p, Object msg, Throwable t) {
+ log(FQCN, p, msg, t);
+ }
+
+ // 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);
+ }
+
+ public void log(Priority p, Object message, Throwable t) {
+ int levelInt = priorityToLevelInt(p);
+ differentiatedLog(null, CATEGORY_FQCN, levelInt, message, t);
+ }
+
+ public void log(Priority p, Object message) {
+ int levelInt = priorityToLevelInt(p);
+ differentiatedLog(null, CATEGORY_FQCN, levelInt, message, null);
+ }
+
+ private int priorityToLevelInt(Priority p) {
+ switch (p.level) {
+ case Level.TRACE_INT:
+ case Level.X_TRACE_INT:
+ return LocationAwareLogger.TRACE_INT;
+ case Priority.DEBUG_INT:
+ return LocationAwareLogger.DEBUG_INT;
+ case Priority.INFO_INT:
+ return LocationAwareLogger.INFO_INT;
+ case Priority.WARN_INT:
+ return LocationAwareLogger.WARN_INT;
+ case Priority.ERROR_INT:
+ return LocationAwareLogger.ERROR_INT;
+ case Priority.FATAL_INT:
+ return LocationAwareLogger.ERROR_INT;
+ default:
+ throw new IllegalStateException("Unknown Priority " + p);
+ }
+ }
+
+ protected final String convertToString(Object message) {
+ if (message == null) {
+ return (String) message;
+ } else {
+ return message.toString();
+ }
+ }
+
+ public void setAdditivity(boolean additive) {
+ // nothing to do
+ }
+
+ public void addAppender(Appender newAppender) {
+ // nothing to do
+ }
+
+ public void setLevel(Level level) {
+ // 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 2aee0e4..40e8f80 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
@@ -1,20 +1,20 @@
-/*
- * 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;
-
-public class ConsoleAppender extends WriterAppender {
-
-}
+/*
+ * 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;
+
+public class ConsoleAppender extends WriterAppender {
+
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/FileAppender.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/FileAppender.java
old file mode 100644
new file mode 100755
index 1731f12..27e1f49 100755
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/FileAppender.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/FileAppender.java
@@ -1,31 +1,31 @@
-/*
- * 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;
-
-public class FileAppender extends WriterAppender {
-
- public FileAppender() {
- }
-
- public FileAppender(Layout layout, String filename) {
- }
-
- public FileAppender(Layout layout, String filename, boolean append) {
- }
-
- public FileAppender(Layout layout, String filename, boolean append, boolean bufferedIO, int bufferSize) {
- }
-}
+/*
+ * 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;
+
+public class FileAppender extends WriterAppender {
+
+ public FileAppender() {
+ }
+
+ public FileAppender(Layout layout, String filename) {
+ }
+
+ public FileAppender(Layout layout, String filename, boolean append) {
+ }
+
+ public FileAppender(Layout layout, String filename, boolean append, boolean bufferedIO, int bufferSize) {
+ }
+}
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 0be56b3..4ea3d99 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
@@ -1,27 +1,27 @@
-/*
- * 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.
- */
-
-// Contributors: Christian Trutz
-package org.apache.log4j;
-
-/**
- * This class is a minimal implementation of the original Log4J class.
- *
- * @author Christian Trutz
- * */
-public class Layout {
-
-}
+/*
+ * 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.
+ */
+
+// Contributors: Christian Trutz
+package org.apache.log4j;
+
+/**
+ * This class is a minimal implementation of the original Log4J class.
+ *
+ * @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 24d15aa..1cd0448 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
@@ -1,228 +1,228 @@
-/*
- * 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.
- */
-
-// Contributors: Kitching Simon
-// Nicholas Wolff
-
-package org.apache.log4j;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-
-/**
- Defines the minimum set of levels recognized by the system, that is
- OFF, FATAL, ERROR,
- WARN, INFO, DEBUG and
- ALL.
-
-
The Level class may be subclassed to define a larger
- level set.
-
- @author Ceki Gülcü
-
- */
-public class Level extends Priority implements Serializable {
-
- /**
- * TRACE level integer value.
- * @since 1.2.12
- */
- public static final int TRACE_INT = 5000;
-
- // match jboss' xlevel
- public static final int X_TRACE_INT = DEBUG_INT - 100;
-
- /**
- The OFF has the highest possible rank and is
- intended to turn off logging. */
- final static public Level OFF = new Level(OFF_INT, "OFF", 0);
-
- /**
- The FATAL 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 ERROR 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 WARN level designates potentially harmful situations.
- */
- final static public Level WARN = new Level(WARN_INT, "WARN", 4);
-
- /**
- The INFO 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 DEBUG 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 TRACE Level designates finer-grained
- * informational events than the DEBUGALL
has the lowest possible rank and is intended to
- turn on all logging. */
- final static public Level ALL = new Level(ALL_INT, "ALL", 7);
-
- /**
- * Serialization version id.
- */
- static final long serialVersionUID = 3491141966387921974L;
-
- /**
- Instantiate a Level object.
- */
- 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}.
- */
- 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}.
-
- */
- 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.
- */
- public static Level toLevel(int val, Level defaultLevel) {
- switch (val) {
- case ALL_INT:
- return ALL;
- case DEBUG_INT:
- return Level.DEBUG;
- case INFO_INT:
- return Level.INFO;
- case WARN_INT:
- return Level.WARN;
- case ERROR_INT:
- return Level.ERROR;
- case FATAL_INT:
- return Level.FATAL;
- case OFF_INT:
- return OFF;
- case TRACE_INT:
- return Level.TRACE;
- default:
- return defaultLevel;
- }
- }
-
- /**
- Convert the string passed as argument to a level. If the
- conversion fails, then this method returns the value of
- defaultLevel.
- */
- public static Level toLevel(String sArg, Level defaultLevel) {
- if (sArg == null)
- return defaultLevel;
-
- String s = sArg.toUpperCase();
-
- if (s.equals("ALL"))
- return Level.ALL;
- if (s.equals("DEBUG"))
- return Level.DEBUG;
- if (s.equals("INFO"))
- return Level.INFO;
- if (s.equals("WARN"))
- return Level.WARN;
- if (s.equals("ERROR"))
- return Level.ERROR;
- if (s.equals("FATAL"))
- return Level.FATAL;
- if (s.equals("OFF"))
- return Level.OFF;
- if (s.equals("TRACE"))
- return Level.TRACE;
- return defaultLevel;
- }
-
- /**
- * Custom deserialization of Level.
- * @param s serialization stream.
- * @throws IOException if IO exception.
- * @throws ClassNotFoundException if class not found.
- */
- private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException {
- s.defaultReadObject();
- level = s.readInt();
- syslogEquivalent = s.readInt();
- levelStr = s.readUTF();
- if (levelStr == null) {
- levelStr = "";
- }
- }
-
- /**
- * Serialize level.
- * @param s serialization stream.
- * @throws IOException if exception during serialization.
- */
- private void writeObject(final ObjectOutputStream s) throws IOException {
- s.defaultWriteObject();
- s.writeInt(level);
- s.writeInt(syslogEquivalent);
- s.writeUTF(levelStr);
- }
-
- /**
- * 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 deserialized object is exactly an instance of Level
- //
- if (getClass() == Level.class) {
- return toLevel(level);
- }
- //
- // extension of Level can't substitute stock item
- //
- return this;
- }
+/*
+ * 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.
+ */
+
+// Contributors: Kitching Simon
+// Nicholas Wolff
+
+package org.apache.log4j;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+/**
+ Defines the minimum set of levels recognized by the system, that is
+ OFF, FATAL, ERROR,
+ WARN, INFO, DEBUG and
+ ALL.
+
+
The Level class may be subclassed to define a larger
+ level set.
+
+ @author Ceki Gülcü
+
+ */
+public class Level extends Priority implements Serializable {
+
+ /**
+ * TRACE level integer value.
+ * @since 1.2.12
+ */
+ public static final int TRACE_INT = 5000;
+
+ // match jboss' xlevel
+ public static final int X_TRACE_INT = DEBUG_INT - 100;
+
+ /**
+ The OFF has the highest possible rank and is
+ intended to turn off logging. */
+ final static public Level OFF = new Level(OFF_INT, "OFF", 0);
+
+ /**
+ The FATAL 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 ERROR 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 WARN level designates potentially harmful situations.
+ */
+ final static public Level WARN = new Level(WARN_INT, "WARN", 4);
+
+ /**
+ The INFO 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 DEBUG 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 TRACE Level designates finer-grained
+ * informational events than the DEBUGALL
has the lowest possible rank and is intended to
+ turn on all logging. */
+ final static public Level ALL = new Level(ALL_INT, "ALL", 7);
+
+ /**
+ * Serialization version id.
+ */
+ static final long serialVersionUID = 3491141966387921974L;
+
+ /**
+ Instantiate a Level object.
+ */
+ 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}.
+ */
+ 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}.
+
+ */
+ 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.
+ */
+ public static Level toLevel(int val, Level defaultLevel) {
+ switch (val) {
+ case ALL_INT:
+ return ALL;
+ case DEBUG_INT:
+ return Level.DEBUG;
+ case INFO_INT:
+ return Level.INFO;
+ case WARN_INT:
+ return Level.WARN;
+ case ERROR_INT:
+ return Level.ERROR;
+ case FATAL_INT:
+ return Level.FATAL;
+ case OFF_INT:
+ return OFF;
+ case TRACE_INT:
+ return Level.TRACE;
+ default:
+ return defaultLevel;
+ }
+ }
+
+ /**
+ Convert the string passed as argument to a level. If the
+ conversion fails, then this method returns the value of
+ defaultLevel.
+ */
+ public static Level toLevel(String sArg, Level defaultLevel) {
+ if (sArg == null)
+ return defaultLevel;
+
+ String s = sArg.toUpperCase();
+
+ if (s.equals("ALL"))
+ return Level.ALL;
+ if (s.equals("DEBUG"))
+ return Level.DEBUG;
+ if (s.equals("INFO"))
+ return Level.INFO;
+ if (s.equals("WARN"))
+ return Level.WARN;
+ if (s.equals("ERROR"))
+ return Level.ERROR;
+ if (s.equals("FATAL"))
+ return Level.FATAL;
+ if (s.equals("OFF"))
+ return Level.OFF;
+ if (s.equals("TRACE"))
+ return Level.TRACE;
+ return defaultLevel;
+ }
+
+ /**
+ * Custom deserialization of Level.
+ * @param s serialization stream.
+ * @throws IOException if IO exception.
+ * @throws ClassNotFoundException if class not found.
+ */
+ private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException {
+ s.defaultReadObject();
+ level = s.readInt();
+ syslogEquivalent = s.readInt();
+ levelStr = s.readUTF();
+ if (levelStr == null) {
+ levelStr = "";
+ }
+ }
+
+ /**
+ * Serialize level.
+ * @param s serialization stream.
+ * @throws IOException if exception during serialization.
+ */
+ private void writeObject(final ObjectOutputStream s) throws IOException {
+ s.defaultWriteObject();
+ s.writeInt(level);
+ s.writeInt(syslogEquivalent);
+ s.writeUTF(levelStr);
+ }
+
+ /**
+ * 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 deserialized object is exactly an instance of Level
+ //
+ if (getClass() == Level.class) {
+ return toLevel(level);
+ }
+ //
+ // extension of Level can't substitute stock item
+ //
+ return this;
+ }
}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 4bf7e77..30b3522 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
@@ -1,59 +1,59 @@
-/*
- * 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;
-
-import org.apache.log4j.spi.LoggerFactory;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * This class is a factory that creates and maintains org.apache.log4j.Loggers
- * wrapping org.slf4j.Loggers.
- *
- * It keeps a hashtable of all created org.apache.log4j.Logger instances so that
- * all newly created instances are not duplicates of existing loggers.
- *
- * @author Sébastien Pennec
- */
-class Log4jLoggerFactory {
-
- // String, Logger
- private static ConcurrentMap log4jLoggers = new ConcurrentHashMap();
-
- public static Logger getLogger(String name) {
- org.apache.log4j.Logger instance = log4jLoggers.get(name);
- if (instance != null) {
- return instance;
- } else {
- Logger newInstance = new Logger(name);
- Logger oldInstance = log4jLoggers.putIfAbsent(name, newInstance);
- return oldInstance == null ? newInstance : oldInstance;
- }
- }
-
- public static Logger getLogger(String name, LoggerFactory loggerFactory) {
- org.apache.log4j.Logger instance = log4jLoggers.get(name);
- if (instance != null) {
- return instance;
- } else {
- Logger newInstance = loggerFactory.makeNewLoggerInstance(name);
- Logger oldInstance = log4jLoggers.putIfAbsent(name, newInstance);
- return oldInstance == null ? newInstance : oldInstance;
- }
- }
-}
+/*
+ * 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;
+
+import org.apache.log4j.spi.LoggerFactory;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * This class is a factory that creates and maintains org.apache.log4j.Loggers
+ * wrapping org.slf4j.Loggers.
+ *
+ * It keeps a hashtable of all created org.apache.log4j.Logger instances so that
+ * all newly created instances are not duplicates of existing loggers.
+ *
+ * @author Sébastien Pennec
+ */
+class Log4jLoggerFactory {
+
+ // String, Logger
+ private static ConcurrentMap log4jLoggers = new ConcurrentHashMap();
+
+ public static Logger getLogger(String name) {
+ org.apache.log4j.Logger instance = log4jLoggers.get(name);
+ if (instance != null) {
+ return instance;
+ } else {
+ Logger newInstance = new Logger(name);
+ Logger oldInstance = log4jLoggers.putIfAbsent(name, newInstance);
+ return oldInstance == null ? newInstance : oldInstance;
+ }
+ }
+
+ public static Logger getLogger(String name, LoggerFactory loggerFactory) {
+ org.apache.log4j.Logger instance = log4jLoggers.get(name);
+ if (instance != null) {
+ return instance;
+ } else {
+ Logger newInstance = loggerFactory.makeNewLoggerInstance(name);
+ Logger oldInstance = log4jLoggers.putIfAbsent(name, newInstance);
+ return oldInstance == null ? newInstance : oldInstance;
+ }
+ }
+}
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 9e8f41d..57b6b25 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
@@ -1,87 +1,87 @@
-/*
- * 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;
-
-import org.apache.log4j.spi.LoggerFactory;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-/**
- *
- * This class is a minimal implementation of the original
- * org.apache.log4j.LogManager class (as found in log4j 1.2)
- * delegating all calls to SLF4J.
- *
- *
- * This implementation does NOT implement the setRepositorySelector(),
- * getLoggerRepository(), exists(), getCurrentLoggers(), shutdown() and
- * resetConfiguration() methods which do not have SLF4J equivalents.
- *
- * @author Ceki Gülcü
- */
-@SuppressWarnings("rawtypes")
-public class LogManager {
-
- public static Logger getRootLogger() {
- return Log4jLoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
- }
-
- public static Logger getLogger(final String name) {
- return Log4jLoggerFactory.getLogger(name);
- }
-
- public static Logger getLogger(final Class clazz) {
- return Log4jLoggerFactory.getLogger(clazz.getName());
- }
-
- /**
- * Returns a logger instance created by loggerFactory. This method was requested in
- * SLF4J-225. 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.
- *
- * @param name the name of the desired logger
- * @param loggerFactory an instance of {@link LoggerFactory}
- * @return returns a logger instance created by loggerFactory
- * @since 1.6.6
- */
- public static Logger getLogger(String name, LoggerFactory loggerFactory) {
- return loggerFactory.makeNewLoggerInstance(name);
- }
-
- /**
- * This bogus implementation returns an empty enumeration.
- *
- * @return
- */
- public static Enumeration getCurrentLoggers() {
- return new Vector().elements();
- }
-
- /**
- * Implemented as NOP.
- */
- public static void shutdown() {
- }
-
- /**
- * Implemented as NOP.
- */
- public static void resetConfiguration() {
- }
-}
+/*
+ * 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;
+
+import org.apache.log4j.spi.LoggerFactory;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+/**
+ *
+ * This class is a minimal implementation of the original
+ * org.apache.log4j.LogManager class (as found in log4j 1.2)
+ * delegating all calls to SLF4J.
+ *
+ *
+ * This implementation does NOT implement the setRepositorySelector(),
+ * getLoggerRepository(), exists(), getCurrentLoggers(), shutdown() and
+ * resetConfiguration() methods which do not have SLF4J equivalents.
+ *
+ * @author Ceki Gülcü
+ */
+@SuppressWarnings("rawtypes")
+public class LogManager {
+
+ public static Logger getRootLogger() {
+ return Log4jLoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
+ }
+
+ public static Logger getLogger(final String name) {
+ return Log4jLoggerFactory.getLogger(name);
+ }
+
+ public static Logger getLogger(final Class clazz) {
+ return Log4jLoggerFactory.getLogger(clazz.getName());
+ }
+
+ /**
+ * Returns a logger instance created by loggerFactory. This method was requested in
+ * SLF4J-225. 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.
+ *
+ * @param name the name of the desired logger
+ * @param loggerFactory an instance of {@link LoggerFactory}
+ * @return returns a logger instance created by loggerFactory
+ * @since 1.6.6
+ */
+ public static Logger getLogger(String name, LoggerFactory loggerFactory) {
+ return loggerFactory.makeNewLoggerInstance(name);
+ }
+
+ /**
+ * This bogus implementation returns an empty enumeration.
+ *
+ * @return
+ */
+ public static Enumeration getCurrentLoggers() {
+ return new Vector().elements();
+ }
+
+ /**
+ * Implemented as NOP.
+ */
+ public static void shutdown() {
+ }
+
+ /**
+ * Implemented as NOP.
+ */
+ public static void resetConfiguration() {
+ }
+}
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 6290c50..12ec176 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
@@ -1,84 +1,84 @@
-/*
- * 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;
-
-import org.apache.log4j.spi.LoggerFactory;
-import org.slf4j.spi.LocationAwareLogger;
-
-/**
- *
- * This class is a minimal implementation of the original
- * org.apache.log4j.Logger class (as found in log4j 1.2)
- * delegating all calls to a {@link org.slf4j.Logger} instance.
- *
- *
- * @author Ceki Gülcü
- * */
-@SuppressWarnings("rawtypes")
-public class Logger extends Category {
-
- private static final String LOGGER_FQCN = Logger.class.getName();
-
- protected Logger(String name) {
- super(name);
- }
-
- public static Logger getLogger(String name) {
- return Log4jLoggerFactory.getLogger(name);
- }
-
- public static Logger getLogger(String name, LoggerFactory loggerFactory) {
- return Log4jLoggerFactory.getLogger(name, loggerFactory);
- }
-
- public static Logger getLogger(Class clazz) {
- return getLogger(clazz.getName());
- }
-
- /**
- * Does the obvious.
- *
- * @return
- */
- public static Logger getRootLogger() {
- return Log4jLoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#isTraceEnabled}
- * method of SLF4J.
- */
- public boolean isTraceEnabled() {
- return slf4jLogger.isTraceEnabled();
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#trace(String)} method in SLF4J.
- */
- public void trace(Object message) {
- differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null);
- }
-
- /**
- * Delegates to {@link org.slf4j.Logger#trace(String,Throwable)}
- * method in SLF4J.
- */
- public void trace(Object message, Throwable t) {
- differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null);
- }
-
-}
+/*
+ * 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;
+
+import org.apache.log4j.spi.LoggerFactory;
+import org.slf4j.spi.LocationAwareLogger;
+
+/**
+ *
+ * This class is a minimal implementation of the original
+ * org.apache.log4j.Logger class (as found in log4j 1.2)
+ * delegating all calls to a {@link org.slf4j.Logger} instance.
+ *
+ *
+ * @author Ceki Gülcü
+ * */
+@SuppressWarnings("rawtypes")
+public class Logger extends Category {
+
+ private static final String LOGGER_FQCN = Logger.class.getName();
+
+ protected Logger(String name) {
+ super(name);
+ }
+
+ public static Logger getLogger(String name) {
+ return Log4jLoggerFactory.getLogger(name);
+ }
+
+ public static Logger getLogger(String name, LoggerFactory loggerFactory) {
+ return Log4jLoggerFactory.getLogger(name, loggerFactory);
+ }
+
+ public static Logger getLogger(Class clazz) {
+ return getLogger(clazz.getName());
+ }
+
+ /**
+ * Does the obvious.
+ *
+ * @return
+ */
+ public static Logger getRootLogger() {
+ return Log4jLoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#isTraceEnabled}
+ * method of SLF4J.
+ */
+ public boolean isTraceEnabled() {
+ return slf4jLogger.isTraceEnabled();
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#trace(String)} method in SLF4J.
+ */
+ public void trace(Object message) {
+ differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null);
+ }
+
+ /**
+ * Delegates to {@link org.slf4j.Logger#trace(String,Throwable)}
+ * method in SLF4J.
+ */
+ public void trace(Object message, Throwable t) {
+ differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null);
+ }
+
+}
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 03b892b..c4a8eff 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
@@ -1,64 +1,64 @@
-/*
- * 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;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-public class MDC {
-
- public static void put(String key, String value) {
- org.slf4j.MDC.put(key, value);
- }
-
- public static void put(String key, Object value) {
- if (value != null) {
- put(key, value.toString());
- } else {
- put(key, null);
- }
- }
-
- public static Object get(String key) {
- return org.slf4j.MDC.get(key);
- }
-
- public static void remove(String key) {
- org.slf4j.MDC.remove(key);
- }
-
- public static void clear() {
- org.slf4j.MDC.clear();
- }
-
- /**
- * 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.
- */
- @SuppressWarnings({ "rawtypes", "unchecked" })
- @Deprecated
- public static Hashtable getContext() {
- Map map = org.slf4j.MDC.getCopyOfContextMap();
-
- if (map != null) {
- return new Hashtable(map);
- } else {
- return new Hashtable();
- }
- }
-}
+/*
+ * 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;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+public class MDC {
+
+ public static void put(String key, String value) {
+ org.slf4j.MDC.put(key, value);
+ }
+
+ public static void put(String key, Object value) {
+ if (value != null) {
+ put(key, value.toString());
+ } else {
+ put(key, null);
+ }
+ }
+
+ public static Object get(String key) {
+ return org.slf4j.MDC.get(key);
+ }
+
+ public static void remove(String key) {
+ org.slf4j.MDC.remove(key);
+ }
+
+ public static void clear() {
+ org.slf4j.MDC.clear();
+ }
+
+ /**
+ * 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.
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Deprecated
+ public static Hashtable getContext() {
+ Map map = org.slf4j.MDC.getCopyOfContextMap();
+
+ if (map != null) {
+ return new Hashtable(map);
+ } else {
+ return new Hashtable();
+ }
+ }
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java
index 8aec3eb..b8e8929 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/NDC.java
@@ -1,102 +1,102 @@
-/*
- * 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;
-
-import org.slf4j.MDC;
-
-import java.util.Stack;
-
-/**
- * A log4j's NDC implemented in terms of SLF4J MDC primitives.
- *
- * @since SLF4J 1.6.0
- */
-
-public class NDC {
-
- public final static String PREFIX = "NDC";
-
- public static void clear() {
- int depth = getDepth();
- for (int i = 0; i < depth; i++) {
- String key = PREFIX + i;
- MDC.remove(key);
- }
- }
-
- @SuppressWarnings("rawtypes")
- public static Stack cloneStack() {
- return null;
- }
-
- @SuppressWarnings("rawtypes")
- public static void inherit(Stack stack) {
- }
-
- static public String get() {
- return null;
- }
-
- public static int getDepth() {
- int i = 0;
- while (true) {
- String val = MDC.get(PREFIX + i);
- if (val != null) {
- i++;
- } else {
- break;
- }
- }
- return i;
- }
-
- public static String pop() {
- int next = getDepth();
- if (next == 0) {
- return "";
- }
- int last = next - 1;
- String key = PREFIX + last;
- String val = MDC.get(key);
- MDC.remove(key);
- return val;
- }
-
- public static String peek() {
- int next = getDepth();
- if (next == 0) {
- return "";
- }
- int last = next - 1;
- String key = PREFIX + last;
- String val = MDC.get(key);
- return val;
- }
-
- public static void push(String message) {
- int next = getDepth();
- MDC.put(PREFIX + next, message);
- }
-
- static public void remove() {
- clear();
- }
-
- static public void setMaxDepth(int maxDepth) {
- }
-
-}
+/*
+ * 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;
+
+import org.slf4j.MDC;
+
+import java.util.Stack;
+
+/**
+ * A log4j's NDC implemented in terms of SLF4J MDC primitives.
+ *
+ * @since SLF4J 1.6.0
+ */
+
+public class NDC {
+
+ public final static String PREFIX = "NDC";
+
+ public static void clear() {
+ int depth = getDepth();
+ for (int i = 0; i < depth; i++) {
+ String key = PREFIX + i;
+ MDC.remove(key);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public static Stack cloneStack() {
+ return null;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public static void inherit(Stack stack) {
+ }
+
+ static public String get() {
+ return null;
+ }
+
+ public static int getDepth() {
+ int i = 0;
+ while (true) {
+ String val = MDC.get(PREFIX + i);
+ if (val != null) {
+ i++;
+ } else {
+ break;
+ }
+ }
+ return i;
+ }
+
+ public static String pop() {
+ int next = getDepth();
+ if (next == 0) {
+ return "";
+ }
+ int last = next - 1;
+ String key = PREFIX + last;
+ String val = MDC.get(key);
+ MDC.remove(key);
+ return val;
+ }
+
+ public static String peek() {
+ int next = getDepth();
+ if (next == 0) {
+ return "";
+ }
+ int last = next - 1;
+ String key = PREFIX + last;
+ String val = MDC.get(key);
+ return val;
+ }
+
+ public static void push(String message) {
+ int next = getDepth();
+ MDC.put(PREFIX + next, message);
+ }
+
+ static public void remove() {
+ clear();
+ }
+
+ static public void setMaxDepth(int maxDepth) {
+ }
+
+}
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 021ccfe..a38df63 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
@@ -1,35 +1,35 @@
-/*
- * 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.
- */
-
-// Contributors: Christian Trutz
-package org.apache.log4j;
-
-/**
- * This class is a minimal implementation of the original Log4J class.
- *
- * @author Christian Trutz
- * */
-public class PatternLayout extends Layout {
-
- public PatternLayout() {
- super();
- }
-
- public PatternLayout(String pattern) {
- super();
- }
-
-}
+/*
+ * 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.
+ */
+
+// Contributors: Christian Trutz
+package org.apache.log4j;
+
+/**
+ * This class is a minimal implementation of the original Log4J class.
+ *
+ * @author Christian Trutz
+ * */
+public class PatternLayout extends Layout {
+
+ public PatternLayout() {
+ super();
+ }
+
+ public PatternLayout(String pattern) {
+ super();
+ }
+
+}
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 e8886e1..bb4f8d4 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
@@ -1,170 +1,170 @@
-/*
- * 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.
- */
-
-// Contributors: Kitching Simon
-
-package org.apache.log4j;
-
-// Contributors: Kitching Simon
-
-/**
- Refrain from using this class directly, use
- the {@link Level} class instead.
-
- @author Ceki Gülcü */
-public class Priority {
-
- transient int level;
- transient String levelStr;
- transient int syslogEquivalent;
-
- public final static int OFF_INT = Integer.MAX_VALUE;
- public final static int FATAL_INT = 50000;
- public final static int ERROR_INT = 40000;
- public final static int WARN_INT = 30000;
- public final static int INFO_INT = 20000;
- public final static int DEBUG_INT = 10000;
- // public final static int FINE_INT = DEBUG_INT;
- public final static int ALL_INT = Integer.MIN_VALUE;
-
- /**
- * @deprecated Use {@link Level#FATAL} instead.
- */
- final static public Priority FATAL = new Level(FATAL_INT, "FATAL", 0);
-
- /**
- * @deprecated Use {@link Level#ERROR} instead.
- */
- final static public Priority ERROR = new Level(ERROR_INT, "ERROR", 3);
-
- /**
- * @deprecated Use {@link Level#WARN} instead.
- */
- final static public Priority WARN = new Level(WARN_INT, "WARN", 4);
-
- /**
- * @deprecated Use {@link Level#INFO} instead.
- */
- final static public Priority INFO = new Level(INFO_INT, "INFO", 6);
-
- /**
- * @deprecated Use {@link Level#DEBUG} instead.
- */
- final static public Priority DEBUG = new Level(DEBUG_INT, "DEBUG", 7);
-
- /**
- * Default constructor for deserialization.
- */
- protected Priority() {
- level = DEBUG_INT;
- levelStr = "DEBUG";
- syslogEquivalent = 7;
- }
-
- /**
- Instantiate a level object.
- */
- protected Priority(int level, String levelStr, int syslogEquivalent) {
- this.level = level;
- this.levelStr = levelStr;
- this.syslogEquivalent = syslogEquivalent;
- }
-
- /**
- Two priorities are equal if their level fields are equal.
- @since 1.2
- */
- public boolean equals(Object o) {
- if (o instanceof Priority) {
- Priority r = (Priority) o;
- return (this.level == r.level);
- } else {
- return false;
- }
- }
-
- /**
- Return the syslog equivalent of this priority as an integer.
- */
- public final int getSyslogEquivalent() {
- return syslogEquivalent;
- }
-
- /**
- Returns true if this level has a higher or equal
- level than the level passed as argument, false
- otherwise.
-
-
You should think twice before overriding the default
- implementation of isGreaterOrEqual method.
-
- */
- public boolean isGreaterOrEqual(Priority r) {
- return level >= r.level;
- }
-
- /**
- Return all possible priorities as an array of Level objects in
- descending order.
-
- @deprecated This method will be removed with no replacement.
- */
- public static Priority[] getAllPossiblePriorities() {
- return new Priority[] { Priority.FATAL, Priority.ERROR, Level.WARN, Priority.INFO, Priority.DEBUG };
- }
-
- /**
- Returns the string representation of this priority.
- */
- final public String toString() {
- return levelStr;
- }
-
- /**
- Returns the integer representation of this level.
- */
- public final int toInt() {
- return level;
- }
-
- /**
- * @deprecated Please use the {@link Level#toLevel(String)} method instead.
- */
- public static Priority toPriority(String sArg) {
- return Level.toLevel(sArg);
- }
-
- /**
- * @deprecated Please use the {@link Level#toLevel(int)} method instead.
- */
- public static Priority toPriority(int val) {
- return toPriority(val, Priority.DEBUG);
- }
-
- /**
- * @deprecated Please use the {@link Level#toLevel(int, Level)} method instead.
- */
- 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.
- */
- public static Priority toPriority(String sArg, Priority defaultPriority) {
- return Level.toLevel(sArg, (Level) defaultPriority);
- }
+/*
+ * 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.
+ */
+
+// Contributors: Kitching Simon
+
+package org.apache.log4j;
+
+// Contributors: Kitching Simon
+
+/**
+ Refrain from using this class directly, use
+ the {@link Level} class instead.
+
+ @author Ceki Gülcü */
+public class Priority {
+
+ transient int level;
+ transient String levelStr;
+ transient int syslogEquivalent;
+
+ public final static int OFF_INT = Integer.MAX_VALUE;
+ public final static int FATAL_INT = 50000;
+ public final static int ERROR_INT = 40000;
+ public final static int WARN_INT = 30000;
+ public final static int INFO_INT = 20000;
+ public final static int DEBUG_INT = 10000;
+ // public final static int FINE_INT = DEBUG_INT;
+ public final static int ALL_INT = Integer.MIN_VALUE;
+
+ /**
+ * @deprecated Use {@link Level#FATAL} instead.
+ */
+ final static public Priority FATAL = new Level(FATAL_INT, "FATAL", 0);
+
+ /**
+ * @deprecated Use {@link Level#ERROR} instead.
+ */
+ final static public Priority ERROR = new Level(ERROR_INT, "ERROR", 3);
+
+ /**
+ * @deprecated Use {@link Level#WARN} instead.
+ */
+ final static public Priority WARN = new Level(WARN_INT, "WARN", 4);
+
+ /**
+ * @deprecated Use {@link Level#INFO} instead.
+ */
+ final static public Priority INFO = new Level(INFO_INT, "INFO", 6);
+
+ /**
+ * @deprecated Use {@link Level#DEBUG} instead.
+ */
+ final static public Priority DEBUG = new Level(DEBUG_INT, "DEBUG", 7);
+
+ /**
+ * Default constructor for deserialization.
+ */
+ protected Priority() {
+ level = DEBUG_INT;
+ levelStr = "DEBUG";
+ syslogEquivalent = 7;
+ }
+
+ /**
+ Instantiate a level object.
+ */
+ protected Priority(int level, String levelStr, int syslogEquivalent) {
+ this.level = level;
+ this.levelStr = levelStr;
+ this.syslogEquivalent = syslogEquivalent;
+ }
+
+ /**
+ Two priorities are equal if their level fields are equal.
+ @since 1.2
+ */
+ public boolean equals(Object o) {
+ if (o instanceof Priority) {
+ Priority r = (Priority) o;
+ return (this.level == r.level);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ Return the syslog equivalent of this priority as an integer.
+ */
+ public final int getSyslogEquivalent() {
+ return syslogEquivalent;
+ }
+
+ /**
+ Returns true if this level has a higher or equal
+ level than the level passed as argument, false
+ otherwise.
+
+
You should think twice before overriding the default
+ implementation of isGreaterOrEqual method.
+
+ */
+ public boolean isGreaterOrEqual(Priority r) {
+ return level >= r.level;
+ }
+
+ /**
+ Return all possible priorities as an array of Level objects in
+ descending order.
+
+ @deprecated This method will be removed with no replacement.
+ */
+ public static Priority[] getAllPossiblePriorities() {
+ return new Priority[] { Priority.FATAL, Priority.ERROR, Level.WARN, Priority.INFO, Priority.DEBUG };
+ }
+
+ /**
+ Returns the string representation of this priority.
+ */
+ final public String toString() {
+ return levelStr;
+ }
+
+ /**
+ Returns the integer representation of this level.
+ */
+ public final int toInt() {
+ return level;
+ }
+
+ /**
+ * @deprecated Please use the {@link Level#toLevel(String)} method instead.
+ */
+ public static Priority toPriority(String sArg) {
+ return Level.toLevel(sArg);
+ }
+
+ /**
+ * @deprecated Please use the {@link Level#toLevel(int)} method instead.
+ */
+ public static Priority toPriority(int val) {
+ return toPriority(val, Priority.DEBUG);
+ }
+
+ /**
+ * @deprecated Please use the {@link Level#toLevel(int, Level)} method instead.
+ */
+ 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.
+ */
+ public static Priority toPriority(String sArg, Priority defaultPriority) {
+ return Level.toLevel(sArg, (Level) defaultPriority);
+ }
}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 7f7bd2f..baf4c13 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
@@ -1,52 +1,52 @@
-/*
- * 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;
-
-import java.net.URL;
-import java.util.Properties;
-
-import org.apache.log4j.spi.Configurator;
-import org.apache.log4j.spi.LoggerRepository;
-
-/**
- * An nop implementation of PropertyConfigurator.
- */
-public class PropertyConfigurator implements Configurator {
- public static void configure(Properties properties) {
- }
-
- public static void configure(String configFilename) {
- }
-
- public static void configure(java.net.URL configURL) {
- }
-
- public static void configureAndWatch(String configFilename) {
- }
-
- public static void configureAndWatch(String configFilename, long delay) {
- }
-
- public void doConfigure(Properties properties, LoggerRepository hierarchy) {
- }
-
- public void doConfigure(String configFileName, LoggerRepository hierarchy) {
- }
-
- public void doConfigure(URL configURL, LoggerRepository hierarchy) {
- }
-}
+/*
+ * 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;
+
+import java.net.URL;
+import java.util.Properties;
+
+import org.apache.log4j.spi.Configurator;
+import org.apache.log4j.spi.LoggerRepository;
+
+/**
+ * An nop implementation of PropertyConfigurator.
+ */
+public class PropertyConfigurator implements Configurator {
+ public static void configure(Properties properties) {
+ }
+
+ public static void configure(String configFilename) {
+ }
+
+ public static void configure(java.net.URL configURL) {
+ }
+
+ public static void configureAndWatch(String configFilename) {
+ }
+
+ public static void configureAndWatch(String configFilename, long delay) {
+ }
+
+ public void doConfigure(Properties properties, LoggerRepository hierarchy) {
+ }
+
+ public void doConfigure(String configFileName, LoggerRepository hierarchy) {
+ }
+
+ public void doConfigure(URL configURL, LoggerRepository hierarchy) {
+ }
+}
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 f902b01..b329597 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
@@ -1,49 +1,49 @@
-/*
- * 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.
- */
-
-// Contributors: Christian Trutz
-package org.apache.log4j;
-
-import java.io.IOException;
-
-/**
- * This class is a minimal implementation of the original Log4J class.
- *
- * @author Christian Trutz
- * */
-public class RollingFileAppender {
-
- public RollingFileAppender() {
- super();
- }
-
- public RollingFileAppender(Layout layout, String filename) throws IOException {
- super();
- }
-
- public RollingFileAppender(Layout layout, String filename, boolean append) throws IOException {
- super();
- }
-
- public void setMaxBackupIndex(int maxBackups) {
- // nothing to do
- }
-
- public void setMaximumFileSize(long maxFileSize) {
- // nothing to do
- }
-
-}
+/*
+ * 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.
+ */
+
+// Contributors: Christian Trutz
+package org.apache.log4j;
+
+import java.io.IOException;
+
+/**
+ * This class is a minimal implementation of the original Log4J class.
+ *
+ * @author Christian Trutz
+ * */
+public class RollingFileAppender {
+
+ public RollingFileAppender() {
+ super();
+ }
+
+ public RollingFileAppender(Layout layout, String filename) throws IOException {
+ super();
+ }
+
+ public RollingFileAppender(Layout layout, String filename, boolean append) throws IOException {
+ super();
+ }
+
+ public void setMaxBackupIndex(int maxBackups) {
+ // nothing to do
+ }
+
+ public void setMaximumFileSize(long maxFileSize) {
+ // nothing to do
+ }
+
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/SimpleLayout.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/SimpleLayout.java
index 3e2c273..c2765f8 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/SimpleLayout.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/SimpleLayout.java
@@ -1,19 +1,19 @@
-/*
- * 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;
-
-public class SimpleLayout extends Layout {
-}
+/*
+ * 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;
+
+public class SimpleLayout extends Layout {
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/WriterAppender.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/WriterAppender.java
index 873175d..cb4df57 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/WriterAppender.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/WriterAppender.java
@@ -1,20 +1,20 @@
-/*
- * 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;
-
-public class WriterAppender extends AppenderSkeleton {
-
-}
+/*
+ * 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;
+
+public class WriterAppender extends AppenderSkeleton {
+
+}
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 18ea234..01157ab 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
@@ -1,161 +1,161 @@
-/*
- * 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.helpers;
-
-/**
- This class used to output log statements from within the log4j package.
-
-
Log4j components cannot make log4j logging calls. However, it is
- sometimes useful for the user to learn about what log4j is
- doing. You can enable log4j internal logging by defining the
- log4j.configDebug variable.
-
-
All log4j internal debug calls go to System.out
- where as internal error messages are sent to
- System.err. All internal messages are prepended with
- the string "log4j: ".
-
- @since 0.8.2
- @author Ceki Gülcü
-*/
-public class LogLog {
-
- /**
- Defining this value makes log4j print log4j-internal debug
- statements to System.out.
-
-
The value of this string is log4j.debug.
-
-
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 System.out.
-
-
The value of this string is log4j.configDebug.
-
-
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";
-
- protected static boolean debugEnabled = false;
-
- /**
- In quietMode not even errors generate any output.
- */
- private static boolean quietMode = false;
-
- private static final String PREFIX = "log4j: ";
- private static final String ERR_PREFIX = "log4j:ERROR ";
- private static final String WARN_PREFIX = "log4j:WARN ";
-
- static {
- }
-
- /**
- Allows to enable/disable log4j internal logging.
- */
- static public void setInternalDebugging(boolean enabled) {
- debugEnabled = enabled;
- }
-
- /**
- This method is used to output log4j internal debug
- statements. Output goes to System.out.
- */
- public static void debug(String msg) {
- if (debugEnabled && !quietMode) {
- System.out.println(PREFIX + msg);
- }
- }
-
- /**
- This method is used to output log4j internal debug
- statements. Output goes to System.out.
- */
- public static void debug(String msg, Throwable t) {
- if (debugEnabled && !quietMode) {
- System.out.println(PREFIX + msg);
- if (t != null)
- t.printStackTrace(System.out);
- }
- }
-
- /**
- This method is used to output log4j internal error
- statements. There is no way to disable error statements.
- Output goes to System.err.
- */
- public static void error(String msg) {
- if (quietMode)
- return;
- System.err.println(ERR_PREFIX + msg);
- }
-
- /**
- This method is used to output log4j internal error
- statements. There is no way to disable error statements.
- Output goes to System.err.
- */
- public static void error(String msg, Throwable t) {
- if (quietMode)
- return;
-
- System.err.println(ERR_PREFIX + msg);
- if (t != null) {
- t.printStackTrace();
- }
- }
-
- /**
- 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) {
- LogLog.quietMode = quietMode;
- }
-
- /**
- This method is used to output log4j internal warning
- statements. There is no way to disable warning statements.
- Output goes to System.err. */
- public static void warn(String msg) {
- if (quietMode)
- return;
-
- System.err.println(WARN_PREFIX + msg);
- }
-
- /**
- This method is used to output log4j internal warnings. There is
- no way to disable warning statements. Output goes to
- System.err. */
- public static void warn(String msg, Throwable t) {
- if (quietMode)
- return;
-
- System.err.println(WARN_PREFIX + msg);
- if (t != null) {
- t.printStackTrace();
- }
- }
-}
+/*
+ * 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.helpers;
+
+/**
+ This class used to output log statements from within the log4j package.
+
+
Log4j components cannot make log4j logging calls. However, it is
+ sometimes useful for the user to learn about what log4j is
+ doing. You can enable log4j internal logging by defining the
+ log4j.configDebug variable.
+
+
All log4j internal debug calls go to System.out
+ where as internal error messages are sent to
+ System.err. All internal messages are prepended with
+ the string "log4j: ".
+
+ @since 0.8.2
+ @author Ceki Gülcü
+*/
+public class LogLog {
+
+ /**
+ Defining this value makes log4j print log4j-internal debug
+ statements to System.out.
+
+
The value of this string is log4j.debug.
+
+
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 System.out.
+
+
The value of this string is log4j.configDebug.
+
+
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";
+
+ protected static boolean debugEnabled = false;
+
+ /**
+ In quietMode not even errors generate any output.
+ */
+ private static boolean quietMode = false;
+
+ private static final String PREFIX = "log4j: ";
+ private static final String ERR_PREFIX = "log4j:ERROR ";
+ private static final String WARN_PREFIX = "log4j:WARN ";
+
+ static {
+ }
+
+ /**
+ Allows to enable/disable log4j internal logging.
+ */
+ static public void setInternalDebugging(boolean enabled) {
+ debugEnabled = enabled;
+ }
+
+ /**
+ This method is used to output log4j internal debug
+ statements. Output goes to System.out.
+ */
+ public static void debug(String msg) {
+ if (debugEnabled && !quietMode) {
+ System.out.println(PREFIX + msg);
+ }
+ }
+
+ /**
+ This method is used to output log4j internal debug
+ statements. Output goes to System.out.
+ */
+ public static void debug(String msg, Throwable t) {
+ if (debugEnabled && !quietMode) {
+ System.out.println(PREFIX + msg);
+ if (t != null)
+ t.printStackTrace(System.out);
+ }
+ }
+
+ /**
+ This method is used to output log4j internal error
+ statements. There is no way to disable error statements.
+ Output goes to System.err.
+ */
+ public static void error(String msg) {
+ if (quietMode)
+ return;
+ System.err.println(ERR_PREFIX + msg);
+ }
+
+ /**
+ This method is used to output log4j internal error
+ statements. There is no way to disable error statements.
+ Output goes to System.err.
+ */
+ public static void error(String msg, Throwable t) {
+ if (quietMode)
+ return;
+
+ System.err.println(ERR_PREFIX + msg);
+ if (t != null) {
+ t.printStackTrace();
+ }
+ }
+
+ /**
+ 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) {
+ LogLog.quietMode = quietMode;
+ }
+
+ /**
+ This method is used to output log4j internal warning
+ statements. There is no way to disable warning statements.
+ Output goes to System.err. */
+ public static void warn(String msg) {
+ if (quietMode)
+ return;
+
+ System.err.println(WARN_PREFIX + msg);
+ }
+
+ /**
+ This method is used to output log4j internal warnings. There is
+ no way to disable warning statements. Output goes to
+ System.err. */
+ public static void warn(String msg, Throwable t) {
+ if (quietMode)
+ return;
+
+ System.err.println(WARN_PREFIX + msg);
+ if (t != null) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/helpers/NullEnumeration.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/helpers/NullEnumeration.java
index a10ce57..9c92396 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/helpers/NullEnumeration.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/helpers/NullEnumeration.java
@@ -1,47 +1,47 @@
-/*
- * 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.helpers;
-
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-/**
- * An always-empty Enumerator.
- *
- * @author Anders Kristensen
- * @since version 1.0
- */
-@SuppressWarnings("rawtypes")
-public class NullEnumeration implements Enumeration {
- private static final NullEnumeration instance = new NullEnumeration();
-
- private NullEnumeration() {
- }
-
- public static NullEnumeration getInstance() {
- return instance;
- }
-
- public boolean hasMoreElements() {
- return false;
- }
-
- public Object nextElement() {
- throw new NoSuchElementException();
- }
+/*
+ * 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.helpers;
+
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+
+/**
+ * An always-empty Enumerator.
+ *
+ * @author Anders Kristensen
+ * @since version 1.0
+ */
+@SuppressWarnings("rawtypes")
+public class NullEnumeration implements Enumeration {
+ private static final NullEnumeration instance = new NullEnumeration();
+
+ private NullEnumeration() {
+ }
+
+ public static NullEnumeration getInstance() {
+ return instance;
+ }
+
+ public boolean hasMoreElements() {
+ return false;
+ }
+
+ public Object nextElement() {
+ throw new NoSuchElementException();
+ }
}diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/package.html b/log4j-over-slf4j/src/main/java/org/apache/log4j/package.html
index 357d0e6..c3c8346 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/package.html
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/package.html
@@ -1,18 +1,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
An rather minimal but sufficient implementation redirecting all
- calls to a log4j logger to a logback logger.
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
An rather minimal but sufficient implementation redirecting all
+ calls to a log4j logger to a logback logger.
+
+
+
+
+
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 ef6ed89..abf7560 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
@@ -1,52 +1,52 @@
-/*
- * 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;
-
-import org.apache.log4j.spi.LoggerRepository;
-import java.net.URL;
-
-/**
- Implemented by classes capable of configuring log4j using a URL.
-
- @since 1.0
- @author Anders Kristensen
- */
-public interface Configurator {
-
- /**
- Special level value signifying inherited behaviour. The current
- value of this string constant is inherited. {@link #NULL}
- is a synonym. */
- public static final String INHERITED = "inherited";
-
- /**
- Special level signifying inherited behaviour, same as {@link
- #INHERITED}. The current value of this string constant is
- null. */
- public static final String NULL = "null";
-
- /**
- Interpret a resource pointed by a URL and set up log4j accordingly.
-
- The configuration is done relative to the hierarchy
- parameter.
-
- @param url The URL to parse
- @param repository The hierarchy to operation upon.
- */
- void doConfigure(URL url, LoggerRepository repository);
-}
+/*
+ * 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;
+
+import org.apache.log4j.spi.LoggerRepository;
+import java.net.URL;
+
+/**
+ Implemented by classes capable of configuring log4j using a URL.
+
+ @since 1.0
+ @author Anders Kristensen
+ */
+public interface Configurator {
+
+ /**
+ Special level value signifying inherited behaviour. The current
+ value of this string constant is inherited. {@link #NULL}
+ is a synonym. */
+ public static final String INHERITED = "inherited";
+
+ /**
+ Special level signifying inherited behaviour, same as {@link
+ #INHERITED}. The current value of this string constant is
+ null. */
+ public static final String NULL = "null";
+
+ /**
+ Interpret a resource pointed by a URL and set up log4j accordingly.
+
+ The configuration is done relative to the hierarchy
+ parameter.
+
+ @param url The URL to parse
+ @param repository The hierarchy to operation upon.
+ */
+ void doConfigure(URL url, LoggerRepository repository);
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/ErrorHandler.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/ErrorHandler.java
index 89f0b4e..0f1ccaf 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/ErrorHandler.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/ErrorHandler.java
@@ -1,27 +1,27 @@
-/*
- * 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;
-
-/**
- * Created by IntelliJ IDEA.
- * User: ceki
- * Date: 19 oct. 2010
- * Time: 11:46:24
- * To change this template use File | Settings | File Templates.
- */
-public class ErrorHandler {
-}
+/*
+ * 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;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ceki
+ * Date: 19 oct. 2010
+ * Time: 11:46:24
+ * To change this template use File | Settings | File Templates.
+ */
+public class ErrorHandler {
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Filter.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Filter.java
index e9b3f05..7e15506 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Filter.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Filter.java
@@ -1,20 +1,20 @@
-/*
- * 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 Filter {
-}
+/*
+ * 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 Filter {
+}
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 05d934d..9271b70 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
@@ -1,38 +1,38 @@
-/*
- * 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;
-
-import org.apache.log4j.*;
-
-/**
- Listen to events occurring within a {@link
- org.apache.log4j.Hierarchy Hierarchy}.
-
- @author Ceki Gülcü
- @since 1.2
-
- */
-public interface HierarchyEventListener {
-
- // public
- // void categoryCreationEvent(Category cat);
-
- public void addAppenderEvent(Category cat, Appender appender);
-
- public void removeAppenderEvent(Category cat, Appender appender);
-
-}
+/*
+ * 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;
+
+import org.apache.log4j.*;
+
+/**
+ Listen to events occurring within a {@link
+ org.apache.log4j.Hierarchy Hierarchy}.
+
+ @author Ceki Gülcü
+ @since 1.2
+
+ */
+public interface HierarchyEventListener {
+
+ // public
+ // void categoryCreationEvent(Category cat);
+
+ public void addAppenderEvent(Category cat, Appender appender);
+
+ public void removeAppenderEvent(Category cat, Appender appender);
+
+}
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 3eead60..c3e756d 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
@@ -1,36 +1,36 @@
-/*
- * 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;
-
-import org.apache.log4j.Logger;
-
-/**
-
- Implement this interface to create new instances of Logger or
- a sub-class of Logger.
-
-
See examples/subclass/MyLogger.java for an example.
-
- @author Ceki Gülcü
- @since version 0.8.5
-
- */
-public interface LoggerFactory {
-
- public Logger makeNewLoggerInstance(String name);
-
-}
+/*
+ * 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;
+
+import org.apache.log4j.Logger;
+
+/**
+
+ Implement this interface to create new instances of Logger or
+ a sub-class of Logger.
+
+
See examples/subclass/MyLogger.java for an example.
+
+ @author Ceki Gülcü
+ @since version 0.8.5
+
+ */
+public interface LoggerFactory {
+
+ public Logger makeNewLoggerInstance(String name);
+
+}
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 41368c4..4decdb7 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
@@ -1,95 +1,95 @@
-/*
- * 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;
-
-import org.apache.log4j.*;
-
-import java.util.Enumeration;
-
-/**
- * A LoggerRepository is used to create and retrieve
- * Loggers. The relation between loggers in a repository
- * depends on the repository but typically loggers are arranged in a
- * named hierarchy.
- *
- *
In addition to the creational methods, a
- * LoggerRepository can be queried for existing loggers,
- * can act as a point of registry for events related to loggers.
- *
- * @author Ceki Gülcü
- * @since 1.2
- */
-public interface LoggerRepository {
-
- /**
- * Add a {@link HierarchyEventListener} event to the repository.
- */
- public void addHierarchyEventListener(HierarchyEventListener listener);
-
- /**
- * Returns whether this repository is disabled for a given
- * level. The answer depends on the repository threshold and the
- * level parameter. See also {@link #setThreshold}
- * method.
- */
- boolean isDisabled(int level);
-
- /**
- * Set the repository-wide threshold. All logging requests below the
- * threshold are immediately dropped. By default, the threshold is
- * set to Level.ALL which has the lowest possible rank.
- */
- public void setThreshold(Level level);
-
- /**
- * Another form of {@link #setThreshold(Level)} accepting a string
- * parameter instead of a Level.
- */
- public void setThreshold(String val);
-
- public void emitNoAppenderWarning(Category cat);
-
- /**
- * Get the repository-wide threshold. See {@link
- * #setThreshold(Level)} for an explanation.
- */
- public Level getThreshold();
-
- public Logger getLogger(String name);
-
- public Logger getLogger(String name, LoggerFactory factory);
-
- public Logger getRootLogger();
-
- public abstract Logger exists(String name);
-
- public abstract void shutdown();
-
- @SuppressWarnings("rawtypes")
- public Enumeration getCurrentLoggers();
-
- /**
- * Deprecated. Please use {@link #getCurrentLoggers} instead.
- */
- @SuppressWarnings("rawtypes")
- public Enumeration getCurrentCategories();
-
- public abstract void fireAddAppenderEvent(Category logger, Appender appender);
-
- public abstract void resetConfiguration();
-
-}
+/*
+ * 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;
+
+import org.apache.log4j.*;
+
+import java.util.Enumeration;
+
+/**
+ * A LoggerRepository is used to create and retrieve
+ * Loggers. The relation between loggers in a repository
+ * depends on the repository but typically loggers are arranged in a
+ * named hierarchy.
+ *
+ *
In addition to the creational methods, a
+ * LoggerRepository can be queried for existing loggers,
+ * can act as a point of registry for events related to loggers.
+ *
+ * @author Ceki Gülcü
+ * @since 1.2
+ */
+public interface LoggerRepository {
+
+ /**
+ * Add a {@link HierarchyEventListener} event to the repository.
+ */
+ public void addHierarchyEventListener(HierarchyEventListener listener);
+
+ /**
+ * Returns whether this repository is disabled for a given
+ * level. The answer depends on the repository threshold and the
+ * level parameter. See also {@link #setThreshold}
+ * method.
+ */
+ boolean isDisabled(int level);
+
+ /**
+ * Set the repository-wide threshold. All logging requests below the
+ * threshold are immediately dropped. By default, the threshold is
+ * set to Level.ALL which has the lowest possible rank.
+ */
+ public void setThreshold(Level level);
+
+ /**
+ * Another form of {@link #setThreshold(Level)} accepting a string
+ * parameter instead of a Level.
+ */
+ public void setThreshold(String val);
+
+ public void emitNoAppenderWarning(Category cat);
+
+ /**
+ * Get the repository-wide threshold. See {@link
+ * #setThreshold(Level)} for an explanation.
+ */
+ public Level getThreshold();
+
+ public Logger getLogger(String name);
+
+ public Logger getLogger(String name, LoggerFactory factory);
+
+ public Logger getRootLogger();
+
+ public abstract Logger exists(String name);
+
+ public abstract void shutdown();
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration getCurrentLoggers();
+
+ /**
+ * Deprecated. Please use {@link #getCurrentLoggers} instead.
+ */
+ @SuppressWarnings("rawtypes")
+ public Enumeration getCurrentCategories();
+
+ public abstract void fireAddAppenderEvent(Category logger, Appender appender);
+
+ public abstract void resetConfiguration();
+
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggingEvent.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggingEvent.java
index 43e4a4c..ea78c89 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggingEvent.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggingEvent.java
@@ -1,20 +1,20 @@
-/*
- * 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 LoggingEvent {
-}
+/*
+ * 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 LoggingEvent {
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/OptionHandler.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/OptionHandler.java
index b2e5305..c1e0150 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/OptionHandler.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/spi/OptionHandler.java
@@ -1,22 +1,22 @@
-/*
- * 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 interface OptionHandler {
-
- void activateOptions();
-
-}
+/*
+ * 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 interface OptionHandler {
+
+ void activateOptions();
+
+}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/xml/DOMConfigurator.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/xml/DOMConfigurator.java
index 7cb1440..c133716 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/xml/DOMConfigurator.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/xml/DOMConfigurator.java
@@ -1,66 +1,66 @@
-/*
- * 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.xml;
-
-import org.apache.log4j.spi.Configurator;
-import org.apache.log4j.spi.LoggerRepository;
-
-import javax.xml.parsers.FactoryConfigurationError;
-import java.io.InputStream;
-import java.io.Reader;
-import java.net.URL;
-import java.util.Properties;
-
-import org.w3c.dom.Element;
-
-public class DOMConfigurator implements Configurator {
-
- public static void configure(Element element) {
- }
-
- public static void configure(String filename) throws FactoryConfigurationError {
- }
-
- static public void configure(URL url) throws FactoryConfigurationError {
- }
-
- static public void configureAndWatch(String configFilename) {
- }
-
- public static void configureAndWatch(String configFilename, long delay) {
- }
-
- public void doConfigure(Element element, LoggerRepository repository) {
- }
-
- public void doConfigure(InputStream inputStream, LoggerRepository repository) throws FactoryConfigurationError {
- }
-
- public void doConfigure(Reader reader, LoggerRepository repository) throws FactoryConfigurationError {
- }
-
- public void doConfigure(String filename, LoggerRepository repository) {
- }
-
- public void doConfigure(URL url, LoggerRepository repository) {
- }
-
- public static String subst(String value, Properties props) {
- return value;
- }
-
-}
+/*
+ * 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.xml;
+
+import org.apache.log4j.spi.Configurator;
+import org.apache.log4j.spi.LoggerRepository;
+
+import javax.xml.parsers.FactoryConfigurationError;
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Properties;
+
+import org.w3c.dom.Element;
+
+public class DOMConfigurator implements Configurator {
+
+ public static void configure(Element element) {
+ }
+
+ public static void configure(String filename) throws FactoryConfigurationError {
+ }
+
+ static public void configure(URL url) throws FactoryConfigurationError {
+ }
+
+ static public void configureAndWatch(String configFilename) {
+ }
+
+ public static void configureAndWatch(String configFilename, long delay) {
+ }
+
+ public void doConfigure(Element element, LoggerRepository repository) {
+ }
+
+ public void doConfigure(InputStream inputStream, LoggerRepository repository) throws FactoryConfigurationError {
+ }
+
+ public void doConfigure(Reader reader, LoggerRepository repository) throws FactoryConfigurationError {
+ }
+
+ public void doConfigure(String filename, LoggerRepository repository) {
+ }
+
+ public void doConfigure(URL url, LoggerRepository repository) {
+ }
+
+ public static String subst(String value, Properties props) {
+ return value;
+ }
+
+}
diff --git a/log4j-over-slf4j/src/main/resources/META-INF/MANIFEST.MF b/log4j-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
old file mode 100644
new file mode 100755
index 3e98459..b63540a 100755
--- a/log4j-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
+++ b/log4j-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
@@ -1,13 +1,13 @@
-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}
+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/NDCTest.java
index 82e2326..8b12fbe 100644
--- a/log4j-over-slf4j/src/test/java/org/apache/log4j/NDCTest.java
+++ b/log4j-over-slf4j/src/test/java/org/apache/log4j/NDCTest.java
@@ -1,69 +1,69 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.apache.log4j;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Ceki Gülcü
- */
-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();
- assertEquals(0, NDC.getDepth());
- }
-
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.apache.log4j;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Ceki Gülcü
+ */
+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();
+ assertEquals(0, NDC.getDepth());
+ }
+
+}
diff --git a/log4j-over-slf4j/src/test/java/org/apache/log4j/Trivial.java b/log4j-over-slf4j/src/test/java/org/apache/log4j/Trivial.java
index cb157e7..50edf2d 100644
--- a/log4j-over-slf4j/src/test/java/org/apache/log4j/Trivial.java
+++ b/log4j-over-slf4j/src/test/java/org/apache/log4j/Trivial.java
@@ -1,51 +1,51 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.apache.log4j;
-
-import org.apache.log4j.Logger;
-
-import junit.framework.TestCase;
-
-public class Trivial extends TestCase {
-
- public void testSmoke() {
- Logger l = Logger.getLogger("a");
- l.trace("t");
- l.debug("d");
- l.info("i");
- l.warn("w");
- l.error("e");
- l.fatal("f");
-
- Exception e = new Exception("testing");
- l.trace("t", e);
- l.debug("d", e);
- l.info("i", e);
- l.warn("w", e);
- l.error("e", e);
- l.fatal("f", e);
- }
-
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.apache.log4j;
+
+import org.apache.log4j.Logger;
+
+import junit.framework.TestCase;
+
+public class Trivial extends TestCase {
+
+ public void testSmoke() {
+ Logger l = Logger.getLogger("a");
+ l.trace("t");
+ l.debug("d");
+ l.info("i");
+ l.warn("w");
+ l.error("e");
+ l.fatal("f");
+
+ Exception e = new Exception("testing");
+ l.trace("t", e);
+ l.debug("d", e);
+ l.info("i", e);
+ l.warn("w", e);
+ l.error("e", e);
+ l.fatal("f", e);
+ }
+
+}
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 506f8a3..4453ac2 100644
--- a/log4j-over-slf4j/src/test/java/org/dummy/Bug131.java
+++ b/log4j-over-slf4j/src/test/java/org/dummy/Bug131.java
@@ -1,70 +1,70 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.dummy;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-import org.apache.log4j.Category;
-import org.apache.log4j.Logger;
-import org.junit.Test;
-
-public class Bug131 {
-
- @Test
- public void testBug131() {
-
- ListHandler listHandler = new ListHandler();
- java.util.logging.Logger root = java.util.logging.Logger.getLogger("");
- root.addHandler(listHandler);
- root.setLevel(Level.FINEST);
- Logger log4jLogger = Logger.getLogger("a");
- Category log4jCategory = Logger.getLogger("b");
-
- int n = 0;
-
- log4jLogger.trace("msg" + (n++));
- log4jLogger.debug("msg" + (n++));
- log4jLogger.info("msg" + (n++));
- log4jLogger.warn("msg" + (n++));
- log4jLogger.error("msg" + (n++));
- log4jLogger.fatal("msg" + (n++));
-
- log4jCategory.debug("msg" + (n++));
- log4jCategory.info("msg" + (n++));
- log4jCategory.warn("msg" + (n++));
- log4jCategory.error("msg" + (n++));
- log4jCategory.fatal("msg" + (n++));
-
- assertEquals(n, listHandler.list.size());
-
- for (int i = 0; i < n; i++) {
- LogRecord logRecord = (LogRecord) listHandler.list.get(i);
- assertEquals("testBug131", logRecord.getSourceMethodName());
- }
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.dummy;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
+import org.junit.Test;
+
+public class Bug131 {
+
+ @Test
+ public void testBug131() {
+
+ ListHandler listHandler = new ListHandler();
+ java.util.logging.Logger root = java.util.logging.Logger.getLogger("");
+ root.addHandler(listHandler);
+ root.setLevel(Level.FINEST);
+ Logger log4jLogger = Logger.getLogger("a");
+ Category log4jCategory = Logger.getLogger("b");
+
+ int n = 0;
+
+ log4jLogger.trace("msg" + (n++));
+ log4jLogger.debug("msg" + (n++));
+ log4jLogger.info("msg" + (n++));
+ log4jLogger.warn("msg" + (n++));
+ log4jLogger.error("msg" + (n++));
+ log4jLogger.fatal("msg" + (n++));
+
+ log4jCategory.debug("msg" + (n++));
+ log4jCategory.info("msg" + (n++));
+ log4jCategory.warn("msg" + (n++));
+ log4jCategory.error("msg" + (n++));
+ log4jCategory.fatal("msg" + (n++));
+
+ assertEquals(n, listHandler.list.size());
+
+ for (int i = 0; i < n; i++) {
+ LogRecord logRecord = (LogRecord) listHandler.list.get(i);
+ assertEquals("testBug131", logRecord.getSourceMethodName());
+ }
+ }
+}
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 0b1916e..1bb280c 100644
--- a/log4j-over-slf4j/src/test/java/org/dummy/Bug139.java
+++ b/log4j-over-slf4j/src/test/java/org/dummy/Bug139.java
@@ -1,59 +1,59 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.dummy;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-import org.apache.log4j.Category;
-import org.apache.log4j.Logger;
-import org.junit.Test;
-
-public class Bug139 {
-
- @Test
- public void test() {
- ListHandler listHandler = new ListHandler();
- java.util.logging.Logger root = java.util.logging.Logger.getLogger("");
- root.addHandler(listHandler);
- root.setLevel(Level.FINEST);
- Logger log4jLogger = Logger.getLogger("a");
- Category log4jCategory = Logger.getLogger("b");
-
- int n = 0;
-
- log4jLogger.log(org.apache.log4j.Level.DEBUG, "hello" + (++n));
- log4jCategory.log(org.apache.log4j.Level.DEBUG, "world" + (++n));
-
- assertEquals(n, listHandler.list.size());
-
- for (int i = 0; i < n; i++) {
- LogRecord logRecord = (LogRecord) listHandler.list.get(i);
- assertEquals("test", logRecord.getSourceMethodName());
- }
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.dummy;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
+import org.junit.Test;
+
+public class Bug139 {
+
+ @Test
+ public void test() {
+ ListHandler listHandler = new ListHandler();
+ java.util.logging.Logger root = java.util.logging.Logger.getLogger("");
+ root.addHandler(listHandler);
+ root.setLevel(Level.FINEST);
+ Logger log4jLogger = Logger.getLogger("a");
+ Category log4jCategory = Logger.getLogger("b");
+
+ int n = 0;
+
+ log4jLogger.log(org.apache.log4j.Level.DEBUG, "hello" + (++n));
+ log4jCategory.log(org.apache.log4j.Level.DEBUG, "world" + (++n));
+
+ assertEquals(n, listHandler.list.size());
+
+ for (int i = 0; i < n; i++) {
+ LogRecord logRecord = (LogRecord) listHandler.list.get(i);
+ assertEquals("test", logRecord.getSourceMethodName());
+ }
+ }
+}
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 23fc473..c29ebfa 100644
--- a/log4j-over-slf4j/src/test/java/org/dummy/ListHandler.java
+++ b/log4j-over-slf4j/src/test/java/org/dummy/ListHandler.java
@@ -1,49 +1,49 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.dummy;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Handler;
-import java.util.logging.LogRecord;
-
-public class ListHandler extends Handler {
-
- List list = new ArrayList();
-
- public void close() throws SecurityException {
-
- }
-
- public void flush() {
-
- }
-
- public void publish(LogRecord logRecord) {
- logRecord.getSourceClassName();
- list.add(logRecord);
- }
-
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.dummy;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Handler;
+import java.util.logging.LogRecord;
+
+public class ListHandler extends Handler {
+
+ List list = new ArrayList();
+
+ public void close() throws SecurityException {
+
+ }
+
+ public void flush() {
+
+ }
+
+ public void publish(LogRecord logRecord) {
+ logRecord.getSourceClassName();
+ list.add(logRecord);
+ }
+
+}
diff --git a/osgi-over-slf4j/pom.xml b/osgi-over-slf4j/pom.xml
old file mode 100644
new file mode 100755
index 2b0d80a..967c369 100755
--- a/osgi-over-slf4j/pom.xml
+++ b/osgi-over-slf4j/pom.xml
@@ -1,44 +1,46 @@
-
-
-
- 4.0.0
-
-
- org.slf4j
- slf4j-parent
- 1.7.25
-
-
- osgi-over-slf4j
-
- jar
- OSGi LogService implemented over SLF4J
-
- http://www.slf4j.org
-
- OSGi LogService implementation over SLF4J
-
-
-
-
- org.osgi
- org.osgi.core
- 4.2.0
- provided
-
-
- org.osgi
- org.osgi.enterprise
- 4.2.0
- provided
-
-
-
- org.slf4j
- slf4j-simple
- ${project.version}
- provided
-
-
-
+
+
+
+ 4.0.0
+
+
+ org.slf4j
+ slf4j-parent
+ 1.7.26
+
+
+ osgi-over-slf4j
+
+ jar
+ OSGi LogService implemented over SLF4J
+
+ http://www.slf4j.org
+
+ OSGi LogService implementation over SLF4J
+
+
+
+
+ org.osgi
+ org.osgi.core
+ 4.2.0
+ provided
+
+
+ org.osgi
+ org.osgi.enterprise
+ 4.2.0
+ provided
+
+
+
+ org.slf4j
+ slf4j-simple
+ ${project.version}
+ provided
+
+
+
+
+
diff --git a/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/Activator.java b/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/Activator.java
index baa6695..8ac9039 100644
--- a/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/Activator.java
+++ b/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/Activator.java
@@ -1,78 +1,78 @@
-/*
- * Copyright (c) 2004-2005 QOS.ch
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, and/or sell copies of the Software, and to permit persons
- * to whom the Software is furnished to do so, provided that the above
- * copyright notice(s) and this permission notice appear in all copies of
- * the Software and that both the above copyright notice(s) and this
- * permission notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
- * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
- * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder
- * shall not be used in advertising or otherwise to promote the sale, use
- * or other dealings in this Software without prior written authorization
- * of the copyright holder.
- *
- */
-
-package org.slf4j.osgi.logservice.impl;
-
-import java.util.Properties;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.service.log.LogService;
-
-/**
- * Activator implements a simple bundle that registers a
- * {@link LogServiceFactory} for the creation of {@link LogService} implementations.
- *
- * @author John Conlon
- * @author Matt Bishop
- **/
-public class Activator implements BundleActivator {
- /**
- *
- * Implements BundleActivator.start() to register a
- * LogServiceFactory.
- *
- * @param bundleContext the framework context for the bundle
- * @throws Exception
- */
- public void start(BundleContext bundleContext) throws Exception {
-
- Properties props = new Properties();
- props.put("description", "An SLF4J LogService implementation.");
- ServiceFactory factory = new LogServiceFactory();
- bundleContext.registerService(LogService.class.getName(), factory, props);
- }
-
- /**
- *
- * Implements BundleActivator.stop().
- *
- * @param bundleContext the framework context for the bundle
- * @throws Exception
- */
- public void stop(BundleContext bundleContext) throws Exception {
-
- // Note: It is not required that we remove the service here, since
- // the framework will do it automatically.
- }
-}
+/*
+ * Copyright (c) 2004-2005 QOS.ch
+ *
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+ * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+package org.slf4j.osgi.logservice.impl;
+
+import java.util.Properties;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.service.log.LogService;
+
+/**
+ * Activator implements a simple bundle that registers a
+ * {@link LogServiceFactory} for the creation of {@link LogService} implementations.
+ *
+ * @author John Conlon
+ * @author Matt Bishop
+ **/
+public class Activator implements BundleActivator {
+ /**
+ *
+ * Implements BundleActivator.start() to register a
+ * LogServiceFactory.
+ *
+ * @param bundleContext the framework context for the bundle
+ * @throws Exception
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+
+ Properties props = new Properties();
+ props.put("description", "An SLF4J LogService implementation.");
+ ServiceFactory factory = new LogServiceFactory();
+ bundleContext.registerService(LogService.class.getName(), factory, props);
+ }
+
+ /**
+ *
+ * Implements BundleActivator.stop().
+ *
+ * @param bundleContext the framework context for the bundle
+ * @throws Exception
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+
+ // Note: It is not required that we remove the service here, since
+ // the framework will do it automatically.
+ }
+}
diff --git a/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/LogServiceFactory.java b/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/LogServiceFactory.java
index e52d10d..c626a2c 100644
--- a/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/LogServiceFactory.java
+++ b/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/LogServiceFactory.java
@@ -1,65 +1,65 @@
-/*
- * Copyright (c) 2004-2005 QOS.ch
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, and/or sell copies of the Software, and to permit persons
- * to whom the Software is furnished to do so, provided that the above
- * copyright notice(s) and this permission notice appear in all copies of
- * the Software and that both the above copyright notice(s) and this
- * permission notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
- * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
- * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder
- * shall not be used in advertising or otherwise to promote the sale, use
- * or other dealings in this Software without prior written authorization
- * of the copyright holder.
- *
- */
-
-package org.slf4j.osgi.logservice.impl;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * LogServiceFactory creates LogService implementations.
- *
- * @author John Conlon
- * @version $Rev$, $Date$
- */
-public class LogServiceFactory implements ServiceFactory {
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.ServiceFactory#getService(org.osgi.framework.Bundle,
- * org.osgi.framework.ServiceRegistration)
- */
- public Object getService(Bundle bundle, ServiceRegistration arg1) {
- return new LogServiceImpl(bundle);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.ServiceFactory#ungetService(org.osgi.framework.Bundle,
- * org.osgi.framework.ServiceRegistration, java.lang.Object)
- */
- public void ungetService(Bundle bundle, ServiceRegistration arg1, Object arg2) {
- // nothing to do.
- }
-}
+/*
+ * Copyright (c) 2004-2005 QOS.ch
+ *
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+ * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+package org.slf4j.osgi.logservice.impl;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * LogServiceFactory creates LogService implementations.
+ *
+ * @author John Conlon
+ * @version $Rev$, $Date$
+ */
+public class LogServiceFactory implements ServiceFactory {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.ServiceFactory#getService(org.osgi.framework.Bundle,
+ * org.osgi.framework.ServiceRegistration)
+ */
+ public Object getService(Bundle bundle, ServiceRegistration arg1) {
+ return new LogServiceImpl(bundle);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.ServiceFactory#ungetService(org.osgi.framework.Bundle,
+ * org.osgi.framework.ServiceRegistration, java.lang.Object)
+ */
+ public void ungetService(Bundle bundle, ServiceRegistration arg1, Object arg2) {
+ // nothing to do.
+ }
+}
diff --git a/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/LogServiceImpl.java b/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/LogServiceImpl.java
index 68e3379..c020c4e 100644
--- a/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/LogServiceImpl.java
+++ b/osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/LogServiceImpl.java
@@ -1,206 +1,206 @@
-/*
- * Copyright (c) 2004-2005 QOS.ch
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, and/or sell copies of the Software, and to permit persons
- * to whom the Software is furnished to do so, provided that the above
- * copyright notice(s) and this permission notice appear in all copies of
- * the Software and that both the above copyright notice(s) and this
- * permission notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
- * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
- * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder
- * shall not be used in advertising or otherwise to promote the sale, use
- * or other dealings in this Software without prior written authorization
- * of the copyright holder.
- *
- */
-
-package org.slf4j.osgi.logservice.impl;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-import org.osgi.service.log.LogService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * LogServiceImpl is a simple OSGi LogService implementation that delegates to a slf4j
- * Logger.
- *
- * @author John Conlon
- * @author Matt Bishop
- */
-public class LogServiceImpl implements LogService {
-
- private static final String UNKNOWN = "[Unknown]";
-
- private final Logger delegate;
-
- /**
- * Creates a new instance of LogServiceImpl.
- *
- * @param bundle The bundle to create a new LogService for.
- */
- public LogServiceImpl(Bundle bundle) {
-
- String name = bundle.getSymbolicName();
- Version version = bundle.getVersion();
- if (version == null) {
- version = Version.emptyVersion;
- }
- delegate = LoggerFactory.getLogger(name + '.' + version);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.service.log.LogService#log(int, java.lang.String)
- */
- public void log(int level, String message) {
-
- switch (level) {
- case LOG_DEBUG:
- delegate.debug(message);
- break;
- case LOG_ERROR:
- delegate.error(message);
- break;
- case LOG_INFO:
- delegate.info(message);
- break;
- case LOG_WARNING:
- delegate.warn(message);
- break;
- default:
- break;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.service.log.LogService#log(int, java.lang.String, java.lang.Throwable)
- */
- public void log(int level, String message, Throwable exception) {
-
- switch (level) {
- case LOG_DEBUG:
- delegate.debug(message, exception);
- break;
- case LOG_ERROR:
- delegate.error(message, exception);
- break;
- case LOG_INFO:
- delegate.info(message, exception);
- break;
- case LOG_WARNING:
- delegate.warn(message, exception);
- break;
- default:
- break;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String)
- */
- public void log(ServiceReference sr, int level, String message) {
-
- switch (level) {
- case LOG_DEBUG:
- if (delegate.isDebugEnabled()) {
- delegate.debug(createMessage(sr, message));
- }
- break;
- case LOG_ERROR:
- if (delegate.isErrorEnabled()) {
- delegate.error(createMessage(sr, message));
- }
- break;
- case LOG_INFO:
- if (delegate.isInfoEnabled()) {
- delegate.info(createMessage(sr, message));
- }
- break;
- case LOG_WARNING:
- if (delegate.isWarnEnabled()) {
- delegate.warn(createMessage(sr, message));
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * Formats the log message to indicate the service sending it, if known.
- *
- * @param sr the ServiceReference sending the message.
- * @param message The message to log.
- * @return The formatted log message.
- */
- private String createMessage(ServiceReference sr, String message) {
-
- StringBuilder output = new StringBuilder();
- if (sr != null) {
- output.append('[').append(sr.toString()).append(']');
- } else {
- output.append(UNKNOWN);
- }
- output.append(message);
-
- return output.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String,
- * java.lang.Throwable)
- */
- public void log(ServiceReference sr, int level, String message, Throwable exception) {
-
- switch (level) {
- case LOG_DEBUG:
- if (delegate.isDebugEnabled()) {
- delegate.debug(createMessage(sr, message), exception);
- }
- break;
- case LOG_ERROR:
- if (delegate.isErrorEnabled()) {
- delegate.error(createMessage(sr, message), exception);
- }
- break;
- case LOG_INFO:
- if (delegate.isInfoEnabled()) {
- delegate.info(createMessage(sr, message), exception);
- }
- break;
- case LOG_WARNING:
- if (delegate.isWarnEnabled()) {
- delegate.warn(createMessage(sr, message), exception);
- }
- break;
- default:
- break;
- }
- }
-}
+/*
+ * Copyright (c) 2004-2005 QOS.ch
+ *
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+ * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+package org.slf4j.osgi.logservice.impl;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+import org.osgi.service.log.LogService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * LogServiceImpl is a simple OSGi LogService implementation that delegates to a slf4j
+ * Logger.
+ *
+ * @author John Conlon
+ * @author Matt Bishop
+ */
+public class LogServiceImpl implements LogService {
+
+ private static final String UNKNOWN = "[Unknown]";
+
+ private final Logger delegate;
+
+ /**
+ * Creates a new instance of LogServiceImpl.
+ *
+ * @param bundle The bundle to create a new LogService for.
+ */
+ public LogServiceImpl(Bundle bundle) {
+
+ String name = bundle.getSymbolicName();
+ Version version = bundle.getVersion();
+ if (version == null) {
+ version = Version.emptyVersion;
+ }
+ delegate = LoggerFactory.getLogger(name + '.' + version);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.service.log.LogService#log(int, java.lang.String)
+ */
+ public void log(int level, String message) {
+
+ switch (level) {
+ case LOG_DEBUG:
+ delegate.debug(message);
+ break;
+ case LOG_ERROR:
+ delegate.error(message);
+ break;
+ case LOG_INFO:
+ delegate.info(message);
+ break;
+ case LOG_WARNING:
+ delegate.warn(message);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.service.log.LogService#log(int, java.lang.String, java.lang.Throwable)
+ */
+ public void log(int level, String message, Throwable exception) {
+
+ switch (level) {
+ case LOG_DEBUG:
+ delegate.debug(message, exception);
+ break;
+ case LOG_ERROR:
+ delegate.error(message, exception);
+ break;
+ case LOG_INFO:
+ delegate.info(message, exception);
+ break;
+ case LOG_WARNING:
+ delegate.warn(message, exception);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String)
+ */
+ public void log(ServiceReference sr, int level, String message) {
+
+ switch (level) {
+ case LOG_DEBUG:
+ if (delegate.isDebugEnabled()) {
+ delegate.debug(createMessage(sr, message));
+ }
+ break;
+ case LOG_ERROR:
+ if (delegate.isErrorEnabled()) {
+ delegate.error(createMessage(sr, message));
+ }
+ break;
+ case LOG_INFO:
+ if (delegate.isInfoEnabled()) {
+ delegate.info(createMessage(sr, message));
+ }
+ break;
+ case LOG_WARNING:
+ if (delegate.isWarnEnabled()) {
+ delegate.warn(createMessage(sr, message));
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Formats the log message to indicate the service sending it, if known.
+ *
+ * @param sr the ServiceReference sending the message.
+ * @param message The message to log.
+ * @return The formatted log message.
+ */
+ private String createMessage(ServiceReference sr, String message) {
+
+ StringBuilder output = new StringBuilder();
+ if (sr != null) {
+ output.append('[').append(sr.toString()).append(']');
+ } else {
+ output.append(UNKNOWN);
+ }
+ output.append(message);
+
+ return output.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String,
+ * java.lang.Throwable)
+ */
+ public void log(ServiceReference sr, int level, String message, Throwable exception) {
+
+ switch (level) {
+ case LOG_DEBUG:
+ if (delegate.isDebugEnabled()) {
+ delegate.debug(createMessage(sr, message), exception);
+ }
+ break;
+ case LOG_ERROR:
+ if (delegate.isErrorEnabled()) {
+ delegate.error(createMessage(sr, message), exception);
+ }
+ break;
+ case LOG_INFO:
+ if (delegate.isInfoEnabled()) {
+ delegate.info(createMessage(sr, message), exception);
+ }
+ break;
+ case LOG_WARNING:
+ if (delegate.isWarnEnabled()) {
+ delegate.warn(createMessage(sr, message), exception);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
diff --git a/osgi-over-slf4j/src/main/resources/META-INF/MANIFEST.MF b/osgi-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
index 97b13da..73cebcf 100644
--- a/osgi-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
+++ b/osgi-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
@@ -1,8 +1,8 @@
-Implementation-Title: osgi-over-slf4j
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.slf4j.osgi-over-slf4j
-Bundle-Name: OSGi LogService implemented over SLF4J
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Activator: org.slf4j.osgi.logservice.impl.Activator
-Bundle-Category: osgi
-Import-Package: org.osgi.framework;version="[1.5,2)",org.osgi.service.log;version="[1.3,2)",org.slf4j;version=${parsedVersion.osgiVersion}
+Implementation-Title: osgi-over-slf4j
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.slf4j.osgi-over-slf4j
+Bundle-Name: OSGi LogService implemented over SLF4J
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Activator: org.slf4j.osgi.logservice.impl.Activator
+Bundle-Category: osgi
+Import-Package: org.osgi.framework;version="[1.5,2)",org.osgi.service.log;version="[1.3,2)",org.slf4j;version=${parsedVersion.osgiVersion}
diff --git a/pom.xml b/pom.xml
old file mode 100644
new file mode 100755
index 0df1e97..e39dafe 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1,424 +1,427 @@
-
-
-
- 4.0.0
-
- org.slf4j
- slf4j-parent
- 1.7.25
-
- pom
- SLF4J
- Top SLF4J project pom.xml file
- http://www.slf4j.org
-
-
- QOS.ch
- http://www.qos.ch
-
- 2005
-
-
-
- MIT License
- http://www.opensource.org/licenses/mit-license.php
- repo
-
-
-
-
- https://github.com/qos-ch/slf4j
- git@github.com:qos-ch/slf4j.git
-
-
-
- 1.5
- ${required.jdk.version}
- ${required.jdk.version}
- UTF-8
- UTF-8
- UTF-8
-
- 1.6.0
- 0.8.1
- 1.2.17
- 1.0.13
- 4.12
- 3.3
- 2.10.4
-
-
-
-
- ceki
- Ceki Gulcu
- ceki@qos.ch
-
-
-
-
- slf4j-api
- slf4j-simple
- slf4j-nop
- slf4j-jdk14
- slf4j-log4j12
- slf4j-jcl
- slf4j-android
- slf4j-ext
- jcl-over-slf4j
- log4j-over-slf4j
- jul-to-slf4j
- osgi-over-slf4j
- integration
- slf4j-site
- slf4j-migrator
-
-
-
-
- junit
- junit
- ${junit.version}
- test
-
-
-
-
-
-
-
- org.slf4j
- slf4j-api
- ${project.version}
-
-
-
- org.slf4j
- slf4j-jdk14
- ${project.version}
-
-
-
- log4j
- log4j
- ${log4j.version}
-
-
-
- ch.qos.cal10n
- cal10n-api
- ${cal10n.version}
-
-
-
-
-
-
-
-
- org.apache.maven.wagon
- wagon-ssh
- 2.0
-
-
-
-
-
- ${project.basedir}/src/main/resources
- true
-
-
-
-
-
-
- org.codehaus.mojo
- animal-sniffer-maven-plugin
- 1.14
-
-
- org.codehaus.mojo.signature
- java15
- 1.0
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.3
-
-
- ${required.jdk.version}
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 2.3.1
-
-
-
- ${parsedVersion.osgiVersion}
- ${project.description}
- ${maven.compiler.source}
- ${maven.compiler.target}
- ${project.version}
-
- ${project.build.outputDirectory}/META-INF/MANIFEST.MF
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.19.1
-
- 2C
- true
- plain
- false
-
- **/AllTest.java
- **/PackageTest.java
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.2
-
-
- package
-
- jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 2.2
-
-
- src/main/assembly/source.xml
-
- slf4j-${project.version}
- false
- target/site/dist/
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
- 1.7
-
-
- parse-version
-
- parse-version
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-site-plugin
- ${maven-site-plugin.version}
-
-
-
-
- org.apache.maven.plugins
- maven-jxr-plugin
- 2.3
-
- true
- target/site/apidocs/
- true
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- ${javadoc.plugin.version}
-
- true
-
- org.slf4j.migrator:org.slf4j.migrator.*
-
-
- http://java.sun.com/j2se/1.5.0/docs/api
-
-
-
-
- SLF4J packages
- org.slf4j:org.slf4j.*
-
-
-
- SLF4J extensions
-
- org.slf4j.cal10n:org.slf4j.profiler:org.slf4j.ext:org.slf4j.instrumentation:org.slf4j.agent
-
-
-
-
- Jakarta Commons Logging packages
- org.apache.commons.*
-
-
-
- java.util.logging (JUL) to SLF4J bridge
- org.slf4j.bridge
-
-
-
- Apache log4j
- org.apache.log4j:org.apache.log4j.*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- skipTests
-
- true
-
-
-
-
- javadocjar
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- ${javadoc.plugin.version}
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
-
-
-
-
- license
-
-
-
- com.google.code.maven-license-plugin
- maven-license-plugin
-
- src/main/licenseHeader.txt
- false
- true
- true
-
- src/**/*.java
-
- true
- true
-
- 1999
-
-
- src/main/javadocHeaders.xml
-
-
-
-
-
-
-
-
- mc-release
- Local Maven repository of releases
- http://mc-repo.googlecode.com/svn/maven2/releases
-
- false
-
-
- true
-
-
-
-
-
-
- sign-artifacts
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.1
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- qos_ch
- scp://te.qos.ch/var/www/www.slf4j.org/htdocs/
-
-
-
-
-
- sonatype-nexus-staging
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
-
-
-
-
-
+
+
+
+ 4.0.0
+
+ org.slf4j
+ slf4j-parent
+ 1.7.26
+
+ pom
+ SLF4J
+ Top SLF4J project pom.xml file
+ http://www.slf4j.org
+
+
+ QOS.ch
+ http://www.qos.ch
+
+ 2005
+
+
+
+ MIT License
+ http://www.opensource.org/licenses/mit-license.php
+ repo
+
+
+
+
+ https://github.com/qos-ch/slf4j
+ git@github.com:qos-ch/slf4j.git
+
+
+
+ 1.5
+ ${required.jdk.version}
+ ${required.jdk.version}
+ UTF-8
+ UTF-8
+ UTF-8
+
+ 1.6.0
+ 0.8.1
+ 1.2.17
+ 1.0.13
+ 4.12
+ 3.3
+ 3.0.1
+ 2.10.4
+
+
+
+
+ ceki
+ Ceki Gulcu
+ ceki@qos.ch
+
+
+
+
+ slf4j-api
+ slf4j-simple
+ slf4j-nop
+ slf4j-jdk14
+ slf4j-log4j12
+ slf4j-jcl
+ slf4j-android
+ slf4j-ext
+ jcl-over-slf4j
+ log4j-over-slf4j
+ jul-to-slf4j
+ osgi-over-slf4j
+ integration
+ slf4j-site
+ slf4j-migrator
+
+
+
+
+ junit
+ junit
+ ${junit.version}
+ test
+
+
+
+
+
+
+
+ org.slf4j
+ slf4j-api
+ ${project.version}
+
+
+
+ org.slf4j
+ slf4j-jdk14
+ ${project.version}
+
+
+
+ log4j
+ log4j
+ ${log4j.version}
+
+
+
+ ch.qos.cal10n
+ cal10n-api
+ ${cal10n.version}
+
+
+
+
+
+
+
+
+ org.apache.maven.wagon
+ wagon-ssh
+ 2.0
+
+
+
+
+
+ ${project.basedir}/src/main/resources
+ true
+
+
+
+
+
+
+ org.codehaus.mojo
+ animal-sniffer-maven-plugin
+ 1.14
+
+
+ org.codehaus.mojo.signature
+ java15
+ 1.0
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.3
+
+
+ ${required.jdk.version}
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.3.1
+
+
+
+ ${parsedVersion.osgiVersion}
+ ${project.description}
+ ${maven.compiler.source}
+ ${maven.compiler.target}
+ ${project.version}
+
+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF
+
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ ${maven-source-plugin.version}
+
+
+ package
+
+ jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.19.1
+
+ 2C
+ true
+ plain
+ false
+
+ **/AllTest.java
+ **/PackageTest.java
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.2
+
+
+ src/main/assembly/source.xml
+
+ slf4j-${project.version}
+ false
+ target/site/dist/
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 1.7
+
+
+ parse-version
+
+ parse-version
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+ ${maven-site-plugin.version}
+
+
+
+
+ org.apache.maven.plugins
+ maven-jxr-plugin
+ 2.3
+
+ true
+ target/site/apidocs/
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${javadoc.plugin.version}
+
+ true
+ none
+
+
+ org.slf4j.migrator:org.slf4j.migrator.*
+
+
+ http://java.sun.com/j2se/1.5.0/docs/api
+
+
+
+
+ SLF4J packages
+ org.slf4j:org.slf4j.*
+
+
+
+ SLF4J extensions
+
+ org.slf4j.cal10n:org.slf4j.profiler:org.slf4j.ext:org.slf4j.instrumentation:org.slf4j.agent
+
+
+
+
+ Jakarta Commons Logging packages
+ org.apache.commons.*
+
+
+
+ java.util.logging (JUL) to SLF4J bridge
+ org.slf4j.bridge
+
+
+
+ Apache log4j
+ org.apache.log4j:org.apache.log4j.*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ skipTests
+
+ true
+
+
+
+
+ javadocjar
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${javadoc.plugin.version}
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+
+
+
+
+ license
+
+
+
+ com.google.code.maven-license-plugin
+ maven-license-plugin
+
+ src/main/licenseHeader.txt
+ false
+ true
+ true
+
+ src/**/*.java
+
+ true
+ true
+
+ 1999
+
+
+ src/main/javadocHeaders.xml
+
+
+
+
+
+
+
+
+ mc-release
+ Local Maven repository of releases
+ http://mc-repo.googlecode.com/svn/maven2/releases
+
+ false
+
+
+ true
+
+
+
+
+
+
+ sign-artifacts
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 1.1
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ qos_ch
+ scp://te.qos.ch/var/www/www.slf4j.org/htdocs/
+
+
+
+
+
+ sonatype-nexus-staging
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+
+
+
diff --git a/release.sh b/release.sh
new file mode 100755
index 0000000..4934ebd
--- /dev/null
+++ b/release.sh
@@ -0,0 +1,49 @@
+#mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${VERSION_NUMBER}
+
+MVN='/java/maven-3.5.2//bin/mvn'
+
+PASS=$1
+echo $PASS
+
+function checkExit(){
+ if test "$?" != "0"; then
+ echo Command $1 exited with abnormal status
+ exit 1;
+ else echo $?
+ fi
+}
+
+function echoThenRun () { # echo and then run the command
+ echo $1
+ $1
+ ret=$?
+ echo $ret
+ return $ret
+}
+
+$MVN clean
+checkExit "mvn clean"
+
+
+$MVN install
+checkExit "mvn install"
+
+
+$MVN site:site
+checkExit "mvn site:ste"
+
+
+$MVN assembly:single
+checkExit "mvn assembly:single"
+
+
+$MVN deploy -P javadocjar,sign-artifacts -Dgpg.passphrase=$PASS
+checkExit "mvn deploy -P javadocjar,sign-artifacts -Dgpg.passphrase=xxx"
+
+#$MVN site:deploy -N # with Java 8!!!
+#checkExit "mvn site:deploy -N"
+
+#git tag -m "tagging" -a v_${VERSION_NUMBER}
+#git push --tags
+
+#release version and add next version on jira
diff --git a/slf4j-android/.gitignore b/slf4j-android/.gitignore
new file mode 100755
index 0000000..7792e06
--- /dev/null
+++ b/slf4j-android/.gitignore
@@ -0,0 +1,2 @@
+bin/
+gen/
diff --git a/slf4j-android/AndroidManifest.xml b/slf4j-android/AndroidManifest.xml
new file mode 100755
index 0000000..a2b9e40
--- /dev/null
+++ b/slf4j-android/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/slf4j-android/LICENSE.txt b/slf4j-android/LICENSE.txt
new file mode 100644
index 0000000..361d2ce
--- /dev/null
+++ b/slf4j-android/LICENSE.txt
@@ -0,0 +1,24 @@
+Copyright (c) 2004-2013 QOS.ch
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
diff --git a/slf4j-android/pom.xml b/slf4j-android/pom.xml
index a0bd3cb..bd3d651 100644
--- a/slf4j-android/pom.xml
+++ b/slf4j-android/pom.xml
@@ -1,34 +1,34 @@
-
-
-
- 4.0.0
-
-
- org.slf4j
- slf4j-parent
- 1.7.25
-
-
- slf4j-android
- jar
- SLF4J Android Binding
- SLF4J Android Binding
- http://www.slf4j.org
-
-
-
- org.slf4j
- slf4j-api
- ${project.version}
-
-
-
- com.google.android
- android
- 1.5_r4
- provided
-
-
-
+
+
+
+ 4.0.0
+
+
+ org.slf4j
+ slf4j-parent
+ 1.7.26
+
+
+ slf4j-android
+ jar
+ SLF4J Android Binding
+ SLF4J Android Binding
+ http://www.slf4j.org
+
+
+
+ org.slf4j
+ slf4j-api
+ ${project.version}
+
+
+
+ com.google.android
+ android
+ 1.5_r4
+ provided
+
+
+
diff --git a/slf4j-android/project.properties b/slf4j-android/project.properties
new file mode 100755
index 0000000..0d4e760
--- /dev/null
+++ b/slf4j-android/project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+android.library=true
+# Indicates whether an apk should be generated for each density.
+split.density=false
+# Project target.
+target=android-3
diff --git a/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerAdapter.java b/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerAdapter.java
old file mode 100644
new file mode 100755
index 8221324..ed47f1f 100755
--- a/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerAdapter.java
+++ b/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerAdapter.java
@@ -1,552 +1,552 @@
-/*
- * Copyright (c) 2004-2013 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.impl;
-
-import android.util.Log;
-import org.slf4j.helpers.FormattingTuple;
-import org.slf4j.helpers.MarkerIgnoringBase;
-import org.slf4j.helpers.MessageFormatter;
-
-/**
- *
A simple implementation that delegates all log requests to the Google Android
- * logging facilities. Note that this logger does not support {@link org.slf4j.Marker}.
- * Methods taking marker data as parameter simply invoke the eponymous method
- * without the Marker argument, discarding any marker data in the process.
- *
- *
The logging levels specified for SLF4J can be almost directly mapped to
- * the levels that exist in the Google Android platform. The following table
- * shows the mapping implemented by this logger.
- *
- *
- *
SLF4J
Android
- *
TRACE
{@link android.util.Log#VERBOSE}
- *
DEBUG
{@link android.util.Log#DEBUG}
- *
INFO
{@link android.util.Log#INFO}
- *
WARN
{@link android.util.Log#WARN}
- *
ERROR
{@link android.util.Log#ERROR}
- *
- *
- *
Use loggers as usual:
- *
- *
- * Declare a logger
- * private static final Logger logger = LoggerFactory.getLogger(MyClass.class);
- *
Logger instances created using the LoggerFactory are named either according to the name
- * or the fully qualified class name of the class given as a parameter.
- * Each logger name will be used as the log message tag on the Android platform.
- * However, tag names cannot be longer than 23 characters so if logger name exceeds this limit then
- * it will be truncated by the LoggerFactory. The following examples illustrate this.
- *
- *
- * @author Andrey Korzhevskiy
- */
-class AndroidLoggerAdapter extends MarkerIgnoringBase {
- private static final long serialVersionUID = -1227274521521287937L;
-
- /**
- * Package access allows only {@link AndroidLoggerFactory} to instantiate
- * SimpleLogger instances.
- */
- AndroidLoggerAdapter(String tag) {
- this.name = tag;
- }
-
- /**
- * Is this logger instance enabled for the VERBOSE level?
- *
- * @return True if this Logger is enabled for level VERBOSE, false otherwise.
- */
- public boolean isTraceEnabled() {
- return isLoggable(Log.VERBOSE);
- }
-
- /**
- * Log a message object at level VERBOSE.
- *
- * @param msg
- * - the message object to be logged
- */
- public void trace(String msg) {
- log(Log.VERBOSE, msg, null);
- }
-
- /**
- * Log a message at level VERBOSE according to the specified format and
- * argument.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for level VERBOSE.
- *
- *
- * @param format
- * the format string
- * @param arg
- * the argument
- */
- public void trace(String format, Object arg) {
- formatAndLog(Log.VERBOSE, format, arg);
- }
-
- /**
- * Log a message at level VERBOSE according to the specified format and
- * arguments.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the VERBOSE level.
- *
- *
- * @param format
- * the format string
- * @param arg1
- * the first argument
- * @param arg2
- * the second argument
- */
- public void trace(String format, Object arg1, Object arg2) {
- formatAndLog(Log.VERBOSE, format, arg1, arg2);
- }
-
- /**
- * Log a message at level VERBOSE according to the specified format and
- * arguments.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the VERBOSE level.
- *
- *
- * @param format
- * the format string
- * @param argArray
- * an array of arguments
- */
- public void trace(String format, Object... argArray) {
- formatAndLog(Log.VERBOSE, format, argArray);
- }
-
- /**
- * Log an exception (throwable) at level VERBOSE with an accompanying message.
- *
- * @param msg
- * the message accompanying the exception
- * @param t
- * the exception (throwable) to log
- */
- public void trace(String msg, Throwable t) {
- log(Log.VERBOSE, msg, t);
- }
-
- /**
- * Is this logger instance enabled for the DEBUG level?
- *
- * @return True if this Logger is enabled for level DEBUG, false otherwise.
- */
- public boolean isDebugEnabled() {
- return isLoggable(Log.DEBUG);
- }
-
- /**
- * Log a message object at level DEBUG.
- *
- * @param msg
- * - the message object to be logged
- */
- public void debug(String msg) {
- log(Log.DEBUG, msg, null);
- }
-
- /**
- * Log a message at level DEBUG according to the specified format and argument.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for level DEBUG.
- *
- *
- * @param format
- * the format string
- * @param arg
- * the argument
- */
- public void debug(String format, Object arg) {
- formatAndLog(Log.DEBUG, format, arg);
- }
-
- /**
- * Log a message at level DEBUG according to the specified format and
- * arguments.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the DEBUG level.
- *
- *
- * @param format
- * the format string
- * @param arg1
- * the first argument
- * @param arg2
- * the second argument
- */
- public void debug(String format, Object arg1, Object arg2) {
- formatAndLog(Log.DEBUG, format, arg1, arg2);
- }
-
- /**
- * Log a message at level DEBUG according to the specified format and
- * arguments.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the DEBUG level.
- *
- *
- * @param format
- * the format string
- * @param argArray
- * an array of arguments
- */
- public void debug(String format, Object... argArray) {
- formatAndLog(Log.DEBUG, format, argArray);
- }
-
- /**
- * Log an exception (throwable) at level DEBUG with an accompanying message.
- *
- * @param msg
- * the message accompanying the exception
- * @param t
- * the exception (throwable) to log
- */
- public void debug(String msg, Throwable t) {
- log(Log.VERBOSE, msg, t);
- }
-
- /**
- * Is this logger instance enabled for the INFO level?
- *
- * @return True if this Logger is enabled for the INFO level, false otherwise.
- */
- public boolean isInfoEnabled() {
- return isLoggable(Log.INFO);
- }
-
- /**
- * Log a message object at the INFO level.
- *
- * @param msg
- * - the message object to be logged
- */
- public void info(String msg) {
- log(Log.INFO, msg, null);
- }
-
- /**
- * Log a message at level INFO according to the specified format and argument.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the INFO level.
- *
- *
- * @param format
- * the format string
- * @param arg
- * the argument
- */
- public void info(String format, Object arg) {
- formatAndLog(Log.INFO, format, arg);
- }
-
- /**
- * Log a message at the INFO level according to the specified format and
- * arguments.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the INFO level.
- *
- *
- * @param format
- * the format string
- * @param arg1
- * the first argument
- * @param arg2
- * the second argument
- */
- public void info(String format, Object arg1, Object arg2) {
- formatAndLog(Log.INFO, format, arg1, arg2);
- }
-
- /**
- * Log a message at level INFO according to the specified format and
- * arguments.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the INFO level.
- *
- *
- * @param format
- * the format string
- * @param argArray
- * an array of arguments
- */
- public void info(String format, Object... argArray) {
- formatAndLog(Log.INFO, format, argArray);
- }
-
- /**
- * Log an exception (throwable) at the INFO level with an accompanying
- * message.
- *
- * @param msg
- * the message accompanying the exception
- * @param t
- * the exception (throwable) to log
- */
- public void info(String msg, Throwable t) {
- log(Log.INFO, msg, t);
- }
-
- /**
- * Is this logger instance enabled for the WARN level?
- *
- * @return True if this Logger is enabled for the WARN level, false
- * otherwise.
- */
- public boolean isWarnEnabled() {
- return isLoggable(Log.WARN);
- }
-
- /**
- * Log a message object at the WARN level.
- *
- * @param msg
- * - the message object to be logged
- */
- public void warn(String msg) {
- log(Log.WARN, msg, null);
- }
-
- /**
- * Log a message at the WARN level according to the specified format and
- * argument.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the WARN level.
- *
- *
- * @param format
- * the format string
- * @param arg
- * the argument
- */
- public void warn(String format, Object arg) {
- formatAndLog(Log.WARN, format, arg);
- }
-
- /**
- * Log a message at the WARN level according to the specified format and
- * arguments.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the WARN level.
- *
- *
- * @param format
- * the format string
- * @param arg1
- * the first argument
- * @param arg2
- * the second argument
- */
- public void warn(String format, Object arg1, Object arg2) {
- formatAndLog(Log.WARN, format, arg1, arg2);
- }
-
- /**
- * Log a message at level WARN according to the specified format and
- * arguments.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the WARN level.
- *
- *
- * @param format
- * the format string
- * @param argArray
- * an array of arguments
- */
- public void warn(String format, Object... argArray) {
- formatAndLog(Log.WARN, format, argArray);
- }
-
- /**
- * Log an exception (throwable) at the WARN level with an accompanying
- * message.
- *
- * @param msg
- * the message accompanying the exception
- * @param t
- * the exception (throwable) to log
- */
- public void warn(String msg, Throwable t) {
- log(Log.WARN, msg, t);
- }
-
- /**
- * Is this logger instance enabled for level ERROR?
- *
- * @return True if this Logger is enabled for level ERROR, false otherwise.
- */
- public boolean isErrorEnabled() {
- return isLoggable(Log.ERROR);
- }
-
- /**
- * Log a message object at the ERROR level.
- *
- * @param msg
- * - the message object to be logged
- */
- public void error(String msg) {
- log(Log.ERROR, msg, null);
- }
-
- /**
- * Log a message at the ERROR level according to the specified format and
- * argument.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the ERROR level.
- *
- *
- * @param format
- * the format string
- * @param arg
- * the argument
- */
- public void error(String format, Object arg) {
- formatAndLog(Log.ERROR, format, arg);
- }
-
- /**
- * Log a message at the ERROR level according to the specified format and
- * arguments.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the ERROR level.
- *
- *
- * @param format
- * the format string
- * @param arg1
- * the first argument
- * @param arg2
- * the second argument
- */
- public void error(String format, Object arg1, Object arg2) {
- formatAndLog(Log.ERROR, format, arg1, arg2);
- }
-
- /**
- * Log a message at level ERROR according to the specified format and
- * arguments.
- *
- *
- * This form avoids superfluous object creation when the logger is disabled
- * for the ERROR level.
- *
- *
- * @param format
- * the format string
- * @param argArray
- * an array of arguments
- */
- public void error(String format, Object... argArray) {
- formatAndLog(Log.ERROR, format, argArray);
- }
-
- /**
- * Log an exception (throwable) at the ERROR level with an accompanying
- * message.
- *
- * @param msg
- * the message accompanying the exception
- * @param t
- * the exception (throwable) to log
- */
- public void error(String msg, Throwable t) {
- log(Log.ERROR, msg, t);
- }
-
- private void formatAndLog(int priority, String format, Object... argArray) {
- if (isLoggable(priority)) {
- FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
- logInternal(priority, ft.getMessage(), ft.getThrowable());
- }
- }
-
- private void log(int priority, String message, Throwable throwable) {
- if (isLoggable(priority)) {
- logInternal(priority, message, throwable);
- }
- }
-
- private boolean isLoggable(int priority) {
- return Log.isLoggable(name, priority);
- }
-
- private void logInternal(int priority, String message, Throwable throwable) {
- if (throwable != null) {
- message += '\n' + Log.getStackTraceString(throwable);
- }
- Log.println(priority, name, message);
- }
+/*
+ * Copyright (c) 2004-2013 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.impl;
+
+import android.util.Log;
+import org.slf4j.helpers.FormattingTuple;
+import org.slf4j.helpers.MarkerIgnoringBase;
+import org.slf4j.helpers.MessageFormatter;
+
+/**
+ *
A simple implementation that delegates all log requests to the Google Android
+ * logging facilities. Note that this logger does not support {@link org.slf4j.Marker}.
+ * Methods taking marker data as parameter simply invoke the eponymous method
+ * without the Marker argument, discarding any marker data in the process.
+ *
+ *
The logging levels specified for SLF4J can be almost directly mapped to
+ * the levels that exist in the Google Android platform. The following table
+ * shows the mapping implemented by this logger.
+ *
+ *
+ *
SLF4J
Android
+ *
TRACE
{@link android.util.Log#VERBOSE}
+ *
DEBUG
{@link android.util.Log#DEBUG}
+ *
INFO
{@link android.util.Log#INFO}
+ *
WARN
{@link android.util.Log#WARN}
+ *
ERROR
{@link android.util.Log#ERROR}
+ *
+ *
+ *
Use loggers as usual:
+ *
+ *
+ * Declare a logger
+ * private static final Logger logger = LoggerFactory.getLogger(MyClass.class);
+ *
Logger instances created using the LoggerFactory are named either according to the name
+ * or the fully qualified class name of the class given as a parameter.
+ * Each logger name will be used as the log message tag on the Android platform.
+ * However, tag names cannot be longer than 23 characters so if logger name exceeds this limit then
+ * it will be truncated by the LoggerFactory. The following examples illustrate this.
+ *
+ *
+ * @author Andrey Korzhevskiy
+ */
+class AndroidLoggerAdapter extends MarkerIgnoringBase {
+ private static final long serialVersionUID = -1227274521521287937L;
+
+ /**
+ * Package access allows only {@link AndroidLoggerFactory} to instantiate
+ * SimpleLogger instances.
+ */
+ AndroidLoggerAdapter(String tag) {
+ this.name = tag;
+ }
+
+ /**
+ * Is this logger instance enabled for the VERBOSE level?
+ *
+ * @return True if this Logger is enabled for level VERBOSE, false otherwise.
+ */
+ public boolean isTraceEnabled() {
+ return isLoggable(Log.VERBOSE);
+ }
+
+ /**
+ * Log a message object at level VERBOSE.
+ *
+ * @param msg
+ * - the message object to be logged
+ */
+ public void trace(String msg) {
+ log(Log.VERBOSE, msg, null);
+ }
+
+ /**
+ * Log a message at level VERBOSE according to the specified format and
+ * argument.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for level VERBOSE.
+ *
+ *
+ * @param format
+ * the format string
+ * @param arg
+ * the argument
+ */
+ public void trace(String format, Object arg) {
+ formatAndLog(Log.VERBOSE, format, arg);
+ }
+
+ /**
+ * Log a message at level VERBOSE according to the specified format and
+ * arguments.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the VERBOSE level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param arg1
+ * the first argument
+ * @param arg2
+ * the second argument
+ */
+ public void trace(String format, Object arg1, Object arg2) {
+ formatAndLog(Log.VERBOSE, format, arg1, arg2);
+ }
+
+ /**
+ * Log a message at level VERBOSE according to the specified format and
+ * arguments.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the VERBOSE level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param argArray
+ * an array of arguments
+ */
+ public void trace(String format, Object... argArray) {
+ formatAndLog(Log.VERBOSE, format, argArray);
+ }
+
+ /**
+ * Log an exception (throwable) at level VERBOSE with an accompanying message.
+ *
+ * @param msg
+ * the message accompanying the exception
+ * @param t
+ * the exception (throwable) to log
+ */
+ public void trace(String msg, Throwable t) {
+ log(Log.VERBOSE, msg, t);
+ }
+
+ /**
+ * Is this logger instance enabled for the DEBUG level?
+ *
+ * @return True if this Logger is enabled for level DEBUG, false otherwise.
+ */
+ public boolean isDebugEnabled() {
+ return isLoggable(Log.DEBUG);
+ }
+
+ /**
+ * Log a message object at level DEBUG.
+ *
+ * @param msg
+ * - the message object to be logged
+ */
+ public void debug(String msg) {
+ log(Log.DEBUG, msg, null);
+ }
+
+ /**
+ * Log a message at level DEBUG according to the specified format and argument.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for level DEBUG.
+ *
+ *
+ * @param format
+ * the format string
+ * @param arg
+ * the argument
+ */
+ public void debug(String format, Object arg) {
+ formatAndLog(Log.DEBUG, format, arg);
+ }
+
+ /**
+ * Log a message at level DEBUG according to the specified format and
+ * arguments.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the DEBUG level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param arg1
+ * the first argument
+ * @param arg2
+ * the second argument
+ */
+ public void debug(String format, Object arg1, Object arg2) {
+ formatAndLog(Log.DEBUG, format, arg1, arg2);
+ }
+
+ /**
+ * Log a message at level DEBUG according to the specified format and
+ * arguments.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the DEBUG level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param argArray
+ * an array of arguments
+ */
+ public void debug(String format, Object... argArray) {
+ formatAndLog(Log.DEBUG, format, argArray);
+ }
+
+ /**
+ * Log an exception (throwable) at level DEBUG with an accompanying message.
+ *
+ * @param msg
+ * the message accompanying the exception
+ * @param t
+ * the exception (throwable) to log
+ */
+ public void debug(String msg, Throwable t) {
+ log(Log.VERBOSE, msg, t);
+ }
+
+ /**
+ * Is this logger instance enabled for the INFO level?
+ *
+ * @return True if this Logger is enabled for the INFO level, false otherwise.
+ */
+ public boolean isInfoEnabled() {
+ return isLoggable(Log.INFO);
+ }
+
+ /**
+ * Log a message object at the INFO level.
+ *
+ * @param msg
+ * - the message object to be logged
+ */
+ public void info(String msg) {
+ log(Log.INFO, msg, null);
+ }
+
+ /**
+ * Log a message at level INFO according to the specified format and argument.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the INFO level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param arg
+ * the argument
+ */
+ public void info(String format, Object arg) {
+ formatAndLog(Log.INFO, format, arg);
+ }
+
+ /**
+ * Log a message at the INFO level according to the specified format and
+ * arguments.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the INFO level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param arg1
+ * the first argument
+ * @param arg2
+ * the second argument
+ */
+ public void info(String format, Object arg1, Object arg2) {
+ formatAndLog(Log.INFO, format, arg1, arg2);
+ }
+
+ /**
+ * Log a message at level INFO according to the specified format and
+ * arguments.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the INFO level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param argArray
+ * an array of arguments
+ */
+ public void info(String format, Object... argArray) {
+ formatAndLog(Log.INFO, format, argArray);
+ }
+
+ /**
+ * Log an exception (throwable) at the INFO level with an accompanying
+ * message.
+ *
+ * @param msg
+ * the message accompanying the exception
+ * @param t
+ * the exception (throwable) to log
+ */
+ public void info(String msg, Throwable t) {
+ log(Log.INFO, msg, t);
+ }
+
+ /**
+ * Is this logger instance enabled for the WARN level?
+ *
+ * @return True if this Logger is enabled for the WARN level, false
+ * otherwise.
+ */
+ public boolean isWarnEnabled() {
+ return isLoggable(Log.WARN);
+ }
+
+ /**
+ * Log a message object at the WARN level.
+ *
+ * @param msg
+ * - the message object to be logged
+ */
+ public void warn(String msg) {
+ log(Log.WARN, msg, null);
+ }
+
+ /**
+ * Log a message at the WARN level according to the specified format and
+ * argument.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the WARN level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param arg
+ * the argument
+ */
+ public void warn(String format, Object arg) {
+ formatAndLog(Log.WARN, format, arg);
+ }
+
+ /**
+ * Log a message at the WARN level according to the specified format and
+ * arguments.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the WARN level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param arg1
+ * the first argument
+ * @param arg2
+ * the second argument
+ */
+ public void warn(String format, Object arg1, Object arg2) {
+ formatAndLog(Log.WARN, format, arg1, arg2);
+ }
+
+ /**
+ * Log a message at level WARN according to the specified format and
+ * arguments.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the WARN level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param argArray
+ * an array of arguments
+ */
+ public void warn(String format, Object... argArray) {
+ formatAndLog(Log.WARN, format, argArray);
+ }
+
+ /**
+ * Log an exception (throwable) at the WARN level with an accompanying
+ * message.
+ *
+ * @param msg
+ * the message accompanying the exception
+ * @param t
+ * the exception (throwable) to log
+ */
+ public void warn(String msg, Throwable t) {
+ log(Log.WARN, msg, t);
+ }
+
+ /**
+ * Is this logger instance enabled for level ERROR?
+ *
+ * @return True if this Logger is enabled for level ERROR, false otherwise.
+ */
+ public boolean isErrorEnabled() {
+ return isLoggable(Log.ERROR);
+ }
+
+ /**
+ * Log a message object at the ERROR level.
+ *
+ * @param msg
+ * - the message object to be logged
+ */
+ public void error(String msg) {
+ log(Log.ERROR, msg, null);
+ }
+
+ /**
+ * Log a message at the ERROR level according to the specified format and
+ * argument.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the ERROR level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param arg
+ * the argument
+ */
+ public void error(String format, Object arg) {
+ formatAndLog(Log.ERROR, format, arg);
+ }
+
+ /**
+ * Log a message at the ERROR level according to the specified format and
+ * arguments.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the ERROR level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param arg1
+ * the first argument
+ * @param arg2
+ * the second argument
+ */
+ public void error(String format, Object arg1, Object arg2) {
+ formatAndLog(Log.ERROR, format, arg1, arg2);
+ }
+
+ /**
+ * Log a message at level ERROR according to the specified format and
+ * arguments.
+ *
+ *
+ * This form avoids superfluous object creation when the logger is disabled
+ * for the ERROR level.
+ *
+ *
+ * @param format
+ * the format string
+ * @param argArray
+ * an array of arguments
+ */
+ public void error(String format, Object... argArray) {
+ formatAndLog(Log.ERROR, format, argArray);
+ }
+
+ /**
+ * Log an exception (throwable) at the ERROR level with an accompanying
+ * message.
+ *
+ * @param msg
+ * the message accompanying the exception
+ * @param t
+ * the exception (throwable) to log
+ */
+ public void error(String msg, Throwable t) {
+ log(Log.ERROR, msg, t);
+ }
+
+ private void formatAndLog(int priority, String format, Object... argArray) {
+ if (isLoggable(priority)) {
+ FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
+ logInternal(priority, ft.getMessage(), ft.getThrowable());
+ }
+ }
+
+ private void log(int priority, String message, Throwable throwable) {
+ if (isLoggable(priority)) {
+ logInternal(priority, message, throwable);
+ }
+ }
+
+ private boolean isLoggable(int priority) {
+ return Log.isLoggable(name, priority);
+ }
+
+ private void logInternal(int priority, String message, Throwable throwable) {
+ if (throwable != null) {
+ message += '\n' + Log.getStackTraceString(throwable);
+ }
+ Log.println(priority, name, message);
+ }
}diff --git a/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerFactory.java b/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerFactory.java
old file mode 100644
new file mode 100755
index 3033378..d4ae5ef 100755
--- a/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerFactory.java
+++ b/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerFactory.java
@@ -1,123 +1,123 @@
-/*
- * Copyright (c) 2004-2013 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.impl;
-
-import org.slf4j.ILoggerFactory;
-import org.slf4j.Logger;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * AndroidLoggerFactory is an implementation of {@link ILoggerFactory} returning
- * the appropriately named {@link AndroidLoggerFactory} instance.
- *
- * @author Andrey Korzhevskiy
- */
-class AndroidLoggerFactory implements ILoggerFactory {
- static final String ANONYMOUS_TAG = "null";
- static final int TAG_MAX_LENGTH = 23;
-
- private final ConcurrentMap loggerMap = new ConcurrentHashMap();
-
- /**
- * Return an appropriate {@link AndroidLoggerAdapter} instance by name.
- */
- public Logger getLogger(String name) {
- String tag = loggerNameToTag(name);
- Logger logger = loggerMap.get(tag);
- if (logger == null) {
- Logger newInstance = new AndroidLoggerAdapter(tag);
- Logger oldInstance = loggerMap.putIfAbsent(tag, newInstance);
- logger = oldInstance == null ? newInstance : oldInstance;
- }
- return logger;
- }
-
- /**
- * Tag names cannot be longer than {@value #TAG_MAX_LENGTH} characters on Android platform.
- *
- * Returns the short logger tag (up to {@value #TAG_MAX_LENGTH} characters) for the given logger name.
- * Traditionally loggers are named by fully-qualified Java classes; this
- * method attempts to return a concise identifying part of such names.
- *
- * See also:
- * android/system/core/include/cutils/property.h
- * android/frameworks/base/core/jni/android_util_Log.cpp
- * dalvik.system.DalvikLogging
- *
- */
- static String loggerNameToTag(String loggerName) {
- // Anonymous logger
- if (loggerName == null) {
- return ANONYMOUS_TAG;
- }
-
- int length = loggerName.length();
- if (length <= TAG_MAX_LENGTH) {
- return loggerName;
- }
-
- int tagLength = 0;
- int lastTokenIndex = 0;
- int lastPeriodIndex;
- StringBuilder tagName = new StringBuilder(TAG_MAX_LENGTH + 3);
- while ((lastPeriodIndex = loggerName.indexOf('.', lastTokenIndex)) != -1) {
- tagName.append(loggerName.charAt(lastTokenIndex));
- // token of one character appended as is otherwise truncate it to one character
- int tokenLength = lastPeriodIndex - lastTokenIndex;
- if (tokenLength > 1) {
- tagName.append('*');
- }
- tagName.append('.');
- lastTokenIndex = lastPeriodIndex + 1;
-
- // check if name is already too long
- tagLength = tagName.length();
- if (tagLength > TAG_MAX_LENGTH) {
- return getSimpleName(loggerName);
- }
- }
-
- // Either we had no useful dot location at all
- // or last token would exceed TAG_MAX_LENGTH
- int tokenLength = length - lastTokenIndex;
- if (tagLength == 0 || (tagLength + tokenLength) > TAG_MAX_LENGTH) {
- return getSimpleName(loggerName);
- }
-
- // last token (usually class name) appended as is
- tagName.append(loggerName, lastTokenIndex, length);
- return tagName.toString();
- }
-
- private static String getSimpleName(String loggerName) {
- // Take leading part and append '*' to indicate that it was truncated
- int length = loggerName.length();
- int lastPeriodIndex = loggerName.lastIndexOf('.');
- return lastPeriodIndex != -1 && length - (lastPeriodIndex + 1) <= TAG_MAX_LENGTH ? loggerName.substring(lastPeriodIndex + 1) : '*' + loggerName
- .substring(length - TAG_MAX_LENGTH + 1);
- }
+/*
+ * Copyright (c) 2004-2013 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.impl;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.Logger;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * AndroidLoggerFactory is an implementation of {@link ILoggerFactory} returning
+ * the appropriately named {@link AndroidLoggerFactory} instance.
+ *
+ * @author Andrey Korzhevskiy
+ */
+class AndroidLoggerFactory implements ILoggerFactory {
+ static final String ANONYMOUS_TAG = "null";
+ static final int TAG_MAX_LENGTH = 23;
+
+ private final ConcurrentMap loggerMap = new ConcurrentHashMap();
+
+ /**
+ * Return an appropriate {@link AndroidLoggerAdapter} instance by name.
+ */
+ public Logger getLogger(String name) {
+ String tag = loggerNameToTag(name);
+ Logger logger = loggerMap.get(tag);
+ if (logger == null) {
+ Logger newInstance = new AndroidLoggerAdapter(tag);
+ Logger oldInstance = loggerMap.putIfAbsent(tag, newInstance);
+ logger = oldInstance == null ? newInstance : oldInstance;
+ }
+ return logger;
+ }
+
+ /**
+ * Tag names cannot be longer than {@value #TAG_MAX_LENGTH} characters on Android platform.
+ *
+ * Returns the short logger tag (up to {@value #TAG_MAX_LENGTH} characters) for the given logger name.
+ * Traditionally loggers are named by fully-qualified Java classes; this
+ * method attempts to return a concise identifying part of such names.
+ *
+ * See also:
+ * android/system/core/include/cutils/property.h
+ * android/frameworks/base/core/jni/android_util_Log.cpp
+ * dalvik.system.DalvikLogging
+ *
+ */
+ static String loggerNameToTag(String loggerName) {
+ // Anonymous logger
+ if (loggerName == null) {
+ return ANONYMOUS_TAG;
+ }
+
+ int length = loggerName.length();
+ if (length <= TAG_MAX_LENGTH) {
+ return loggerName;
+ }
+
+ int tagLength = 0;
+ int lastTokenIndex = 0;
+ int lastPeriodIndex;
+ StringBuilder tagName = new StringBuilder(TAG_MAX_LENGTH + 3);
+ while ((lastPeriodIndex = loggerName.indexOf('.', lastTokenIndex)) != -1) {
+ tagName.append(loggerName.charAt(lastTokenIndex));
+ // token of one character appended as is otherwise truncate it to one character
+ int tokenLength = lastPeriodIndex - lastTokenIndex;
+ if (tokenLength > 1) {
+ tagName.append('*');
+ }
+ tagName.append('.');
+ lastTokenIndex = lastPeriodIndex + 1;
+
+ // check if name is already too long
+ tagLength = tagName.length();
+ if (tagLength > TAG_MAX_LENGTH) {
+ return getSimpleName(loggerName);
+ }
+ }
+
+ // Either we had no useful dot location at all
+ // or last token would exceed TAG_MAX_LENGTH
+ int tokenLength = length - lastTokenIndex;
+ if (tagLength == 0 || (tagLength + tokenLength) > TAG_MAX_LENGTH) {
+ return getSimpleName(loggerName);
+ }
+
+ // last token (usually class name) appended as is
+ tagName.append(loggerName, lastTokenIndex, length);
+ return tagName.toString();
+ }
+
+ private static String getSimpleName(String loggerName) {
+ // Take leading part and append '*' to indicate that it was truncated
+ int length = loggerName.length();
+ int lastPeriodIndex = loggerName.lastIndexOf('.');
+ return lastPeriodIndex != -1 && length - (lastPeriodIndex + 1) <= TAG_MAX_LENGTH ? loggerName.substring(lastPeriodIndex + 1) : '*' + loggerName
+ .substring(length - TAG_MAX_LENGTH + 1);
+ }
}diff --git a/slf4j-android/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-android/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index 426ccae..e21eafe 100644
--- a/slf4j-android/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/slf4j-android/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -1,80 +1,80 @@
-/**
- * Copyright (c) 2004-2013 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.impl;
-
-import org.slf4j.ILoggerFactory;
-import org.slf4j.LoggerFactory;
-import org.slf4j.spi.LoggerFactoryBinder;
-
-/**
- * The binding of {@link LoggerFactory} class with an actual instance of
- * {@link ILoggerFactory} is performed using information returned by this class.
- *
- * @author Ceki Gülcü
- * @author Andrey Korzhevskiy
- */
-public class StaticLoggerBinder implements LoggerFactoryBinder {
-
- /**
- * The unique instance of this class.
- */
- private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
-
- /**
- * Return the singleton of this class.
- *
- * @return the StaticLoggerBinder singleton
- */
- public static StaticLoggerBinder getSingleton() {
- return SINGLETON;
- }
-
- /**
- * Declare the version of the SLF4J API this implementation is compiled against.
- * The value of this field is modified with each major release.
- */
- // to avoid constant folding by the compiler, this field must *not* be final
- public static String REQUESTED_API_VERSION = "1.6.99"; // !final
-
- private static final String loggerFactoryClassStr = AndroidLoggerFactory.class.getName();
-
- /**
- * The ILoggerFactory instance returned by the {@link #getLoggerFactory} method
- * should always be the same object
- */
- private final ILoggerFactory loggerFactory;
-
- private StaticLoggerBinder() {
- loggerFactory = new AndroidLoggerFactory();
- }
-
- public ILoggerFactory getLoggerFactory() {
- return loggerFactory;
- }
-
- public String getLoggerFactoryClassStr() {
- return loggerFactoryClassStr;
- }
-}
+/**
+ * Copyright (c) 2004-2013 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.impl;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.LoggerFactory;
+import org.slf4j.spi.LoggerFactoryBinder;
+
+/**
+ * The binding of {@link LoggerFactory} class with an actual instance of
+ * {@link ILoggerFactory} is performed using information returned by this class.
+ *
+ * @author Ceki Gülcü
+ * @author Andrey Korzhevskiy
+ */
+public class StaticLoggerBinder implements LoggerFactoryBinder {
+
+ /**
+ * The unique instance of this class.
+ */
+ private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
+
+ /**
+ * Return the singleton of this class.
+ *
+ * @return the StaticLoggerBinder singleton
+ */
+ public static StaticLoggerBinder getSingleton() {
+ return SINGLETON;
+ }
+
+ /**
+ * Declare the version of the SLF4J API this implementation is compiled against.
+ * The value of this field is modified with each major release.
+ */
+ // to avoid constant folding by the compiler, this field must *not* be final
+ public static String REQUESTED_API_VERSION = "1.6.99"; // !final
+
+ private static final String loggerFactoryClassStr = AndroidLoggerFactory.class.getName();
+
+ /**
+ * The ILoggerFactory instance returned by the {@link #getLoggerFactory} method
+ * should always be the same object
+ */
+ private final ILoggerFactory loggerFactory;
+
+ private StaticLoggerBinder() {
+ loggerFactory = new AndroidLoggerFactory();
+ }
+
+ public ILoggerFactory getLoggerFactory() {
+ return loggerFactory;
+ }
+
+ public String getLoggerFactoryClassStr() {
+ return loggerFactoryClassStr;
+ }
+}
diff --git a/slf4j-android/src/main/java/org/slf4j/impl/StaticMDCBinder.java b/slf4j-android/src/main/java/org/slf4j/impl/StaticMDCBinder.java
index 953e0e2..93f58fb 100644
--- a/slf4j-android/src/main/java/org/slf4j/impl/StaticMDCBinder.java
+++ b/slf4j-android/src/main/java/org/slf4j/impl/StaticMDCBinder.java
@@ -1,67 +1,67 @@
-/**
- * Copyright (c) 2004-2013 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.impl;
-
-import org.slf4j.helpers.NOPMDCAdapter;
-import org.slf4j.spi.MDCAdapter;
-
-/**
- * This implementation is bound to {@link NOPMDCAdapter}.
- *
- * @author Ceki Gülcü
- * @author Andrey Korzhevskiy
- */
-public class StaticMDCBinder {
-
- /**
- * The unique instance of this class.
- */
- public static final StaticMDCBinder SINGLETON = new StaticMDCBinder();
-
- private StaticMDCBinder() {
- }
-
- /**
- * Return the singleton of this class.
- *
- * @return the StaticMDCBinder singleton
- * @since 1.7.14
- */
- public static final StaticMDCBinder getSingleton() {
- return SINGLETON;
- }
-
- /**
- * Currently this method always returns an instance of
- * {@link NOPMDCAdapter}.
- */
- public MDCAdapter getMDCA() {
- return new NOPMDCAdapter();
- }
-
- public String getMDCAdapterClassStr() {
- return NOPMDCAdapter.class.getName();
- }
-}
+/**
+ * Copyright (c) 2004-2013 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.impl;
+
+import org.slf4j.helpers.NOPMDCAdapter;
+import org.slf4j.spi.MDCAdapter;
+
+/**
+ * This implementation is bound to {@link NOPMDCAdapter}.
+ *
+ * @author Ceki Gülcü
+ * @author Andrey Korzhevskiy
+ */
+public class StaticMDCBinder {
+
+ /**
+ * The unique instance of this class.
+ */
+ public static final StaticMDCBinder SINGLETON = new StaticMDCBinder();
+
+ private StaticMDCBinder() {
+ }
+
+ /**
+ * Return the singleton of this class.
+ *
+ * @return the StaticMDCBinder singleton
+ * @since 1.7.14
+ */
+ public static final StaticMDCBinder getSingleton() {
+ return SINGLETON;
+ }
+
+ /**
+ * Currently this method always returns an instance of
+ * {@link NOPMDCAdapter}.
+ */
+ public MDCAdapter getMDCA() {
+ return new NOPMDCAdapter();
+ }
+
+ public String getMDCAdapterClassStr() {
+ return NOPMDCAdapter.class.getName();
+ }
+}
diff --git a/slf4j-android/src/main/java/org/slf4j/impl/StaticMarkerBinder.java b/slf4j-android/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
index 21a4427..2c50662 100644
--- a/slf4j-android/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
+++ b/slf4j-android/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
@@ -1,77 +1,77 @@
-/**
- * Copyright (c) 2004-2013 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.impl;
-
-import org.slf4j.IMarkerFactory;
-import org.slf4j.MarkerFactory;
-import org.slf4j.helpers.BasicMarkerFactory;
-import org.slf4j.spi.MarkerFactoryBinder;
-
-/**
- *
- * The binding of {@link MarkerFactory} class with an actual instance of
- * {@link IMarkerFactory} is performed using information returned by this class.
- *
- * @author Ceki Gülcü
- * @author Andrey Korzhevskiy
- */
-public class StaticMarkerBinder implements MarkerFactoryBinder {
-
- /**
- * The unique instance of this class.
- */
- public static final StaticMarkerBinder SINGLETON = new StaticMarkerBinder();
-
- final IMarkerFactory markerFactory = new BasicMarkerFactory();
-
- private StaticMarkerBinder() {
- }
-
- /**
- * Return the singleton of this class.
- *
- * @return the StaticMarkerBinder singleton
- * @since 1.7.14
- */
- public static StaticMarkerBinder getSingleton() {
- return SINGLETON;
- }
-
- /**
- * Currently this method always returns an instance of
- * {@link BasicMarkerFactory}.
- */
- public IMarkerFactory getMarkerFactory() {
- return markerFactory;
- }
-
- /**
- * Currently, this method returns the class name of
- * {@link BasicMarkerFactory}.
- */
- public String getMarkerFactoryClassStr() {
- return BasicMarkerFactory.class.getName();
- }
-}
+/**
+ * Copyright (c) 2004-2013 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.impl;
+
+import org.slf4j.IMarkerFactory;
+import org.slf4j.MarkerFactory;
+import org.slf4j.helpers.BasicMarkerFactory;
+import org.slf4j.spi.MarkerFactoryBinder;
+
+/**
+ *
+ * The binding of {@link MarkerFactory} class with an actual instance of
+ * {@link IMarkerFactory} is performed using information returned by this class.
+ *
+ * @author Ceki Gülcü
+ * @author Andrey Korzhevskiy
+ */
+public class StaticMarkerBinder implements MarkerFactoryBinder {
+
+ /**
+ * The unique instance of this class.
+ */
+ public static final StaticMarkerBinder SINGLETON = new StaticMarkerBinder();
+
+ final IMarkerFactory markerFactory = new BasicMarkerFactory();
+
+ private StaticMarkerBinder() {
+ }
+
+ /**
+ * Return the singleton of this class.
+ *
+ * @return the StaticMarkerBinder singleton
+ * @since 1.7.14
+ */
+ public static StaticMarkerBinder getSingleton() {
+ return SINGLETON;
+ }
+
+ /**
+ * Currently this method always returns an instance of
+ * {@link BasicMarkerFactory}.
+ */
+ public IMarkerFactory getMarkerFactory() {
+ return markerFactory;
+ }
+
+ /**
+ * Currently, this method returns the class name of
+ * {@link BasicMarkerFactory}.
+ */
+ public String getMarkerFactoryClassStr() {
+ return BasicMarkerFactory.class.getName();
+ }
+}
diff --git a/slf4j-android/src/main/resources/META-INF/MANIFEST.MF b/slf4j-android/src/main/resources/META-INF/MANIFEST.MF
index 7bb0895..d71f94c 100644
--- a/slf4j-android/src/main/resources/META-INF/MANIFEST.MF
+++ b/slf4j-android/src/main/resources/META-INF/MANIFEST.MF
@@ -1,9 +1,9 @@
-Implementation-Title: slf4j-android
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: slf4j.android
-Bundle-Name: slf4j-android
-Bundle-Vendor: SLF4J.ORG
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.slf4j.impl;version=${parsedVersion.osgiVersion}
-Import-Package: org.slf4j;version=${parsedVersion.osgiVersion}, org.slf4j.spi;version=${parsedVersion.osgiVersion}, org.slf4j.helpers;version=${parsedVersion.osgiVersion}
+Implementation-Title: slf4j-android
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: slf4j.android
+Bundle-Name: slf4j-android
+Bundle-Vendor: SLF4J.ORG
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.slf4j.impl;version=${parsedVersion.osgiVersion}
+Import-Package: org.slf4j;version=${parsedVersion.osgiVersion}, org.slf4j.spi;version=${parsedVersion.osgiVersion}, org.slf4j.helpers;version=${parsedVersion.osgiVersion}
Fragment-Host: slf4j.apidiff --git a/slf4j-android/src/test/java/org/slf4j/impl/AndroidLoggerFactoryTest.java b/slf4j-android/src/test/java/org/slf4j/impl/AndroidLoggerFactoryTest.java
index 993474f..12c0a7a 100644
--- a/slf4j-android/src/test/java/org/slf4j/impl/AndroidLoggerFactoryTest.java
+++ b/slf4j-android/src/test/java/org/slf4j/impl/AndroidLoggerFactoryTest.java
@@ -1,79 +1,79 @@
-/*
- * Copyright (c) 2004-2013 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.impl;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class AndroidLoggerFactoryTest {
- @Test
- public void shortLoggerNames() {
- assertEquals("o.test.p.TestClass", AndroidLoggerFactory.loggerNameToTag("o.test.p.TestClass"));
- assertEquals("ex.test.TestClass", AndroidLoggerFactory.loggerNameToTag("ex.test.TestClass"));
- assertEquals("MyClass", AndroidLoggerFactory.loggerNameToTag("MyClass"));
- }
-
- @Test
- public void emptyLoggerNames() {
- assertEquals(AndroidLoggerFactory.ANONYMOUS_TAG, AndroidLoggerFactory.loggerNameToTag(null));
- assertEquals("", AndroidLoggerFactory.loggerNameToTag(""));
- }
-
- @Test
- public void simpleLoggerName() {
- assertEquals("o*.t*.p*.TestClass", AndroidLoggerFactory.loggerNameToTag("org.test.package.TestClass"));
- }
-
- @Test
- public void loggerNameWithOneCharPackage() {
- assertEquals("o.t*.p*.p*.TestClass", AndroidLoggerFactory.loggerNameToTag("o.test.project.package.TestClass"));
- assertEquals("o.t*.p*.p.TestClass", AndroidLoggerFactory.loggerNameToTag("o.test.project.p.TestClass"));
- }
-
- @Test
- public void longLoggerName() {
- assertEquals("AndroidLoggerFactory", AndroidLoggerFactory.loggerNameToTag("org.slf4j.impl.AndroidLoggerFactory"));
- }
-
- @Test
- public void veryLongLoggerName() {
- assertEquals("*meAndShouldBeTruncated", AndroidLoggerFactory.loggerNameToTag("IAmAVeryLongLoggerNameAndShouldBeTruncated"));
- }
-
- @Test
- public void oneWordLoggerName() {
- assertEquals("TestClass", AndroidLoggerFactory.loggerNameToTag("TestClass"));
- }
-
- @Test
- public void weirdLoggerNames() {
- assertEquals("WeirdLoggerName.", AndroidLoggerFactory.loggerNameToTag("WeirdLoggerName."));
- assertEquals(".WeirdLoggerName", AndroidLoggerFactory.loggerNameToTag(".WeirdLoggerName"));
- assertEquals(".WeirdLoggerName.", AndroidLoggerFactory.loggerNameToTag(".WeirdLoggerName."));
- assertEquals(".", AndroidLoggerFactory.loggerNameToTag("."));
- assertEquals("..", AndroidLoggerFactory.loggerNameToTag(".."));
- }
-}
+/*
+ * Copyright (c) 2004-2013 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j.impl;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class AndroidLoggerFactoryTest {
+ @Test
+ public void shortLoggerNames() {
+ assertEquals("o.test.p.TestClass", AndroidLoggerFactory.loggerNameToTag("o.test.p.TestClass"));
+ assertEquals("ex.test.TestClass", AndroidLoggerFactory.loggerNameToTag("ex.test.TestClass"));
+ assertEquals("MyClass", AndroidLoggerFactory.loggerNameToTag("MyClass"));
+ }
+
+ @Test
+ public void emptyLoggerNames() {
+ assertEquals(AndroidLoggerFactory.ANONYMOUS_TAG, AndroidLoggerFactory.loggerNameToTag(null));
+ assertEquals("", AndroidLoggerFactory.loggerNameToTag(""));
+ }
+
+ @Test
+ public void simpleLoggerName() {
+ assertEquals("o*.t*.p*.TestClass", AndroidLoggerFactory.loggerNameToTag("org.test.package.TestClass"));
+ }
+
+ @Test
+ public void loggerNameWithOneCharPackage() {
+ assertEquals("o.t*.p*.p*.TestClass", AndroidLoggerFactory.loggerNameToTag("o.test.project.package.TestClass"));
+ assertEquals("o.t*.p*.p.TestClass", AndroidLoggerFactory.loggerNameToTag("o.test.project.p.TestClass"));
+ }
+
+ @Test
+ public void longLoggerName() {
+ assertEquals("AndroidLoggerFactory", AndroidLoggerFactory.loggerNameToTag("org.slf4j.impl.AndroidLoggerFactory"));
+ }
+
+ @Test
+ public void veryLongLoggerName() {
+ assertEquals("*meAndShouldBeTruncated", AndroidLoggerFactory.loggerNameToTag("IAmAVeryLongLoggerNameAndShouldBeTruncated"));
+ }
+
+ @Test
+ public void oneWordLoggerName() {
+ assertEquals("TestClass", AndroidLoggerFactory.loggerNameToTag("TestClass"));
+ }
+
+ @Test
+ public void weirdLoggerNames() {
+ assertEquals("WeirdLoggerName.", AndroidLoggerFactory.loggerNameToTag("WeirdLoggerName."));
+ assertEquals(".WeirdLoggerName", AndroidLoggerFactory.loggerNameToTag(".WeirdLoggerName"));
+ assertEquals(".WeirdLoggerName.", AndroidLoggerFactory.loggerNameToTag(".WeirdLoggerName."));
+ assertEquals(".", AndroidLoggerFactory.loggerNameToTag("."));
+ assertEquals("..", AndroidLoggerFactory.loggerNameToTag(".."));
+ }
+}
diff --git a/slf4j-api/LICENSE.txt b/slf4j-api/LICENSE.txt
new file mode 100644
index 0000000..508a272
--- /dev/null
+++ b/slf4j-api/LICENSE.txt
@@ -0,0 +1,24 @@
+Copyright (c) 2004-2007 QOS.ch
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
diff --git a/slf4j-api/pom.xml b/slf4j-api/pom.xml
old file mode 100644
new file mode 100755
index a33ed63..587adfe 100755
--- a/slf4j-api/pom.xml
+++ b/slf4j-api/pom.xml
@@ -1,120 +1,120 @@
-
-
-
- 4.0.0
-
-
- org.slf4j
- slf4j-parent
- 1.7.25
-
-
- slf4j-api
-
- jar
- SLF4J API Module
- The slf4j API
-
- http://www.slf4j.org
-
-
-
-
- org.codehaus.mojo
- animal-sniffer-maven-plugin
-
-
-
- org.slf4j.impl.StaticMDCBinder
- org.slf4j.impl.StaticLoggerBinder
- org.slf4j.impl.StaticMarkerBinder
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- once
- plain
- false
-
- **/AllTest.java
- **/PackageTest.java
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
- bundle-test-jar
- package
-
- jar
- test-jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-antrun-plugin
-
-
- process-classes
-
- run
-
-
-
-
-
- Removing slf4j-api's dummy StaticLoggerBinder and StaticMarkerBinder
-
-
-
-
-
-
-
-
-
-
- org.eclipse.m2e
- lifecycle-mapping
- 1.0.0
-
-
-
-
-
-
- org.apache.maven.plugins
-
-
- maven-antrun-plugin
-
- [1.3,)
-
- run
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+ 4.0.0
+
+
+ org.slf4j
+ slf4j-parent
+ 1.7.26
+
+
+ slf4j-api
+
+ jar
+ SLF4J API Module
+ The slf4j API
+
+ http://www.slf4j.org
+
+
+
+
+ org.codehaus.mojo
+ animal-sniffer-maven-plugin
+
+
+
+ org.slf4j.impl.StaticMDCBinder
+ org.slf4j.impl.StaticLoggerBinder
+ org.slf4j.impl.StaticMarkerBinder
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ once
+ plain
+ false
+
+ **/AllTest.java
+ **/PackageTest.java
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ bundle-test-jar
+ package
+
+ jar
+ test-jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+ process-classes
+
+ run
+
+
+
+
+
+ Removing slf4j-api's dummy StaticLoggerBinder and StaticMarkerBinder
+
+
+
+
+
+
+
+
+
+
+ org.eclipse.m2e
+ lifecycle-mapping
+ 1.0.0
+
+
+
+
+
+
+ org.apache.maven.plugins
+
+
+ maven-antrun-plugin
+
+ [1.3,)
+
+ run
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/slf4j-api/src/main/java/org/slf4j/ILoggerFactory.java b/slf4j-api/src/main/java/org/slf4j/ILoggerFactory.java
index cdd6338..8ed82f3 100644
--- a/slf4j-api/src/main/java/org/slf4j/ILoggerFactory.java
+++ b/slf4j-api/src/main/java/org/slf4j/ILoggerFactory.java
@@ -1,57 +1,57 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j;
-
-/**
- * ILoggerFactory instances manufacture {@link Logger}
- * instances by name.
- *
- *
Most users retrieve {@link Logger} instances through the static
- * {@link LoggerFactory#getLogger(String)} method. An instance of of this
- * interface is bound internally with {@link LoggerFactory} class at
- * compile time.
- *
- * @author Ceki Gülcü
- */
-public interface ILoggerFactory {
-
- /**
- * Return an appropriate {@link Logger} instance as specified by the
- * name parameter.
- *
- *
If the name parameter is equal to {@link Logger#ROOT_LOGGER_NAME}, that is
- * the string value "ROOT" (case insensitive), then the root logger of the
- * underlying logging system is returned.
- *
- *
Null-valued name arguments are considered invalid.
- *
- *
Certain extremely simple logging systems, e.g. NOP, may always
- * return the same logger instance regardless of the requested name.
- *
- * @param name the name of the Logger to return
- * @return a Logger instance
- */
- public Logger getLogger(String name);
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j;
+
+/**
+ * ILoggerFactory instances manufacture {@link Logger}
+ * instances by name.
+ *
+ *
Most users retrieve {@link Logger} instances through the static
+ * {@link LoggerFactory#getLogger(String)} method. An instance of of this
+ * interface is bound internally with {@link LoggerFactory} class at
+ * compile time.
+ *
+ * @author Ceki Gülcü
+ */
+public interface ILoggerFactory {
+
+ /**
+ * Return an appropriate {@link Logger} instance as specified by the
+ * name parameter.
+ *
+ *
If the name parameter is equal to {@link Logger#ROOT_LOGGER_NAME}, that is
+ * the string value "ROOT" (case insensitive), then the root logger of the
+ * underlying logging system is returned.
+ *
+ *
Null-valued name arguments are considered invalid.
+ *
+ *
Certain extremely simple logging systems, e.g. NOP, may always
+ * return the same logger instance regardless of the requested name.
+ *
+ * @param name the name of the Logger to return
+ * @return a Logger instance
+ */
+ public Logger getLogger(String name);
+}
diff --git a/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java b/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java
index 88a1d42..7570221 100644
--- a/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java
+++ b/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java
@@ -1,81 +1,81 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j;
-
-/**
- * Implementations of this interface are used to manufacture {@link Marker}
- * instances.
- *
- *
See the section Implementing
- * the SLF4J API in the FAQ for details on how to make your logging
- * system conform to SLF4J.
- *
- * @author Ceki Gülcü
- */
-public interface IMarkerFactory {
-
- /**
- * Manufacture a {@link Marker} instance by name. If the instance has been
- * created earlier, return the previously created instance.
- *
- *
Null name values are not allowed.
- *
- * @param name the name of the marker to be created, null value is
- * not allowed.
- *
- * @return a Marker instance
- */
- Marker getMarker(String name);
-
- /**
- * Checks if the marker with the name already exists. If name is null, then false
- * is returned.
- *
- * @param name logger name to check for
- * @return true id the marker exists, false otherwise.
- */
- boolean exists(String name);
-
- /**
- * Detach an existing marker.
- *
- * Note that after a marker is detached, there might still be "dangling" references
- * to the detached marker.
- *
- *
- * @param name The name of the marker to detach
- * @return whether the marker could be detached or not
- */
- boolean detachMarker(String name);
-
- /**
- * Create a marker which is detached (even at birth) from this IMarkerFactory.
- *
- * @param name marker name
- * @return a dangling marker
- * @since 1.5.1
- */
- Marker getDetachedMarker(String name);
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j;
+
+/**
+ * Implementations of this interface are used to manufacture {@link Marker}
+ * instances.
+ *
+ *
See the section Implementing
+ * the SLF4J API in the FAQ for details on how to make your logging
+ * system conform to SLF4J.
+ *
+ * @author Ceki Gülcü
+ */
+public interface IMarkerFactory {
+
+ /**
+ * Manufacture a {@link Marker} instance by name. If the instance has been
+ * created earlier, return the previously created instance.
+ *
+ *
Null name values are not allowed.
+ *
+ * @param name the name of the marker to be created, null value is
+ * not allowed.
+ *
+ * @return a Marker instance
+ */
+ Marker getMarker(String name);
+
+ /**
+ * Checks if the marker with the name already exists. If name is null, then false
+ * is returned.
+ *
+ * @param name logger name to check for
+ * @return true id the marker exists, false otherwise.
+ */
+ boolean exists(String name);
+
+ /**
+ * Detach an existing marker.
+ *
+ * Note that after a marker is detached, there might still be "dangling" references
+ * to the detached marker.
+ *
+ *
+ * @param name The name of the marker to detach
+ * @return whether the marker could be detached or not
+ */
+ boolean detachMarker(String name);
+
+ /**
+ * Create a marker which is detached (even at birth) from this IMarkerFactory.
+ *
+ * @param name marker name
+ * @return a dangling marker
+ * @since 1.5.1
+ */
+ Marker getDetachedMarker(String name);
+}
diff --git a/slf4j-api/src/main/java/org/slf4j/Logger.java b/slf4j-api/src/main/java/org/slf4j/Logger.java
index 6e4b552..93dd994 100644
--- a/slf4j-api/src/main/java/org/slf4j/Logger.java
+++ b/slf4j-api/src/main/java/org/slf4j/Logger.java
@@ -1,721 +1,721 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package org.slf4j;
-
-/**
- * The org.slf4j.Logger interface is the main user entry point of SLF4J API.
- * It is expected that logging takes place through concrete implementations
- * of this interface.
- *
- *
Typical usage pattern:
- *
- * import org.slf4j.Logger;
- * import org.slf4j.LoggerFactory;
- *
- * public class Wombat {
- *
- * final static Logger logger = LoggerFactory.getLogger(Wombat.class);
- * Integer t;
- * Integer oldT;
- *
- * public void setTemperature(Integer temperature) {
- * oldT = t;
- * t = temperature;
- * logger.debug("Temperature set to {}. Old temperature was {}.", t, oldT);
- * if(temperature.intValue() > 50) {
- * logger.info("Temperature has risen above 50 degrees.");
- * }
- * }
- * }
- *
Once you are comfortable using loggers, i.e. instances of this interface, consider using
- * MDC as well as Markers.
- *
- * @author Ceki Gülcü
- */
-public interface Logger {
-
- /**
- * Case insensitive String constant used to retrieve the name of the root logger.
- *
- * @since 1.3
- */
- final public String ROOT_LOGGER_NAME = "ROOT";
-
- /**
- * Return the name of this Logger instance.
- * @return name of this logger instance
- */
- public String getName();
-
- /**
- * Is the logger instance enabled for the TRACE level?
- *
- * @return True if this Logger is enabled for the TRACE level,
- * false otherwise.
- * @since 1.4
- */
- public boolean isTraceEnabled();
-
- /**
- * Log a message at the TRACE level.
- *
- * @param msg the message string to be logged
- * @since 1.4
- */
- public void trace(String msg);
-
- /**
- * Log a message at the TRACE level according to the specified format
- * and argument.
- *
- *
This form avoids superfluous object creation when the logger
- * is disabled for the TRACE level.
- *
- * @param format the format string
- * @param arg the argument
- * @since 1.4
- */
- public void trace(String format, Object arg);
-
- /**
- * Log a message at the TRACE level according to the specified format
- * and arguments.
- *
- *
This form avoids superfluous object creation when the logger
- * is disabled for the TRACE level.
- *
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- * @since 1.4
- */
- public void trace(String format, Object arg1, Object arg2);
-
- /**
- * Log a message at the TRACE level according to the specified format
- * and arguments.
- *
- *
This form avoids superfluous string concatenation when the logger
- * is disabled for the TRACE level. However, this variant incurs the hidden
- * (and relatively small) cost of creating an Object[] before invoking the method,
- * even if this logger is disabled for TRACE. The variants taking {@link #trace(String, Object) one} and
- * {@link #trace(String, Object, Object) two} arguments exist solely in order to avoid this hidden cost.
- *
- * @param format the format string
- * @param arguments a list of 3 or more arguments
- * @since 1.4
- */
- public void trace(String format, Object... arguments);
-
- /**
- * Log an exception (throwable) at the TRACE level with an
- * accompanying message.
- *
- * @param msg the message accompanying the exception
- * @param t the exception (throwable) to log
- * @since 1.4
- */
- public void trace(String msg, Throwable t);
-
- /**
- * Similar to {@link #isTraceEnabled()} method except that the
- * marker data is also taken into account.
- *
- * @param marker The marker data to take into consideration
- * @return True if this Logger is enabled for the TRACE level,
- * false otherwise.
- *
- * @since 1.4
- */
- public boolean isTraceEnabled(Marker marker);
-
- /**
- * Log a message with the specific Marker at the TRACE level.
- *
- * @param marker the marker data specific to this log statement
- * @param msg the message string to be logged
- * @since 1.4
- */
- public void trace(Marker marker, String msg);
-
- /**
- * This method is similar to {@link #trace(String, Object)} method except that the
- * marker data is also taken into consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arg the argument
- * @since 1.4
- */
- public void trace(Marker marker, String format, Object arg);
-
- /**
- * This method is similar to {@link #trace(String, Object, Object)}
- * method except that the marker data is also taken into
- * consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- * @since 1.4
- */
- public void trace(Marker marker, String format, Object arg1, Object arg2);
-
- /**
- * This method is similar to {@link #trace(String, Object...)}
- * method except that the marker data is also taken into
- * consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param argArray an array of arguments
- * @since 1.4
- */
- public void trace(Marker marker, String format, Object... argArray);
-
- /**
- * This method is similar to {@link #trace(String, Throwable)} method except that the
- * marker data is also taken into consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param msg the message accompanying the exception
- * @param t the exception (throwable) to log
- * @since 1.4
- */
- public void trace(Marker marker, String msg, Throwable t);
-
- /**
- * Is the logger instance enabled for the DEBUG level?
- *
- * @return True if this Logger is enabled for the DEBUG level,
- * false otherwise.
- */
- public boolean isDebugEnabled();
-
- /**
- * Log a message at the DEBUG level.
- *
- * @param msg the message string to be logged
- */
- public void debug(String msg);
-
- /**
- * Log a message at the DEBUG level according to the specified format
- * and argument.
- *
- *
This form avoids superfluous object creation when the logger
- * is disabled for the DEBUG level.
- *
- * @param format the format string
- * @param arg the argument
- */
- public void debug(String format, Object arg);
-
- /**
- * Log a message at the DEBUG level according to the specified format
- * and arguments.
- *
- *
This form avoids superfluous object creation when the logger
- * is disabled for the DEBUG level.
- *
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void debug(String format, Object arg1, Object arg2);
-
- /**
- * Log a message at the DEBUG level according to the specified format
- * and arguments.
- *
- *
This form avoids superfluous string concatenation when the logger
- * is disabled for the DEBUG level. However, this variant incurs the hidden
- * (and relatively small) cost of creating an Object[] before invoking the method,
- * even if this logger is disabled for DEBUG. The variants taking
- * {@link #debug(String, Object) one} and {@link #debug(String, Object, Object) two}
- * arguments exist solely in order to avoid this hidden cost.
- *
- * @param format the format string
- * @param arguments a list of 3 or more arguments
- */
- public void debug(String format, Object... arguments);
-
- /**
- * Log an exception (throwable) at the DEBUG level with an
- * accompanying message.
- *
- * @param msg the message accompanying the exception
- * @param t the exception (throwable) to log
- */
- public void debug(String msg, Throwable t);
-
- /**
- * Similar to {@link #isDebugEnabled()} method except that the
- * marker data is also taken into account.
- *
- * @param marker The marker data to take into consideration
- * @return True if this Logger is enabled for the DEBUG level,
- * false otherwise.
- */
- public boolean isDebugEnabled(Marker marker);
-
- /**
- * Log a message with the specific Marker at the DEBUG level.
- *
- * @param marker the marker data specific to this log statement
- * @param msg the message string to be logged
- */
- public void debug(Marker marker, String msg);
-
- /**
- * This method is similar to {@link #debug(String, Object)} method except that the
- * marker data is also taken into consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arg the argument
- */
- public void debug(Marker marker, String format, Object arg);
-
- /**
- * This method is similar to {@link #debug(String, Object, Object)}
- * method except that the marker data is also taken into
- * consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void debug(Marker marker, String format, Object arg1, Object arg2);
-
- /**
- * This method is similar to {@link #debug(String, Object...)}
- * method except that the marker data is also taken into
- * consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arguments a list of 3 or more arguments
- */
- public void debug(Marker marker, String format, Object... arguments);
-
- /**
- * This method is similar to {@link #debug(String, Throwable)} method except that the
- * marker data is also taken into consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param msg the message accompanying the exception
- * @param t the exception (throwable) to log
- */
- public void debug(Marker marker, String msg, Throwable t);
-
- /**
- * Is the logger instance enabled for the INFO level?
- *
- * @return True if this Logger is enabled for the INFO level,
- * false otherwise.
- */
- public boolean isInfoEnabled();
-
- /**
- * Log a message at the INFO level.
- *
- * @param msg the message string to be logged
- */
- public void info(String msg);
-
- /**
- * Log a message at the INFO level according to the specified format
- * and argument.
- *
- *
This form avoids superfluous object creation when the logger
- * is disabled for the INFO level.
- *
- * @param format the format string
- * @param arg the argument
- */
- public void info(String format, Object arg);
-
- /**
- * Log a message at the INFO level according to the specified format
- * and arguments.
- *
- *
This form avoids superfluous object creation when the logger
- * is disabled for the INFO level.
- *
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void info(String format, Object arg1, Object arg2);
-
- /**
- * Log a message at the INFO level according to the specified format
- * and arguments.
- *
- *
This form avoids superfluous string concatenation when the logger
- * is disabled for the INFO level. However, this variant incurs the hidden
- * (and relatively small) cost of creating an Object[] before invoking the method,
- * even if this logger is disabled for INFO. The variants taking
- * {@link #info(String, Object) one} and {@link #info(String, Object, Object) two}
- * arguments exist solely in order to avoid this hidden cost.
- *
- * @param format the format string
- * @param arguments a list of 3 or more arguments
- */
- public void info(String format, Object... arguments);
-
- /**
- * Log an exception (throwable) at the INFO level with an
- * accompanying message.
- *
- * @param msg the message accompanying the exception
- * @param t the exception (throwable) to log
- */
- public void info(String msg, Throwable t);
-
- /**
- * Similar to {@link #isInfoEnabled()} method except that the marker
- * data is also taken into consideration.
- *
- * @param marker The marker data to take into consideration
- * @return true if this logger is warn enabled, false otherwise
- */
- public boolean isInfoEnabled(Marker marker);
-
- /**
- * Log a message with the specific Marker at the INFO level.
- *
- * @param marker The marker specific to this log statement
- * @param msg the message string to be logged
- */
- public void info(Marker marker, String msg);
-
- /**
- * This method is similar to {@link #info(String, Object)} method except that the
- * marker data is also taken into consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arg the argument
- */
- public void info(Marker marker, String format, Object arg);
-
- /**
- * This method is similar to {@link #info(String, Object, Object)}
- * method except that the marker data is also taken into
- * consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void info(Marker marker, String format, Object arg1, Object arg2);
-
- /**
- * This method is similar to {@link #info(String, Object...)}
- * method except that the marker data is also taken into
- * consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arguments a list of 3 or more arguments
- */
- public void info(Marker marker, String format, Object... arguments);
-
- /**
- * This method is similar to {@link #info(String, Throwable)} method
- * except that the marker data is also taken into consideration.
- *
- * @param marker the marker data for this log statement
- * @param msg the message accompanying the exception
- * @param t the exception (throwable) to log
- */
- public void info(Marker marker, String msg, Throwable t);
-
- /**
- * Is the logger instance enabled for the WARN level?
- *
- * @return True if this Logger is enabled for the WARN level,
- * false otherwise.
- */
- public boolean isWarnEnabled();
-
- /**
- * Log a message at the WARN level.
- *
- * @param msg the message string to be logged
- */
- public void warn(String msg);
-
- /**
- * Log a message at the WARN level according to the specified format
- * and argument.
- *
- *
This form avoids superfluous object creation when the logger
- * is disabled for the WARN level.
- *
- * @param format the format string
- * @param arg the argument
- */
- public void warn(String format, Object arg);
-
- /**
- * Log a message at the WARN level according to the specified format
- * and arguments.
- *
- *
This form avoids superfluous string concatenation when the logger
- * is disabled for the WARN level. However, this variant incurs the hidden
- * (and relatively small) cost of creating an Object[] before invoking the method,
- * even if this logger is disabled for WARN. The variants taking
- * {@link #warn(String, Object) one} and {@link #warn(String, Object, Object) two}
- * arguments exist solely in order to avoid this hidden cost.
- *
- * @param format the format string
- * @param arguments a list of 3 or more arguments
- */
- public void warn(String format, Object... arguments);
-
- /**
- * Log a message at the WARN level according to the specified format
- * and arguments.
- *
- *
This form avoids superfluous object creation when the logger
- * is disabled for the WARN level.
- *
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void warn(String format, Object arg1, Object arg2);
-
- /**
- * Log an exception (throwable) at the WARN level with an
- * accompanying message.
- *
- * @param msg the message accompanying the exception
- * @param t the exception (throwable) to log
- */
- public void warn(String msg, Throwable t);
-
- /**
- * Similar to {@link #isWarnEnabled()} method except that the marker
- * data is also taken into consideration.
- *
- * @param marker The marker data to take into consideration
- * @return True if this Logger is enabled for the WARN level,
- * false otherwise.
- */
- public boolean isWarnEnabled(Marker marker);
-
- /**
- * Log a message with the specific Marker at the WARN level.
- *
- * @param marker The marker specific to this log statement
- * @param msg the message string to be logged
- */
- public void warn(Marker marker, String msg);
-
- /**
- * This method is similar to {@link #warn(String, Object)} method except that the
- * marker data is also taken into consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arg the argument
- */
- public void warn(Marker marker, String format, Object arg);
-
- /**
- * This method is similar to {@link #warn(String, Object, Object)}
- * method except that the marker data is also taken into
- * consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void warn(Marker marker, String format, Object arg1, Object arg2);
-
- /**
- * This method is similar to {@link #warn(String, Object...)}
- * method except that the marker data is also taken into
- * consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arguments a list of 3 or more arguments
- */
- public void warn(Marker marker, String format, Object... arguments);
-
- /**
- * This method is similar to {@link #warn(String, Throwable)} method
- * except that the marker data is also taken into consideration.
- *
- * @param marker the marker data for this log statement
- * @param msg the message accompanying the exception
- * @param t the exception (throwable) to log
- */
- public void warn(Marker marker, String msg, Throwable t);
-
- /**
- * Is the logger instance enabled for the ERROR level?
- *
- * @return True if this Logger is enabled for the ERROR level,
- * false otherwise.
- */
- public boolean isErrorEnabled();
-
- /**
- * Log a message at the ERROR level.
- *
- * @param msg the message string to be logged
- */
- public void error(String msg);
-
- /**
- * Log a message at the ERROR level according to the specified format
- * and argument.
- *
- *
This form avoids superfluous object creation when the logger
- * is disabled for the ERROR level.
- *
- * @param format the format string
- * @param arg the argument
- */
- public void error(String format, Object arg);
-
- /**
- * Log a message at the ERROR level according to the specified format
- * and arguments.
- *
- *
This form avoids superfluous object creation when the logger
- * is disabled for the ERROR level.
- *
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void error(String format, Object arg1, Object arg2);
-
- /**
- * Log a message at the ERROR level according to the specified format
- * and arguments.
- *
- *
This form avoids superfluous string concatenation when the logger
- * is disabled for the ERROR level. However, this variant incurs the hidden
- * (and relatively small) cost of creating an Object[] before invoking the method,
- * even if this logger is disabled for ERROR. The variants taking
- * {@link #error(String, Object) one} and {@link #error(String, Object, Object) two}
- * arguments exist solely in order to avoid this hidden cost.
- *
- * @param format the format string
- * @param arguments a list of 3 or more arguments
- */
- public void error(String format, Object... arguments);
-
- /**
- * Log an exception (throwable) at the ERROR level with an
- * accompanying message.
- *
- * @param msg the message accompanying the exception
- * @param t the exception (throwable) to log
- */
- public void error(String msg, Throwable t);
-
- /**
- * Similar to {@link #isErrorEnabled()} method except that the
- * marker data is also taken into consideration.
- *
- * @param marker The marker data to take into consideration
- * @return True if this Logger is enabled for the ERROR level,
- * false otherwise.
- */
- public boolean isErrorEnabled(Marker marker);
-
- /**
- * Log a message with the specific Marker at the ERROR level.
- *
- * @param marker The marker specific to this log statement
- * @param msg the message string to be logged
- */
- public void error(Marker marker, String msg);
-
- /**
- * This method is similar to {@link #error(String, Object)} method except that the
- * marker data is also taken into consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arg the argument
- */
- public void error(Marker marker, String format, Object arg);
-
- /**
- * This method is similar to {@link #error(String, Object, Object)}
- * method except that the marker data is also taken into
- * consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void error(Marker marker, String format, Object arg1, Object arg2);
-
- /**
- * This method is similar to {@link #error(String, Object...)}
- * method except that the marker data is also taken into
- * consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param format the format string
- * @param arguments a list of 3 or more arguments
- */
- public void error(Marker marker, String format, Object... arguments);
-
- /**
- * This method is similar to {@link #error(String, Throwable)}
- * method except that the marker data is also taken into
- * consideration.
- *
- * @param marker the marker data specific to this log statement
- * @param msg the message accompanying the exception
- * @param t the exception (throwable) to log
- */
- public void error(Marker marker, String msg, Throwable t);
-
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+package org.slf4j;
+
+/**
+ * The org.slf4j.Logger interface is the main user entry point of SLF4J API.
+ * It is expected that logging takes place through concrete implementations
+ * of this interface.
+ *
+ *
Typical usage pattern:
+ *
+ * import org.slf4j.Logger;
+ * import org.slf4j.LoggerFactory;
+ *
+ * public class Wombat {
+ *
+ * final static Logger logger = LoggerFactory.getLogger(Wombat.class);
+ * Integer t;
+ * Integer oldT;
+ *
+ * public void setTemperature(Integer temperature) {
+ * oldT = t;
+ * t = temperature;
+ * logger.debug("Temperature set to {}. Old temperature was {}.", t, oldT);
+ * if(temperature.intValue() > 50) {
+ * logger.info("Temperature has risen above 50 degrees.");
+ * }
+ * }
+ * }
+ *
Once you are comfortable using loggers, i.e. instances of this interface, consider using
+ * MDC as well as Markers.
+ *
+ * @author Ceki Gülcü
+ */
+public interface Logger {
+
+ /**
+ * Case insensitive String constant used to retrieve the name of the root logger.
+ *
+ * @since 1.3
+ */
+ final public String ROOT_LOGGER_NAME = "ROOT";
+
+ /**
+ * Return the name of this Logger instance.
+ * @return name of this logger instance
+ */
+ public String getName();
+
+ /**
+ * Is the logger instance enabled for the TRACE level?
+ *
+ * @return True if this Logger is enabled for the TRACE level,
+ * false otherwise.
+ * @since 1.4
+ */
+ public boolean isTraceEnabled();
+
+ /**
+ * Log a message at the TRACE level.
+ *
+ * @param msg the message string to be logged
+ * @since 1.4
+ */
+ public void trace(String msg);
+
+ /**
+ * Log a message at the TRACE level according to the specified format
+ * and argument.
+ *
+ *
This form avoids superfluous object creation when the logger
+ * is disabled for the TRACE level.
+ *
+ * @param format the format string
+ * @param arg the argument
+ * @since 1.4
+ */
+ public void trace(String format, Object arg);
+
+ /**
+ * Log a message at the TRACE level according to the specified format
+ * and arguments.
+ *
+ *
This form avoids superfluous object creation when the logger
+ * is disabled for the TRACE level.
+ *
+ * @param format the format string
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ * @since 1.4
+ */
+ public void trace(String format, Object arg1, Object arg2);
+
+ /**
+ * Log a message at the TRACE level according to the specified format
+ * and arguments.
+ *
+ *
This form avoids superfluous string concatenation when the logger
+ * is disabled for the TRACE level. However, this variant incurs the hidden
+ * (and relatively small) cost of creating an Object[] before invoking the method,
+ * even if this logger is disabled for TRACE. The variants taking {@link #trace(String, Object) one} and
+ * {@link #trace(String, Object, Object) two} arguments exist solely in order to avoid this hidden cost.
+ *
+ * @param format the format string
+ * @param arguments a list of 3 or more arguments
+ * @since 1.4
+ */
+ public void trace(String format, Object... arguments);
+
+ /**
+ * Log an exception (throwable) at the TRACE level with an
+ * accompanying message.
+ *
+ * @param msg the message accompanying the exception
+ * @param t the exception (throwable) to log
+ * @since 1.4
+ */
+ public void trace(String msg, Throwable t);
+
+ /**
+ * Similar to {@link #isTraceEnabled()} method except that the
+ * marker data is also taken into account.
+ *
+ * @param marker The marker data to take into consideration
+ * @return True if this Logger is enabled for the TRACE level,
+ * false otherwise.
+ *
+ * @since 1.4
+ */
+ public boolean isTraceEnabled(Marker marker);
+
+ /**
+ * Log a message with the specific Marker at the TRACE level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param msg the message string to be logged
+ * @since 1.4
+ */
+ public void trace(Marker marker, String msg);
+
+ /**
+ * This method is similar to {@link #trace(String, Object)} method except that the
+ * marker data is also taken into consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arg the argument
+ * @since 1.4
+ */
+ public void trace(Marker marker, String format, Object arg);
+
+ /**
+ * This method is similar to {@link #trace(String, Object, Object)}
+ * method except that the marker data is also taken into
+ * consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ * @since 1.4
+ */
+ public void trace(Marker marker, String format, Object arg1, Object arg2);
+
+ /**
+ * This method is similar to {@link #trace(String, Object...)}
+ * method except that the marker data is also taken into
+ * consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param argArray an array of arguments
+ * @since 1.4
+ */
+ public void trace(Marker marker, String format, Object... argArray);
+
+ /**
+ * This method is similar to {@link #trace(String, Throwable)} method except that the
+ * marker data is also taken into consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param msg the message accompanying the exception
+ * @param t the exception (throwable) to log
+ * @since 1.4
+ */
+ public void trace(Marker marker, String msg, Throwable t);
+
+ /**
+ * Is the logger instance enabled for the DEBUG level?
+ *
+ * @return True if this Logger is enabled for the DEBUG level,
+ * false otherwise.
+ */
+ public boolean isDebugEnabled();
+
+ /**
+ * Log a message at the DEBUG level.
+ *
+ * @param msg the message string to be logged
+ */
+ public void debug(String msg);
+
+ /**
+ * Log a message at the DEBUG level according to the specified format
+ * and argument.
+ *
+ *
This form avoids superfluous object creation when the logger
+ * is disabled for the DEBUG level.
+ *
+ * @param format the format string
+ * @param arg the argument
+ */
+ public void debug(String format, Object arg);
+
+ /**
+ * Log a message at the DEBUG level according to the specified format
+ * and arguments.
+ *
+ *
This form avoids superfluous object creation when the logger
+ * is disabled for the DEBUG level.
+ *
+ * @param format the format string
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ */
+ public void debug(String format, Object arg1, Object arg2);
+
+ /**
+ * Log a message at the DEBUG level according to the specified format
+ * and arguments.
+ *
+ *
This form avoids superfluous string concatenation when the logger
+ * is disabled for the DEBUG level. However, this variant incurs the hidden
+ * (and relatively small) cost of creating an Object[] before invoking the method,
+ * even if this logger is disabled for DEBUG. The variants taking
+ * {@link #debug(String, Object) one} and {@link #debug(String, Object, Object) two}
+ * arguments exist solely in order to avoid this hidden cost.
+ *
+ * @param format the format string
+ * @param arguments a list of 3 or more arguments
+ */
+ public void debug(String format, Object... arguments);
+
+ /**
+ * Log an exception (throwable) at the DEBUG level with an
+ * accompanying message.
+ *
+ * @param msg the message accompanying the exception
+ * @param t the exception (throwable) to log
+ */
+ public void debug(String msg, Throwable t);
+
+ /**
+ * Similar to {@link #isDebugEnabled()} method except that the
+ * marker data is also taken into account.
+ *
+ * @param marker The marker data to take into consideration
+ * @return True if this Logger is enabled for the DEBUG level,
+ * false otherwise.
+ */
+ public boolean isDebugEnabled(Marker marker);
+
+ /**
+ * Log a message with the specific Marker at the DEBUG level.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param msg the message string to be logged
+ */
+ public void debug(Marker marker, String msg);
+
+ /**
+ * This method is similar to {@link #debug(String, Object)} method except that the
+ * marker data is also taken into consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arg the argument
+ */
+ public void debug(Marker marker, String format, Object arg);
+
+ /**
+ * This method is similar to {@link #debug(String, Object, Object)}
+ * method except that the marker data is also taken into
+ * consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ */
+ public void debug(Marker marker, String format, Object arg1, Object arg2);
+
+ /**
+ * This method is similar to {@link #debug(String, Object...)}
+ * method except that the marker data is also taken into
+ * consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arguments a list of 3 or more arguments
+ */
+ public void debug(Marker marker, String format, Object... arguments);
+
+ /**
+ * This method is similar to {@link #debug(String, Throwable)} method except that the
+ * marker data is also taken into consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param msg the message accompanying the exception
+ * @param t the exception (throwable) to log
+ */
+ public void debug(Marker marker, String msg, Throwable t);
+
+ /**
+ * Is the logger instance enabled for the INFO level?
+ *
+ * @return True if this Logger is enabled for the INFO level,
+ * false otherwise.
+ */
+ public boolean isInfoEnabled();
+
+ /**
+ * Log a message at the INFO level.
+ *
+ * @param msg the message string to be logged
+ */
+ public void info(String msg);
+
+ /**
+ * Log a message at the INFO level according to the specified format
+ * and argument.
+ *
+ *
This form avoids superfluous object creation when the logger
+ * is disabled for the INFO level.
+ *
+ * @param format the format string
+ * @param arg the argument
+ */
+ public void info(String format, Object arg);
+
+ /**
+ * Log a message at the INFO level according to the specified format
+ * and arguments.
+ *
+ *
This form avoids superfluous object creation when the logger
+ * is disabled for the INFO level.
+ *
+ * @param format the format string
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ */
+ public void info(String format, Object arg1, Object arg2);
+
+ /**
+ * Log a message at the INFO level according to the specified format
+ * and arguments.
+ *
+ *
This form avoids superfluous string concatenation when the logger
+ * is disabled for the INFO level. However, this variant incurs the hidden
+ * (and relatively small) cost of creating an Object[] before invoking the method,
+ * even if this logger is disabled for INFO. The variants taking
+ * {@link #info(String, Object) one} and {@link #info(String, Object, Object) two}
+ * arguments exist solely in order to avoid this hidden cost.
+ *
+ * @param format the format string
+ * @param arguments a list of 3 or more arguments
+ */
+ public void info(String format, Object... arguments);
+
+ /**
+ * Log an exception (throwable) at the INFO level with an
+ * accompanying message.
+ *
+ * @param msg the message accompanying the exception
+ * @param t the exception (throwable) to log
+ */
+ public void info(String msg, Throwable t);
+
+ /**
+ * Similar to {@link #isInfoEnabled()} method except that the marker
+ * data is also taken into consideration.
+ *
+ * @param marker The marker data to take into consideration
+ * @return true if this logger is warn enabled, false otherwise
+ */
+ public boolean isInfoEnabled(Marker marker);
+
+ /**
+ * Log a message with the specific Marker at the INFO level.
+ *
+ * @param marker The marker specific to this log statement
+ * @param msg the message string to be logged
+ */
+ public void info(Marker marker, String msg);
+
+ /**
+ * This method is similar to {@link #info(String, Object)} method except that the
+ * marker data is also taken into consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arg the argument
+ */
+ public void info(Marker marker, String format, Object arg);
+
+ /**
+ * This method is similar to {@link #info(String, Object, Object)}
+ * method except that the marker data is also taken into
+ * consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ */
+ public void info(Marker marker, String format, Object arg1, Object arg2);
+
+ /**
+ * This method is similar to {@link #info(String, Object...)}
+ * method except that the marker data is also taken into
+ * consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arguments a list of 3 or more arguments
+ */
+ public void info(Marker marker, String format, Object... arguments);
+
+ /**
+ * This method is similar to {@link #info(String, Throwable)} method
+ * except that the marker data is also taken into consideration.
+ *
+ * @param marker the marker data for this log statement
+ * @param msg the message accompanying the exception
+ * @param t the exception (throwable) to log
+ */
+ public void info(Marker marker, String msg, Throwable t);
+
+ /**
+ * Is the logger instance enabled for the WARN level?
+ *
+ * @return True if this Logger is enabled for the WARN level,
+ * false otherwise.
+ */
+ public boolean isWarnEnabled();
+
+ /**
+ * Log a message at the WARN level.
+ *
+ * @param msg the message string to be logged
+ */
+ public void warn(String msg);
+
+ /**
+ * Log a message at the WARN level according to the specified format
+ * and argument.
+ *
+ *
This form avoids superfluous object creation when the logger
+ * is disabled for the WARN level.
+ *
+ * @param format the format string
+ * @param arg the argument
+ */
+ public void warn(String format, Object arg);
+
+ /**
+ * Log a message at the WARN level according to the specified format
+ * and arguments.
+ *
+ *
This form avoids superfluous string concatenation when the logger
+ * is disabled for the WARN level. However, this variant incurs the hidden
+ * (and relatively small) cost of creating an Object[] before invoking the method,
+ * even if this logger is disabled for WARN. The variants taking
+ * {@link #warn(String, Object) one} and {@link #warn(String, Object, Object) two}
+ * arguments exist solely in order to avoid this hidden cost.
+ *
+ * @param format the format string
+ * @param arguments a list of 3 or more arguments
+ */
+ public void warn(String format, Object... arguments);
+
+ /**
+ * Log a message at the WARN level according to the specified format
+ * and arguments.
+ *
+ *
This form avoids superfluous object creation when the logger
+ * is disabled for the WARN level.
+ *
+ * @param format the format string
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ */
+ public void warn(String format, Object arg1, Object arg2);
+
+ /**
+ * Log an exception (throwable) at the WARN level with an
+ * accompanying message.
+ *
+ * @param msg the message accompanying the exception
+ * @param t the exception (throwable) to log
+ */
+ public void warn(String msg, Throwable t);
+
+ /**
+ * Similar to {@link #isWarnEnabled()} method except that the marker
+ * data is also taken into consideration.
+ *
+ * @param marker The marker data to take into consideration
+ * @return True if this Logger is enabled for the WARN level,
+ * false otherwise.
+ */
+ public boolean isWarnEnabled(Marker marker);
+
+ /**
+ * Log a message with the specific Marker at the WARN level.
+ *
+ * @param marker The marker specific to this log statement
+ * @param msg the message string to be logged
+ */
+ public void warn(Marker marker, String msg);
+
+ /**
+ * This method is similar to {@link #warn(String, Object)} method except that the
+ * marker data is also taken into consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arg the argument
+ */
+ public void warn(Marker marker, String format, Object arg);
+
+ /**
+ * This method is similar to {@link #warn(String, Object, Object)}
+ * method except that the marker data is also taken into
+ * consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ */
+ public void warn(Marker marker, String format, Object arg1, Object arg2);
+
+ /**
+ * This method is similar to {@link #warn(String, Object...)}
+ * method except that the marker data is also taken into
+ * consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arguments a list of 3 or more arguments
+ */
+ public void warn(Marker marker, String format, Object... arguments);
+
+ /**
+ * This method is similar to {@link #warn(String, Throwable)} method
+ * except that the marker data is also taken into consideration.
+ *
+ * @param marker the marker data for this log statement
+ * @param msg the message accompanying the exception
+ * @param t the exception (throwable) to log
+ */
+ public void warn(Marker marker, String msg, Throwable t);
+
+ /**
+ * Is the logger instance enabled for the ERROR level?
+ *
+ * @return True if this Logger is enabled for the ERROR level,
+ * false otherwise.
+ */
+ public boolean isErrorEnabled();
+
+ /**
+ * Log a message at the ERROR level.
+ *
+ * @param msg the message string to be logged
+ */
+ public void error(String msg);
+
+ /**
+ * Log a message at the ERROR level according to the specified format
+ * and argument.
+ *
+ *
This form avoids superfluous object creation when the logger
+ * is disabled for the ERROR level.
+ *
+ * @param format the format string
+ * @param arg the argument
+ */
+ public void error(String format, Object arg);
+
+ /**
+ * Log a message at the ERROR level according to the specified format
+ * and arguments.
+ *
+ *
This form avoids superfluous object creation when the logger
+ * is disabled for the ERROR level.
+ *
+ * @param format the format string
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ */
+ public void error(String format, Object arg1, Object arg2);
+
+ /**
+ * Log a message at the ERROR level according to the specified format
+ * and arguments.
+ *
+ *
This form avoids superfluous string concatenation when the logger
+ * is disabled for the ERROR level. However, this variant incurs the hidden
+ * (and relatively small) cost of creating an Object[] before invoking the method,
+ * even if this logger is disabled for ERROR. The variants taking
+ * {@link #error(String, Object) one} and {@link #error(String, Object, Object) two}
+ * arguments exist solely in order to avoid this hidden cost.
+ *
+ * @param format the format string
+ * @param arguments a list of 3 or more arguments
+ */
+ public void error(String format, Object... arguments);
+
+ /**
+ * Log an exception (throwable) at the ERROR level with an
+ * accompanying message.
+ *
+ * @param msg the message accompanying the exception
+ * @param t the exception (throwable) to log
+ */
+ public void error(String msg, Throwable t);
+
+ /**
+ * Similar to {@link #isErrorEnabled()} method except that the
+ * marker data is also taken into consideration.
+ *
+ * @param marker The marker data to take into consideration
+ * @return True if this Logger is enabled for the ERROR level,
+ * false otherwise.
+ */
+ public boolean isErrorEnabled(Marker marker);
+
+ /**
+ * Log a message with the specific Marker at the ERROR level.
+ *
+ * @param marker The marker specific to this log statement
+ * @param msg the message string to be logged
+ */
+ public void error(Marker marker, String msg);
+
+ /**
+ * This method is similar to {@link #error(String, Object)} method except that the
+ * marker data is also taken into consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arg the argument
+ */
+ public void error(Marker marker, String format, Object arg);
+
+ /**
+ * This method is similar to {@link #error(String, Object, Object)}
+ * method except that the marker data is also taken into
+ * consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arg1 the first argument
+ * @param arg2 the second argument
+ */
+ public void error(Marker marker, String format, Object arg1, Object arg2);
+
+ /**
+ * This method is similar to {@link #error(String, Object...)}
+ * method except that the marker data is also taken into
+ * consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param format the format string
+ * @param arguments a list of 3 or more arguments
+ */
+ public void error(Marker marker, String format, Object... arguments);
+
+ /**
+ * This method is similar to {@link #error(String, Throwable)}
+ * method except that the marker data is also taken into
+ * consideration.
+ *
+ * @param marker the marker data specific to this log statement
+ * @param msg the message accompanying the exception
+ * @param t the exception (throwable) to log
+ */
+ public void error(Marker marker, String msg, Throwable t);
+
+}
diff --git a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
old file mode 100644
new file mode 100755
index c245a70..30b5c72 100755
--- a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
+++ b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
@@ -1,430 +1,430 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.slf4j.event.SubstituteLoggingEvent;
-import org.slf4j.helpers.NOPLoggerFactory;
-import org.slf4j.helpers.SubstituteLogger;
-import org.slf4j.helpers.SubstituteLoggerFactory;
-import org.slf4j.helpers.Util;
-import org.slf4j.impl.StaticLoggerBinder;
-
-/**
- * The LoggerFactory is a utility class producing Loggers for
- * various logging APIs, most notably for log4j, logback and JDK 1.4 logging.
- * Other implementations such as {@link org.slf4j.impl.NOPLogger NOPLogger} and
- * {@link org.slf4j.impl.SimpleLogger SimpleLogger} are also supported.
- *
- *
- * LoggerFactory is essentially a wrapper around an
- * {@link ILoggerFactory} instance bound with LoggerFactory at
- * compile time.
- *
- *
- * Please note that all methods in LoggerFactory are static.
- *
- *
- * @author Alexander Dorokhine
- * @author Robert Elliot
- * @author Ceki Gülcü
- *
- */
-public final class LoggerFactory {
-
- static final String CODES_PREFIX = "http://www.slf4j.org/codes.html";
-
- static final String NO_STATICLOGGERBINDER_URL = CODES_PREFIX + "#StaticLoggerBinder";
- static final String MULTIPLE_BINDINGS_URL = CODES_PREFIX + "#multiple_bindings";
- static final String NULL_LF_URL = CODES_PREFIX + "#null_LF";
- static final String VERSION_MISMATCH = CODES_PREFIX + "#version_mismatch";
- static final String SUBSTITUTE_LOGGER_URL = CODES_PREFIX + "#substituteLogger";
- static final String LOGGER_NAME_MISMATCH_URL = CODES_PREFIX + "#loggerNameMismatch";
- static final String REPLAY_URL = CODES_PREFIX + "#replay";
-
- static final String UNSUCCESSFUL_INIT_URL = CODES_PREFIX + "#unsuccessfulInit";
- static final String UNSUCCESSFUL_INIT_MSG = "org.slf4j.LoggerFactory in failed state. Original exception was thrown EARLIER. See also " + UNSUCCESSFUL_INIT_URL;
-
- static final int UNINITIALIZED = 0;
- static final int ONGOING_INITIALIZATION = 1;
- static final int FAILED_INITIALIZATION = 2;
- static final int SUCCESSFUL_INITIALIZATION = 3;
- static final int NOP_FALLBACK_INITIALIZATION = 4;
-
- static volatile int INITIALIZATION_STATE = UNINITIALIZED;
- static final SubstituteLoggerFactory SUBST_FACTORY = new SubstituteLoggerFactory();
- static final NOPLoggerFactory NOP_FALLBACK_FACTORY = new NOPLoggerFactory();
-
- // Support for detecting mismatched logger names.
- static final String DETECT_LOGGER_NAME_MISMATCH_PROPERTY = "slf4j.detectLoggerNameMismatch";
- static final String JAVA_VENDOR_PROPERTY = "java.vendor.url";
-
- static boolean DETECT_LOGGER_NAME_MISMATCH = Util.safeGetBooleanSystemProperty(DETECT_LOGGER_NAME_MISMATCH_PROPERTY);
-
- /**
- * It is LoggerFactory's responsibility to track version changes and manage
- * the compatibility list.
- *
- *
- * It is assumed that all versions in the 1.6 are mutually compatible.
- */
- static private final String[] API_COMPATIBILITY_LIST = new String[] { "1.6", "1.7" };
-
- // private constructor prevents instantiation
- private LoggerFactory() {
- }
-
- /**
- * Force LoggerFactory to consider itself uninitialized.
- *
- *
- * This method is intended to be called by classes (in the same package) for
- * testing purposes. This method is internal. It can be modified, renamed or
- * removed at any time without notice.
- *
- *
- * You are strongly discouraged from calling this method in production code.
- */
- static void reset() {
- INITIALIZATION_STATE = UNINITIALIZED;
- }
-
- private final static void performInitialization() {
- bind();
- if (INITIALIZATION_STATE == SUCCESSFUL_INITIALIZATION) {
- versionSanityCheck();
- }
- }
-
- private static boolean messageContainsOrgSlf4jImplStaticLoggerBinder(String msg) {
- if (msg == null)
- return false;
- if (msg.contains("org/slf4j/impl/StaticLoggerBinder"))
- return true;
- if (msg.contains("org.slf4j.impl.StaticLoggerBinder"))
- return true;
- return false;
- }
-
- private final static void bind() {
- try {
- Set staticLoggerBinderPathSet = null;
- // skip check under android, see also
- // http://jira.qos.ch/browse/SLF4J-328
- if (!isAndroid()) {
- staticLoggerBinderPathSet = findPossibleStaticLoggerBinderPathSet();
- reportMultipleBindingAmbiguity(staticLoggerBinderPathSet);
- }
- // the next line does the binding
- StaticLoggerBinder.getSingleton();
- INITIALIZATION_STATE = SUCCESSFUL_INITIALIZATION;
- reportActualBinding(staticLoggerBinderPathSet);
- fixSubstituteLoggers();
- replayEvents();
- // release all resources in SUBST_FACTORY
- SUBST_FACTORY.clear();
- } catch (NoClassDefFoundError ncde) {
- String msg = ncde.getMessage();
- if (messageContainsOrgSlf4jImplStaticLoggerBinder(msg)) {
- INITIALIZATION_STATE = NOP_FALLBACK_INITIALIZATION;
- Util.report("Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".");
- Util.report("Defaulting to no-operation (NOP) logger implementation");
- Util.report("See " + NO_STATICLOGGERBINDER_URL + " for further details.");
- } else {
- failedBinding(ncde);
- throw ncde;
- }
- } catch (java.lang.NoSuchMethodError nsme) {
- String msg = nsme.getMessage();
- if (msg != null && msg.contains("org.slf4j.impl.StaticLoggerBinder.getSingleton()")) {
- INITIALIZATION_STATE = FAILED_INITIALIZATION;
- Util.report("slf4j-api 1.6.x (or later) is incompatible with this binding.");
- Util.report("Your binding is version 1.5.5 or earlier.");
- Util.report("Upgrade your binding to version 1.6.x.");
- }
- throw nsme;
- } catch (Exception e) {
- failedBinding(e);
- throw new IllegalStateException("Unexpected initialization failure", e);
- }
- }
-
- private static void fixSubstituteLoggers() {
- synchronized (SUBST_FACTORY) {
- SUBST_FACTORY.postInitialization();
- for (SubstituteLogger substLogger : SUBST_FACTORY.getLoggers()) {
- Logger logger = getLogger(substLogger.getName());
- substLogger.setDelegate(logger);
- }
- }
-
- }
-
- static void failedBinding(Throwable t) {
- INITIALIZATION_STATE = FAILED_INITIALIZATION;
- Util.report("Failed to instantiate SLF4J LoggerFactory", t);
- }
-
- private static void replayEvents() {
- final LinkedBlockingQueue queue = SUBST_FACTORY.getEventQueue();
- final int queueSize = queue.size();
- int count = 0;
- final int maxDrain = 128;
- List eventList = new ArrayList(maxDrain);
- while (true) {
- int numDrained = queue.drainTo(eventList, maxDrain);
- if (numDrained == 0)
- break;
- for (SubstituteLoggingEvent event : eventList) {
- replaySingleEvent(event);
- if (count++ == 0)
- emitReplayOrSubstituionWarning(event, queueSize);
- }
- eventList.clear();
- }
- }
-
- private static void emitReplayOrSubstituionWarning(SubstituteLoggingEvent event, int queueSize) {
- if (event.getLogger().isDelegateEventAware()) {
- emitReplayWarning(queueSize);
- } else if (event.getLogger().isDelegateNOP()) {
- // nothing to do
- } else {
- emitSubstitutionWarning();
- }
- }
-
- private static void replaySingleEvent(SubstituteLoggingEvent event) {
- if (event == null)
- return;
-
- SubstituteLogger substLogger = event.getLogger();
- String loggerName = substLogger.getName();
- if (substLogger.isDelegateNull()) {
- throw new IllegalStateException("Delegate logger cannot be null at this state.");
- }
-
- if (substLogger.isDelegateNOP()) {
- // nothing to do
- } else if (substLogger.isDelegateEventAware()) {
- substLogger.log(event);
- } else {
- Util.report(loggerName);
- }
- }
-
- private static void emitSubstitutionWarning() {
- Util.report("The following set of substitute loggers may have been accessed");
- Util.report("during the initialization phase. Logging calls during this");
- Util.report("phase were not honored. However, subsequent logging calls to these");
- Util.report("loggers will work as normally expected.");
- Util.report("See also " + SUBSTITUTE_LOGGER_URL);
- }
-
- private static void emitReplayWarning(int eventCount) {
- Util.report("A number (" + eventCount + ") of logging calls during the initialization phase have been intercepted and are");
- Util.report("now being replayed. These are subject to the filtering rules of the underlying logging system.");
- Util.report("See also " + REPLAY_URL);
- }
-
- private final static void versionSanityCheck() {
- try {
- String requested = StaticLoggerBinder.REQUESTED_API_VERSION;
-
- boolean match = false;
- for (String aAPI_COMPATIBILITY_LIST : API_COMPATIBILITY_LIST) {
- if (requested.startsWith(aAPI_COMPATIBILITY_LIST)) {
- match = true;
- }
- }
- if (!match) {
- Util.report("The requested version " + requested + " by your slf4j binding is not compatible with "
- + Arrays.asList(API_COMPATIBILITY_LIST).toString());
- Util.report("See " + VERSION_MISMATCH + " for further details.");
- }
- } catch (java.lang.NoSuchFieldError nsfe) {
- // given our large user base and SLF4J's commitment to backward
- // compatibility, we cannot cry here. Only for implementations
- // which willingly declare a REQUESTED_API_VERSION field do we
- // emit compatibility warnings.
- } catch (Throwable e) {
- // we should never reach here
- Util.report("Unexpected problem occured during version sanity check", e);
- }
- }
-
- // We need to use the name of the StaticLoggerBinder class, but we can't
- // reference
- // the class itself.
- private static String STATIC_LOGGER_BINDER_PATH = "org/slf4j/impl/StaticLoggerBinder.class";
-
- static Set findPossibleStaticLoggerBinderPathSet() {
- // use Set instead of list in order to deal with bug #138
- // LinkedHashSet appropriate here because it preserves insertion order
- // during iteration
- Set staticLoggerBinderPathSet = new LinkedHashSet();
- try {
- ClassLoader loggerFactoryClassLoader = LoggerFactory.class.getClassLoader();
- Enumeration paths;
- if (loggerFactoryClassLoader == null) {
- paths = ClassLoader.getSystemResources(STATIC_LOGGER_BINDER_PATH);
- } else {
- paths = loggerFactoryClassLoader.getResources(STATIC_LOGGER_BINDER_PATH);
- }
- while (paths.hasMoreElements()) {
- URL path = paths.nextElement();
- staticLoggerBinderPathSet.add(path);
- }
- } catch (IOException ioe) {
- Util.report("Error getting resources from path", ioe);
- }
- return staticLoggerBinderPathSet;
- }
-
- private static boolean isAmbiguousStaticLoggerBinderPathSet(Set binderPathSet) {
- return binderPathSet.size() > 1;
- }
-
- /**
- * Prints a warning message on the console if multiple bindings were found
- * on the class path. No reporting is done otherwise.
- *
- */
- private static void reportMultipleBindingAmbiguity(Set binderPathSet) {
- if (isAmbiguousStaticLoggerBinderPathSet(binderPathSet)) {
- Util.report("Class path contains multiple SLF4J bindings.");
- for (URL path : binderPathSet) {
- Util.report("Found binding in [" + path + "]");
- }
- Util.report("See " + MULTIPLE_BINDINGS_URL + " for an explanation.");
- }
- }
-
- private static boolean isAndroid() {
- String vendor = Util.safeGetSystemProperty(JAVA_VENDOR_PROPERTY);
- if (vendor == null)
- return false;
- return vendor.toLowerCase().contains("android");
- }
-
- private static void reportActualBinding(Set binderPathSet) {
- // binderPathSet can be null under Android
- if (binderPathSet != null && isAmbiguousStaticLoggerBinderPathSet(binderPathSet)) {
- Util.report("Actual binding is of type [" + StaticLoggerBinder.getSingleton().getLoggerFactoryClassStr() + "]");
- }
- }
-
- /**
- * Return a logger named according to the name parameter using the
- * statically bound {@link ILoggerFactory} instance.
- *
- * @param name
- * The name of the logger.
- * @return logger
- */
- public static Logger getLogger(String name) {
- ILoggerFactory iLoggerFactory = getILoggerFactory();
- return iLoggerFactory.getLogger(name);
- }
-
- /**
- * Return a logger named corresponding to the class passed as parameter,
- * using the statically bound {@link ILoggerFactory} instance.
- *
- *
- * In case the the clazz parameter differs from the name of the
- * caller as computed internally by SLF4J, a logger name mismatch warning
- * will be printed but only if the
- * slf4j.detectLoggerNameMismatch system property is set to
- * true. By default, this property is not set and no warnings will be
- * printed even in case of a logger name mismatch.
- *
- * @param clazz
- * the returned logger will be named after clazz
- * @return logger
- *
- *
- * @see Detected
- * logger name mismatch
- */
- public static Logger getLogger(Class> clazz) {
- Logger logger = getLogger(clazz.getName());
- if (DETECT_LOGGER_NAME_MISMATCH) {
- Class> autoComputedCallingClass = Util.getCallingClass();
- if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
- Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),
- autoComputedCallingClass.getName()));
- Util.report("See " + LOGGER_NAME_MISMATCH_URL + " for an explanation");
- }
- }
- return logger;
- }
-
- private static boolean nonMatchingClasses(Class> clazz, Class> autoComputedCallingClass) {
- return !autoComputedCallingClass.isAssignableFrom(clazz);
- }
-
- /**
- * Return the {@link ILoggerFactory} instance in use.
- *
- *
- * ILoggerFactory instance is bound with this class at compile time.
- *
- * @return the ILoggerFactory instance in use
- */
- public static ILoggerFactory getILoggerFactory() {
- if (INITIALIZATION_STATE == UNINITIALIZED) {
- synchronized (LoggerFactory.class) {
- if (INITIALIZATION_STATE == UNINITIALIZED) {
- INITIALIZATION_STATE = ONGOING_INITIALIZATION;
- performInitialization();
- }
- }
- }
- switch (INITIALIZATION_STATE) {
- case SUCCESSFUL_INITIALIZATION:
- return StaticLoggerBinder.getSingleton().getLoggerFactory();
- case NOP_FALLBACK_INITIALIZATION:
- return NOP_FALLBACK_FACTORY;
- case FAILED_INITIALIZATION:
- throw new IllegalStateException(UNSUCCESSFUL_INIT_MSG);
- case ONGOING_INITIALIZATION:
- // support re-entrant behavior.
- // See also http://jira.qos.ch/browse/SLF4J-97
- return SUBST_FACTORY;
- }
- throw new IllegalStateException("Unreachable code");
- }
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.slf4j.event.SubstituteLoggingEvent;
+import org.slf4j.helpers.NOPLoggerFactory;
+import org.slf4j.helpers.SubstituteLogger;
+import org.slf4j.helpers.SubstituteLoggerFactory;
+import org.slf4j.helpers.Util;
+import org.slf4j.impl.StaticLoggerBinder;
+
+/**
+ * The LoggerFactory is a utility class producing Loggers for
+ * various logging APIs, most notably for log4j, logback and JDK 1.4 logging.
+ * Other implementations such as {@link org.slf4j.impl.NOPLogger NOPLogger} and
+ * {@link org.slf4j.impl.SimpleLogger SimpleLogger} are also supported.
+ *
+ *
+ * LoggerFactory is essentially a wrapper around an
+ * {@link ILoggerFactory} instance bound with LoggerFactory at
+ * compile time.
+ *
+ *
+ * Please note that all methods in LoggerFactory are static.
+ *
+ *
+ * @author Alexander Dorokhine
+ * @author Robert Elliot
+ * @author Ceki Gülcü
+ *
+ */
+public final class LoggerFactory {
+
+ static final String CODES_PREFIX = "http://www.slf4j.org/codes.html";
+
+ static final String NO_STATICLOGGERBINDER_URL = CODES_PREFIX + "#StaticLoggerBinder";
+ static final String MULTIPLE_BINDINGS_URL = CODES_PREFIX + "#multiple_bindings";
+ static final String NULL_LF_URL = CODES_PREFIX + "#null_LF";
+ static final String VERSION_MISMATCH = CODES_PREFIX + "#version_mismatch";
+ static final String SUBSTITUTE_LOGGER_URL = CODES_PREFIX + "#substituteLogger";
+ static final String LOGGER_NAME_MISMATCH_URL = CODES_PREFIX + "#loggerNameMismatch";
+ static final String REPLAY_URL = CODES_PREFIX + "#replay";
+
+ static final String UNSUCCESSFUL_INIT_URL = CODES_PREFIX + "#unsuccessfulInit";
+ static final String UNSUCCESSFUL_INIT_MSG = "org.slf4j.LoggerFactory in failed state. Original exception was thrown EARLIER. See also " + UNSUCCESSFUL_INIT_URL;
+
+ static final int UNINITIALIZED = 0;
+ static final int ONGOING_INITIALIZATION = 1;
+ static final int FAILED_INITIALIZATION = 2;
+ static final int SUCCESSFUL_INITIALIZATION = 3;
+ static final int NOP_FALLBACK_INITIALIZATION = 4;
+
+ static volatile int INITIALIZATION_STATE = UNINITIALIZED;
+ static final SubstituteLoggerFactory SUBST_FACTORY = new SubstituteLoggerFactory();
+ static final NOPLoggerFactory NOP_FALLBACK_FACTORY = new NOPLoggerFactory();
+
+ // Support for detecting mismatched logger names.
+ static final String DETECT_LOGGER_NAME_MISMATCH_PROPERTY = "slf4j.detectLoggerNameMismatch";
+ static final String JAVA_VENDOR_PROPERTY = "java.vendor.url";
+
+ static boolean DETECT_LOGGER_NAME_MISMATCH = Util.safeGetBooleanSystemProperty(DETECT_LOGGER_NAME_MISMATCH_PROPERTY);
+
+ /**
+ * It is LoggerFactory's responsibility to track version changes and manage
+ * the compatibility list.
+ *
+ *
+ * It is assumed that all versions in the 1.6 are mutually compatible.
+ */
+ static private final String[] API_COMPATIBILITY_LIST = new String[] { "1.6", "1.7" };
+
+ // private constructor prevents instantiation
+ private LoggerFactory() {
+ }
+
+ /**
+ * Force LoggerFactory to consider itself uninitialized.
+ *
+ *
+ * This method is intended to be called by classes (in the same package) for
+ * testing purposes. This method is internal. It can be modified, renamed or
+ * removed at any time without notice.
+ *
+ *
+ * You are strongly discouraged from calling this method in production code.
+ */
+ static void reset() {
+ INITIALIZATION_STATE = UNINITIALIZED;
+ }
+
+ private final static void performInitialization() {
+ bind();
+ if (INITIALIZATION_STATE == SUCCESSFUL_INITIALIZATION) {
+ versionSanityCheck();
+ }
+ }
+
+ private static boolean messageContainsOrgSlf4jImplStaticLoggerBinder(String msg) {
+ if (msg == null)
+ return false;
+ if (msg.contains("org/slf4j/impl/StaticLoggerBinder"))
+ return true;
+ if (msg.contains("org.slf4j.impl.StaticLoggerBinder"))
+ return true;
+ return false;
+ }
+
+ private final static void bind() {
+ try {
+ Set staticLoggerBinderPathSet = null;
+ // skip check under android, see also
+ // http://jira.qos.ch/browse/SLF4J-328
+ if (!isAndroid()) {
+ staticLoggerBinderPathSet = findPossibleStaticLoggerBinderPathSet();
+ reportMultipleBindingAmbiguity(staticLoggerBinderPathSet);
+ }
+ // the next line does the binding
+ StaticLoggerBinder.getSingleton();
+ INITIALIZATION_STATE = SUCCESSFUL_INITIALIZATION;
+ reportActualBinding(staticLoggerBinderPathSet);
+ fixSubstituteLoggers();
+ replayEvents();
+ // release all resources in SUBST_FACTORY
+ SUBST_FACTORY.clear();
+ } catch (NoClassDefFoundError ncde) {
+ String msg = ncde.getMessage();
+ if (messageContainsOrgSlf4jImplStaticLoggerBinder(msg)) {
+ INITIALIZATION_STATE = NOP_FALLBACK_INITIALIZATION;
+ Util.report("Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".");
+ Util.report("Defaulting to no-operation (NOP) logger implementation");
+ Util.report("See " + NO_STATICLOGGERBINDER_URL + " for further details.");
+ } else {
+ failedBinding(ncde);
+ throw ncde;
+ }
+ } catch (java.lang.NoSuchMethodError nsme) {
+ String msg = nsme.getMessage();
+ if (msg != null && msg.contains("org.slf4j.impl.StaticLoggerBinder.getSingleton()")) {
+ INITIALIZATION_STATE = FAILED_INITIALIZATION;
+ Util.report("slf4j-api 1.6.x (or later) is incompatible with this binding.");
+ Util.report("Your binding is version 1.5.5 or earlier.");
+ Util.report("Upgrade your binding to version 1.6.x.");
+ }
+ throw nsme;
+ } catch (Exception e) {
+ failedBinding(e);
+ throw new IllegalStateException("Unexpected initialization failure", e);
+ }
+ }
+
+ private static void fixSubstituteLoggers() {
+ synchronized (SUBST_FACTORY) {
+ SUBST_FACTORY.postInitialization();
+ for (SubstituteLogger substLogger : SUBST_FACTORY.getLoggers()) {
+ Logger logger = getLogger(substLogger.getName());
+ substLogger.setDelegate(logger);
+ }
+ }
+
+ }
+
+ static void failedBinding(Throwable t) {
+ INITIALIZATION_STATE = FAILED_INITIALIZATION;
+ Util.report("Failed to instantiate SLF4J LoggerFactory", t);
+ }
+
+ private static void replayEvents() {
+ final LinkedBlockingQueue queue = SUBST_FACTORY.getEventQueue();
+ final int queueSize = queue.size();
+ int count = 0;
+ final int maxDrain = 128;
+ List eventList = new ArrayList(maxDrain);
+ while (true) {
+ int numDrained = queue.drainTo(eventList, maxDrain);
+ if (numDrained == 0)
+ break;
+ for (SubstituteLoggingEvent event : eventList) {
+ replaySingleEvent(event);
+ if (count++ == 0)
+ emitReplayOrSubstituionWarning(event, queueSize);
+ }
+ eventList.clear();
+ }
+ }
+
+ private static void emitReplayOrSubstituionWarning(SubstituteLoggingEvent event, int queueSize) {
+ if (event.getLogger().isDelegateEventAware()) {
+ emitReplayWarning(queueSize);
+ } else if (event.getLogger().isDelegateNOP()) {
+ // nothing to do
+ } else {
+ emitSubstitutionWarning();
+ }
+ }
+
+ private static void replaySingleEvent(SubstituteLoggingEvent event) {
+ if (event == null)
+ return;
+
+ SubstituteLogger substLogger = event.getLogger();
+ String loggerName = substLogger.getName();
+ if (substLogger.isDelegateNull()) {
+ throw new IllegalStateException("Delegate logger cannot be null at this state.");
+ }
+
+ if (substLogger.isDelegateNOP()) {
+ // nothing to do
+ } else if (substLogger.isDelegateEventAware()) {
+ substLogger.log(event);
+ } else {
+ Util.report(loggerName);
+ }
+ }
+
+ private static void emitSubstitutionWarning() {
+ Util.report("The following set of substitute loggers may have been accessed");
+ Util.report("during the initialization phase. Logging calls during this");
+ Util.report("phase were not honored. However, subsequent logging calls to these");
+ Util.report("loggers will work as normally expected.");
+ Util.report("See also " + SUBSTITUTE_LOGGER_URL);
+ }
+
+ private static void emitReplayWarning(int eventCount) {
+ Util.report("A number (" + eventCount + ") of logging calls during the initialization phase have been intercepted and are");
+ Util.report("now being replayed. These are subject to the filtering rules of the underlying logging system.");
+ Util.report("See also " + REPLAY_URL);
+ }
+
+ private final static void versionSanityCheck() {
+ try {
+ String requested = StaticLoggerBinder.REQUESTED_API_VERSION;
+
+ boolean match = false;
+ for (String aAPI_COMPATIBILITY_LIST : API_COMPATIBILITY_LIST) {
+ if (requested.startsWith(aAPI_COMPATIBILITY_LIST)) {
+ match = true;
+ }
+ }
+ if (!match) {
+ Util.report("The requested version " + requested + " by your slf4j binding is not compatible with "
+ + Arrays.asList(API_COMPATIBILITY_LIST).toString());
+ Util.report("See " + VERSION_MISMATCH + " for further details.");
+ }
+ } catch (java.lang.NoSuchFieldError nsfe) {
+ // given our large user base and SLF4J's commitment to backward
+ // compatibility, we cannot cry here. Only for implementations
+ // which willingly declare a REQUESTED_API_VERSION field do we
+ // emit compatibility warnings.
+ } catch (Throwable e) {
+ // we should never reach here
+ Util.report("Unexpected problem occured during version sanity check", e);
+ }
+ }
+
+ // We need to use the name of the StaticLoggerBinder class, but we can't
+ // reference
+ // the class itself.
+ private static String STATIC_LOGGER_BINDER_PATH = "org/slf4j/impl/StaticLoggerBinder.class";
+
+ static Set findPossibleStaticLoggerBinderPathSet() {
+ // use Set instead of list in order to deal with bug #138
+ // LinkedHashSet appropriate here because it preserves insertion order
+ // during iteration
+ Set staticLoggerBinderPathSet = new LinkedHashSet();
+ try {
+ ClassLoader loggerFactoryClassLoader = LoggerFactory.class.getClassLoader();
+ Enumeration paths;
+ if (loggerFactoryClassLoader == null) {
+ paths = ClassLoader.getSystemResources(STATIC_LOGGER_BINDER_PATH);
+ } else {
+ paths = loggerFactoryClassLoader.getResources(STATIC_LOGGER_BINDER_PATH);
+ }
+ while (paths.hasMoreElements()) {
+ URL path = paths.nextElement();
+ staticLoggerBinderPathSet.add(path);
+ }
+ } catch (IOException ioe) {
+ Util.report("Error getting resources from path", ioe);
+ }
+ return staticLoggerBinderPathSet;
+ }
+
+ private static boolean isAmbiguousStaticLoggerBinderPathSet(Set binderPathSet) {
+ return binderPathSet.size() > 1;
+ }
+
+ /**
+ * Prints a warning message on the console if multiple bindings were found
+ * on the class path. No reporting is done otherwise.
+ *
+ */
+ private static void reportMultipleBindingAmbiguity(Set binderPathSet) {
+ if (isAmbiguousStaticLoggerBinderPathSet(binderPathSet)) {
+ Util.report("Class path contains multiple SLF4J bindings.");
+ for (URL path : binderPathSet) {
+ Util.report("Found binding in [" + path + "]");
+ }
+ Util.report("See " + MULTIPLE_BINDINGS_URL + " for an explanation.");
+ }
+ }
+
+ private static boolean isAndroid() {
+ String vendor = Util.safeGetSystemProperty(JAVA_VENDOR_PROPERTY);
+ if (vendor == null)
+ return false;
+ return vendor.toLowerCase().contains("android");
+ }
+
+ private static void reportActualBinding(Set binderPathSet) {
+ // binderPathSet can be null under Android
+ if (binderPathSet != null && isAmbiguousStaticLoggerBinderPathSet(binderPathSet)) {
+ Util.report("Actual binding is of type [" + StaticLoggerBinder.getSingleton().getLoggerFactoryClassStr() + "]");
+ }
+ }
+
+ /**
+ * Return a logger named according to the name parameter using the
+ * statically bound {@link ILoggerFactory} instance.
+ *
+ * @param name
+ * The name of the logger.
+ * @return logger
+ */
+ public static Logger getLogger(String name) {
+ ILoggerFactory iLoggerFactory = getILoggerFactory();
+ return iLoggerFactory.getLogger(name);
+ }
+
+ /**
+ * Return a logger named corresponding to the class passed as parameter,
+ * using the statically bound {@link ILoggerFactory} instance.
+ *
+ *
+ * In case the the clazz parameter differs from the name of the
+ * caller as computed internally by SLF4J, a logger name mismatch warning
+ * will be printed but only if the
+ * slf4j.detectLoggerNameMismatch system property is set to
+ * true. By default, this property is not set and no warnings will be
+ * printed even in case of a logger name mismatch.
+ *
+ * @param clazz
+ * the returned logger will be named after clazz
+ * @return logger
+ *
+ *
+ * @see Detected
+ * logger name mismatch
+ */
+ public static Logger getLogger(Class> clazz) {
+ Logger logger = getLogger(clazz.getName());
+ if (DETECT_LOGGER_NAME_MISMATCH) {
+ Class> autoComputedCallingClass = Util.getCallingClass();
+ if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
+ Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),
+ autoComputedCallingClass.getName()));
+ Util.report("See " + LOGGER_NAME_MISMATCH_URL + " for an explanation");
+ }
+ }
+ return logger;
+ }
+
+ private static boolean nonMatchingClasses(Class> clazz, Class> autoComputedCallingClass) {
+ return !autoComputedCallingClass.isAssignableFrom(clazz);
+ }
+
+ /**
+ * Return the {@link ILoggerFactory} instance in use.
+ *
+ *
+ * ILoggerFactory instance is bound with this class at compile time.
+ *
+ * @return the ILoggerFactory instance in use
+ */
+ public static ILoggerFactory getILoggerFactory() {
+ if (INITIALIZATION_STATE == UNINITIALIZED) {
+ synchronized (LoggerFactory.class) {
+ if (INITIALIZATION_STATE == UNINITIALIZED) {
+ INITIALIZATION_STATE = ONGOING_INITIALIZATION;
+ performInitialization();
+ }
+ }
+ }
+ switch (INITIALIZATION_STATE) {
+ case SUCCESSFUL_INITIALIZATION:
+ return StaticLoggerBinder.getSingleton().getLoggerFactory();
+ case NOP_FALLBACK_INITIALIZATION:
+ return NOP_FALLBACK_FACTORY;
+ case FAILED_INITIALIZATION:
+ throw new IllegalStateException(UNSUCCESSFUL_INIT_MSG);
+ case ONGOING_INITIALIZATION:
+ // support re-entrant behavior.
+ // See also http://jira.qos.ch/browse/SLF4J-97
+ return SUBST_FACTORY;
+ }
+ throw new IllegalStateException("Unreachable code");
+ }
+}
diff --git a/slf4j-api/src/main/java/org/slf4j/MDC.java b/slf4j-api/src/main/java/org/slf4j/MDC.java
index 3136f4d..71d761d 100644
--- a/slf4j-api/src/main/java/org/slf4j/MDC.java
+++ b/slf4j-api/src/main/java/org/slf4j/MDC.java
@@ -1,277 +1,277 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j;
-
-import java.io.Closeable;
-import java.util.Map;
-
-import org.slf4j.helpers.NOPMDCAdapter;
-import org.slf4j.helpers.BasicMDCAdapter;
-import org.slf4j.helpers.Util;
-import org.slf4j.impl.StaticMDCBinder;
-import org.slf4j.spi.MDCAdapter;
-
-/**
- * This class hides and serves as a substitute for the underlying logging
- * system's MDC implementation.
- *
- *
- * If the underlying logging system offers MDC functionality, then SLF4J's MDC,
- * i.e. this class, will delegate to the underlying system's MDC. Note that at
- * this time, only two logging systems, namely log4j and logback, offer MDC
- * functionality. For java.util.logging which does not support MDC,
- * {@link BasicMDCAdapter} will be used. For other systems, i.e. slf4j-simple
- * and slf4j-nop, {@link NOPMDCAdapter} will be used.
- *
- *
- * Thus, as a SLF4J user, you can take advantage of MDC in the presence of log4j,
- * logback, or java.util.logging, but without forcing these systems as
- * dependencies upon your users.
- *
- *
- * For more information on MDC please see the chapter on MDC in the
- * logback manual.
- *
- *
- * Please note that all methods in this class are static.
- *
- * @author Ceki Gülcü
- * @since 1.4.1
- */
-public class MDC {
-
- static final String NULL_MDCA_URL = "http://www.slf4j.org/codes.html#null_MDCA";
- static final String NO_STATIC_MDC_BINDER_URL = "http://www.slf4j.org/codes.html#no_static_mdc_binder";
- static MDCAdapter mdcAdapter;
-
- /**
- * An adapter to remove the key when done.
- */
- public static class MDCCloseable implements Closeable {
- private final String key;
-
- private MDCCloseable(String key) {
- this.key = key;
- }
-
- public void close() {
- MDC.remove(this.key);
- }
- }
-
- private MDC() {
- }
-
- /**
- * As of SLF4J version 1.7.14, StaticMDCBinder classes shipping in various bindings
- * come with a getSingleton() method. Previously only a public field called SINGLETON
- * was available.
- *
- * @return MDCAdapter
- * @throws NoClassDefFoundError in case no binding is available
- * @since 1.7.14
- */
- private static MDCAdapter bwCompatibleGetMDCAdapterFromBinder() throws NoClassDefFoundError {
- try {
- return StaticMDCBinder.getSingleton().getMDCA();
- } catch (NoSuchMethodError nsme) {
- // binding is probably a version of SLF4J older than 1.7.14
- return StaticMDCBinder.SINGLETON.getMDCA();
- }
- }
-
- static {
- try {
- mdcAdapter = bwCompatibleGetMDCAdapterFromBinder();
- } catch (NoClassDefFoundError ncde) {
- mdcAdapter = new NOPMDCAdapter();
- String msg = ncde.getMessage();
- if (msg != null && msg.contains("StaticMDCBinder")) {
- Util.report("Failed to load class \"org.slf4j.impl.StaticMDCBinder\".");
- Util.report("Defaulting to no-operation MDCAdapter implementation.");
- Util.report("See " + NO_STATIC_MDC_BINDER_URL + " for further details.");
- } else {
- throw ncde;
- }
- } catch (Exception e) {
- // we should never get here
- Util.report("MDC binding unsuccessful.", e);
- }
- }
-
- /**
- * Put a diagnostic context value (the val parameter) as identified with the
- * key parameter into the current thread's diagnostic context map. The
- * key parameter cannot be null. The val parameter
- * can be null only if the underlying implementation supports it.
- *
- *
- * This method delegates all work to the MDC of the underlying logging system.
- *
- * @param key non-null key
- * @param val value to put in the map
- *
- * @throws IllegalArgumentException
- * in case the "key" parameter is null
- */
- public static void put(String key, String val) throws IllegalArgumentException {
- if (key == null) {
- throw new IllegalArgumentException("key parameter cannot be null");
- }
- if (mdcAdapter == null) {
- throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
- }
- mdcAdapter.put(key, val);
- }
-
- /**
- * Put a diagnostic context value (the val parameter) as identified with the
- * key parameter into the current thread's diagnostic context map. The
- * key parameter cannot be null. The val parameter
- * can be null only if the underlying implementation supports it.
- *
- *
- * This method delegates all work to the MDC of the underlying logging system.
- *
- * This method return a Closeable object who can remove key when
- * close is called.
- *
- *
- * Useful with Java 7 for example :
- *
- * try(MDC.MDCCloseable closeable = MDC.putCloseable(key, value)) {
- * ....
- * }
- *
- *
- * @param key non-null key
- * @param val value to put in the map
- * @return a Closeable who can remove key when close
- * is called.
- *
- * @throws IllegalArgumentException
- * in case the "key" parameter is null
- */
- public static MDCCloseable putCloseable(String key, String val) throws IllegalArgumentException {
- put(key, val);
- return new MDCCloseable(key);
- }
-
- /**
- * Get the diagnostic context identified by the key parameter. The
- * key parameter cannot be null.
- *
- *
- * This method delegates all work to the MDC of the underlying logging system.
- *
- * @param key
- * @return the string value identified by the key parameter.
- * @throws IllegalArgumentException
- * in case the "key" parameter is null
- */
- public static String get(String key) throws IllegalArgumentException {
- if (key == null) {
- throw new IllegalArgumentException("key parameter cannot be null");
- }
-
- if (mdcAdapter == null) {
- throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
- }
- return mdcAdapter.get(key);
- }
-
- /**
- * Remove the diagnostic context identified by the key parameter using
- * the underlying system's MDC implementation. The key parameter
- * cannot be null. This method does nothing if there is no previous value
- * associated with key.
- *
- * @param key
- * @throws IllegalArgumentException
- * in case the "key" parameter is null
- */
- public static void remove(String key) throws IllegalArgumentException {
- if (key == null) {
- throw new IllegalArgumentException("key parameter cannot be null");
- }
-
- if (mdcAdapter == null) {
- throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
- }
- mdcAdapter.remove(key);
- }
-
- /**
- * Clear all entries in the MDC of the underlying implementation.
- */
- public static void clear() {
- if (mdcAdapter == null) {
- throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
- }
- mdcAdapter.clear();
- }
-
- /**
- * Return a copy of the current thread's context map, with keys and values of
- * type String. Returned value may be null.
- *
- * @return A copy of the current thread's context map. May be null.
- * @since 1.5.1
- */
- public static Map getCopyOfContextMap() {
- if (mdcAdapter == null) {
- throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
- }
- return mdcAdapter.getCopyOfContextMap();
- }
-
- /**
- * Set the current thread's context map by first clearing any existing map and
- * then copying the map passed as parameter. The context map passed as
- * parameter must only contain keys and values of type String.
- *
- * @param contextMap
- * must contain only keys and values of type String
- * @since 1.5.1
- */
- public static void setContextMap(Map contextMap) {
- if (mdcAdapter == null) {
- throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
- }
- mdcAdapter.setContextMap(contextMap);
- }
-
- /**
- * Returns the MDCAdapter instance currently in use.
- *
- * @return the MDcAdapter instance currently in use.
- * @since 1.4.2
- */
- public static MDCAdapter getMDCAdapter() {
- return mdcAdapter;
- }
-
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j;
+
+import java.io.Closeable;
+import java.util.Map;
+
+import org.slf4j.helpers.NOPMDCAdapter;
+import org.slf4j.helpers.BasicMDCAdapter;
+import org.slf4j.helpers.Util;
+import org.slf4j.impl.StaticMDCBinder;
+import org.slf4j.spi.MDCAdapter;
+
+/**
+ * This class hides and serves as a substitute for the underlying logging
+ * system's MDC implementation.
+ *
+ *
+ * If the underlying logging system offers MDC functionality, then SLF4J's MDC,
+ * i.e. this class, will delegate to the underlying system's MDC. Note that at
+ * this time, only two logging systems, namely log4j and logback, offer MDC
+ * functionality. For java.util.logging which does not support MDC,
+ * {@link BasicMDCAdapter} will be used. For other systems, i.e. slf4j-simple
+ * and slf4j-nop, {@link NOPMDCAdapter} will be used.
+ *
+ *
+ * Thus, as a SLF4J user, you can take advantage of MDC in the presence of log4j,
+ * logback, or java.util.logging, but without forcing these systems as
+ * dependencies upon your users.
+ *
+ *
+ * For more information on MDC please see the chapter on MDC in the
+ * logback manual.
+ *
+ *
+ * Please note that all methods in this class are static.
+ *
+ * @author Ceki Gülcü
+ * @since 1.4.1
+ */
+public class MDC {
+
+ static final String NULL_MDCA_URL = "http://www.slf4j.org/codes.html#null_MDCA";
+ static final String NO_STATIC_MDC_BINDER_URL = "http://www.slf4j.org/codes.html#no_static_mdc_binder";
+ static MDCAdapter mdcAdapter;
+
+ /**
+ * An adapter to remove the key when done.
+ */
+ public static class MDCCloseable implements Closeable {
+ private final String key;
+
+ private MDCCloseable(String key) {
+ this.key = key;
+ }
+
+ public void close() {
+ MDC.remove(this.key);
+ }
+ }
+
+ private MDC() {
+ }
+
+ /**
+ * As of SLF4J version 1.7.14, StaticMDCBinder classes shipping in various bindings
+ * come with a getSingleton() method. Previously only a public field called SINGLETON
+ * was available.
+ *
+ * @return MDCAdapter
+ * @throws NoClassDefFoundError in case no binding is available
+ * @since 1.7.14
+ */
+ private static MDCAdapter bwCompatibleGetMDCAdapterFromBinder() throws NoClassDefFoundError {
+ try {
+ return StaticMDCBinder.getSingleton().getMDCA();
+ } catch (NoSuchMethodError nsme) {
+ // binding is probably a version of SLF4J older than 1.7.14
+ return StaticMDCBinder.SINGLETON.getMDCA();
+ }
+ }
+
+ static {
+ try {
+ mdcAdapter = bwCompatibleGetMDCAdapterFromBinder();
+ } catch (NoClassDefFoundError ncde) {
+ mdcAdapter = new NOPMDCAdapter();
+ String msg = ncde.getMessage();
+ if (msg != null && msg.contains("StaticMDCBinder")) {
+ Util.report("Failed to load class \"org.slf4j.impl.StaticMDCBinder\".");
+ Util.report("Defaulting to no-operation MDCAdapter implementation.");
+ Util.report("See " + NO_STATIC_MDC_BINDER_URL + " for further details.");
+ } else {
+ throw ncde;
+ }
+ } catch (Exception e) {
+ // we should never get here
+ Util.report("MDC binding unsuccessful.", e);
+ }
+ }
+
+ /**
+ * Put a diagnostic context value (the val parameter) as identified with the
+ * key parameter into the current thread's diagnostic context map. The
+ * key parameter cannot be null. The val parameter
+ * can be null only if the underlying implementation supports it.
+ *
+ *
+ * This method delegates all work to the MDC of the underlying logging system.
+ *
+ * @param key non-null key
+ * @param val value to put in the map
+ *
+ * @throws IllegalArgumentException
+ * in case the "key" parameter is null
+ */
+ public static void put(String key, String val) throws IllegalArgumentException {
+ if (key == null) {
+ throw new IllegalArgumentException("key parameter cannot be null");
+ }
+ if (mdcAdapter == null) {
+ throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
+ }
+ mdcAdapter.put(key, val);
+ }
+
+ /**
+ * Put a diagnostic context value (the val parameter) as identified with the
+ * key parameter into the current thread's diagnostic context map. The
+ * key parameter cannot be null. The val parameter
+ * can be null only if the underlying implementation supports it.
+ *
+ *
+ * This method delegates all work to the MDC of the underlying logging system.
+ *
+ * This method return a Closeable object who can remove key when
+ * close is called.
+ *
+ *
+ * Useful with Java 7 for example :
+ *
+ * try(MDC.MDCCloseable closeable = MDC.putCloseable(key, value)) {
+ * ....
+ * }
+ *
+ *
+ * @param key non-null key
+ * @param val value to put in the map
+ * @return a Closeable who can remove key when close
+ * is called.
+ *
+ * @throws IllegalArgumentException
+ * in case the "key" parameter is null
+ */
+ public static MDCCloseable putCloseable(String key, String val) throws IllegalArgumentException {
+ put(key, val);
+ return new MDCCloseable(key);
+ }
+
+ /**
+ * Get the diagnostic context identified by the key parameter. The
+ * key parameter cannot be null.
+ *
+ *
+ * This method delegates all work to the MDC of the underlying logging system.
+ *
+ * @param key
+ * @return the string value identified by the key parameter.
+ * @throws IllegalArgumentException
+ * in case the "key" parameter is null
+ */
+ public static String get(String key) throws IllegalArgumentException {
+ if (key == null) {
+ throw new IllegalArgumentException("key parameter cannot be null");
+ }
+
+ if (mdcAdapter == null) {
+ throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
+ }
+ return mdcAdapter.get(key);
+ }
+
+ /**
+ * Remove the diagnostic context identified by the key parameter using
+ * the underlying system's MDC implementation. The key parameter
+ * cannot be null. This method does nothing if there is no previous value
+ * associated with key.
+ *
+ * @param key
+ * @throws IllegalArgumentException
+ * in case the "key" parameter is null
+ */
+ public static void remove(String key) throws IllegalArgumentException {
+ if (key == null) {
+ throw new IllegalArgumentException("key parameter cannot be null");
+ }
+
+ if (mdcAdapter == null) {
+ throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
+ }
+ mdcAdapter.remove(key);
+ }
+
+ /**
+ * Clear all entries in the MDC of the underlying implementation.
+ */
+ public static void clear() {
+ if (mdcAdapter == null) {
+ throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
+ }
+ mdcAdapter.clear();
+ }
+
+ /**
+ * Return a copy of the current thread's context map, with keys and values of
+ * type String. Returned value may be null.
+ *
+ * @return A copy of the current thread's context map. May be null.
+ * @since 1.5.1
+ */
+ public static Map getCopyOfContextMap() {
+ if (mdcAdapter == null) {
+ throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
+ }
+ return mdcAdapter.getCopyOfContextMap();
+ }
+
+ /**
+ * Set the current thread's context map by first clearing any existing map and
+ * then copying the map passed as parameter. The context map passed as
+ * parameter must only contain keys and values of type String.
+ *
+ * @param contextMap
+ * must contain only keys and values of type String
+ * @since 1.5.1
+ */
+ public static void setContextMap(Map contextMap) {
+ if (mdcAdapter == null) {
+ throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
+ }
+ mdcAdapter.setContextMap(contextMap);
+ }
+
+ /**
+ * Returns the MDCAdapter instance currently in use.
+ *
+ * @return the MDcAdapter instance currently in use.
+ * @since 1.4.2
+ */
+ public static MDCAdapter getMDCAdapter() {
+ return mdcAdapter;
+ }
+
+}
diff --git a/slf4j-api/src/main/java/org/slf4j/Marker.java b/slf4j-api/src/main/java/org/slf4j/Marker.java
index a6bd514..c6bfd5e 100644
--- a/slf4j-api/src/main/java/org/slf4j/Marker.java
+++ b/slf4j-api/src/main/java/org/slf4j/Marker.java
@@ -1,142 +1,142 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j;
-
-import java.io.Serializable;
-import java.util.Iterator;
-
-/**
- * Markers are named objects used to enrich log statements. Conforming logging
- * system Implementations of SLF4J determine how information conveyed by markers
- * are used, if at all. In particular, many conforming logging systems ignore
- * marker data.
- *
- *
- * Markers can contain references to other markers, which in turn may contain
- * references of their own.
- *
- * @author Ceki Gülcü
- */
-public interface Marker extends Serializable {
-
- /**
- * This constant represents any marker, including a null marker.
- */
- public final String ANY_MARKER = "*";
-
- /**
- * This constant represents any non-null marker.
- */
- public final String ANY_NON_NULL_MARKER = "+";
-
- /**
- * Get the name of this Marker.
- *
- * @return name of marker
- */
- public String getName();
-
- /**
- * Add a reference to another Marker.
- *
- * @param reference
- * a reference to another marker
- * @throws IllegalArgumentException
- * if 'reference' is null
- */
- public void add(Marker reference);
-
- /**
- * Remove a marker reference.
- *
- * @param reference
- * the marker reference to remove
- * @return true if reference could be found and removed, false otherwise.
- */
- public boolean remove(Marker reference);
-
- /**
- * @deprecated Replaced by {@link #hasReferences()}.
- */
- public boolean hasChildren();
-
- /**
- * Does this marker have any references?
- *
- * @return true if this marker has one or more references, false otherwise.
- */
- public boolean hasReferences();
-
- /**
- * Returns an Iterator which can be used to iterate over the references of this
- * marker. An empty iterator is returned when this marker has no references.
- *
- * @return Iterator over the references of this marker
- */
- public Iterator iterator();
-
- /**
- * Does this marker contain a reference to the 'other' marker? Marker A is defined
- * to contain marker B, if A == B or if B is referenced by A, or if B is referenced
- * by any one of A's references (recursively).
- *
- * @param other
- * The marker to test for inclusion.
- * @throws IllegalArgumentException
- * if 'other' is null
- * @return Whether this marker contains the other marker.
- */
- public boolean contains(Marker other);
-
- /**
- * Does this marker contain the marker named 'name'?
- *
- * If 'name' is null the returned value is always false.
- *
- * @param name The marker name to test for inclusion.
- * @return Whether this marker contains the other marker.
- */
- public boolean contains(String name);
-
- /**
- * Markers are considered equal if they have the same name.
- *
- * @param o
- * @return true, if this.name equals o.name
- *
- * @since 1.5.1
- */
- public boolean equals(Object o);
-
- /**
- * Compute the hash code based on the name of this marker.
- * Note that markers are considered equal if they have the same name.
- *
- * @return the computed hashCode
- * @since 1.5.1
- */
- public int hashCode();
-
-}
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j;
+
+import java.io.Serializable;
+import java.util.Iterator;
+
+/**
+ * Markers are named objects used to enrich log statements. Conforming logging
+ * system Implementations of SLF4J determine how information conveyed by markers
+ * are used, if at all. In particular, many conforming logging systems ignore
+ * marker data.
+ *
+ *
+ * Markers can contain references to other markers, which in turn may contain
+ * references of their own.
+ *
+ * @author Ceki Gülcü
+ */
+public interface Marker extends Serializable {
+
+ /**
+ * This constant represents any marker, including a null marker.
+ */
+ public final String ANY_MARKER = "*";
+
+ /**
+ * This constant represents any non-null marker.
+ */
+ public final String ANY_NON_NULL_MARKER = "+";
+
+ /**
+ * Get the name of this Marker.
+ *
+ * @return name of marker
+ */
+ public String getName();
+
+ /**
+ * Add a reference to another Marker.
+ *
+ * @param reference
+ * a reference to another marker
+ * @throws IllegalArgumentException
+ * if 'reference' is null
+ */
+ public void add(Marker reference);
+
+ /**
+ * Remove a marker reference.
+ *
+ * @param reference
+ * the marker reference to remove
+ * @return true if reference could be found and removed, false otherwise.
+ */
+ public boolean remove(Marker reference);
+
+ /**
+ * @deprecated Replaced by {@link #hasReferences()}.
+ */
+ public boolean hasChildren();
+
+ /**
+ * Does this marker have any references?
+ *
+ * @return true if this marker has one or more references, false otherwise.
+ */
+ public boolean hasReferences();
+
+ /**
+ * Returns an Iterator which can be used to iterate over the references of this
+ * marker. An empty iterator is returned when this marker has no references.
+ *
+ * @return Iterator over the references of this marker
+ */
+ public Iterator iterator();
+
+ /**
+ * Does this marker contain a reference to the 'other' marker? Marker A is defined
+ * to contain marker B, if A == B or if B is referenced by A, or if B is referenced
+ * by any one of A's references (recursively).
+ *
+ * @param other
+ * The marker to test for inclusion.
+ * @throws IllegalArgumentException
+ * if 'other' is null
+ * @return Whether this marker contains the other marker.
+ */
+ public boolean contains(Marker other);
+
+ /**
+ * Does this marker contain the marker named 'name'?
+ *
+ * If 'name' is null the returned value is always false.
+ *
+ * @param name The marker name to test for inclusion.
+ * @return Whether this marker contains the other marker.
+ */
+ public boolean contains(String name);
+
+ /**
+ * Markers are considered equal if they have the same name.
+ *
+ * @param o
+ * @return true, if this.name equals o.name
+ *
+ * @since 1.5.1
+ */
+ public boolean equals(Object o);
+
+ /**
+ * Compute the hash code based on the name of this marker.
+ * Note that markers are considered equal if they have the same name.
+ *
+ * @return the computed hashCode
+ * @since 1.5.1
+ */
+ public int hashCode();
+
+}
diff --git a/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java b/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java
index 8c309a1..7eff41f 100644
--- a/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java
+++ b/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java
@@ -1,114 +1,114 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j;
-
-import org.slf4j.helpers.BasicMarkerFactory;
-import org.slf4j.helpers.Util;
-import org.slf4j.impl.StaticMarkerBinder;
-
-/**
- * MarkerFactory is a utility class producing {@link Marker} instances as
- * appropriate for the logging system currently in use.
- *
- *
- * This class is essentially implemented as a wrapper around an
- * {@link IMarkerFactory} instance bound at compile time.
- *
- *
- * Please note that all methods in this class are static.
- *
- * @author Ceki Gülcü
- */
-public class MarkerFactory {
- static IMarkerFactory MARKER_FACTORY;
-
- private MarkerFactory() {
- }
-
- /**
- * As of SLF4J version 1.7.14, StaticMarkerBinder classes shipping in various bindings
- * come with a getSingleton() method. Previously only a public field called SINGLETON
- * was available.
- *
- * @return IMarkerFactory
- * @throws NoClassDefFoundError in case no binding is available
- * @since 1.7.14
- */
- private static IMarkerFactory bwCompatibleGetMarkerFactoryFromBinder() throws NoClassDefFoundError {
- try {
- return StaticMarkerBinder.getSingleton().getMarkerFactory();
- } catch (NoSuchMethodError nsme) {
- // binding is probably a version of SLF4J older than 1.7.14
- return StaticMarkerBinder.SINGLETON.getMarkerFactory();
- }
- }
-
- // this is where the binding happens
- static {
- try {
- MARKER_FACTORY = bwCompatibleGetMarkerFactoryFromBinder();
- } catch (NoClassDefFoundError e) {
- MARKER_FACTORY = new BasicMarkerFactory();
- } catch (Exception e) {
- // we should never get here
- Util.report("Unexpected failure while binding MarkerFactory", e);
- }
- }
-
- /**
- * Return a Marker instance as specified by the name parameter using the
- * previously bound {@link IMarkerFactory}instance.
- *
- * @param name
- * The name of the {@link Marker} object to return.
- * @return marker
- */
- public static Marker getMarker(String name) {
- return MARKER_FACTORY.getMarker(name);
- }
-
- /**
- * Create a marker which is detached (even at birth) from the MarkerFactory.
- *
- * @param name the name of the marker
- * @return a dangling marker
- * @since 1.5.1
- */
- public static Marker getDetachedMarker(String name) {
- return MARKER_FACTORY.getDetachedMarker(name);
- }
-
- /**
- * Return the {@link IMarkerFactory}instance in use.
- *
- *
The IMarkerFactory instance is usually bound with this class at
- * compile time.
- *
- * @return the IMarkerFactory instance in use
- */
- public static IMarkerFactory getIMarkerFactory() {
- return MARKER_FACTORY;
- }
+/**
+ * Copyright (c) 2004-2011 QOS.ch
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+package org.slf4j;
+
+import org.slf4j.helpers.BasicMarkerFactory;
+import org.slf4j.helpers.Util;
+import org.slf4j.impl.StaticMarkerBinder;
+
+/**
+ * MarkerFactory is a utility class producing {@link Marker} instances as
+ * appropriate for the logging system currently in use.
+ *
+ *
+ * This class is essentially implemented as a wrapper around an
+ * {@link IMarkerFactory} instance bound at compile time.
+ *
+ *
+ * Please note that all methods in this class are static.
+ *
+ * @author Ceki Gülcü
+ */
+public class MarkerFactory {
+ static IMarkerFactory MARKER_FACTORY;
+
+ private MarkerFactory() {
+ }
+
+ /**
+ * As of SLF4J version 1.7.14, StaticMarkerBinder classes shipping in various bindings
+ * come with a getSingleton() method. Previously only a public field called SINGLETON
+ * was available.
+ *
+ * @return IMarkerFactory
+ * @throws NoClassDefFoundError in case no binding is available
+ * @since 1.7.14
+ */
+ private static IMarkerFactory bwCompatibleGetMarkerFactoryFromBinder() throws NoClassDefFoundError {
+ try {
+ return StaticMarkerBinder.getSingleton().getMarkerFactory();
+ } catch (NoSuchMethodError nsme) {
+ // binding is probably a version of SLF4J older than 1.7.14
+ return StaticMarkerBinder.SINGLETON.getMarkerFactory();
+ }
+ }
+
+ // this is where the binding happens
+ static {
+ try {
+ MARKER_FACTORY = bwCompatibleGetMarkerFactoryFromBinder();
+ } catch (NoClassDefFoundError e) {
+ MARKER_FACTORY = new BasicMarkerFactory();
+ } catch (Exception e) {
+ // we should never get here
+ Util.report("Unexpected failure while binding MarkerFactory", e);
+ }
+ }
+
+ /**
+ * Return a Marker instance as specified by the name parameter using the
+ * previously bound {@link IMarkerFactory}instance.
+ *
+ * @param name
+ * The name of the {@link Marker} object to return.
+ * @return marker
+ */
+ public static Marker getMarker(String name) {
+ return MARKER_FACTORY.getMarker(name);
+ }
+
+ /**
+ * Create a marker which is detached (even at birth) from the MarkerFactory.
+ *
+ * @param name the name of the marker
+ * @return a dangling marker
+ * @since 1.5.1
+ */
+ public static Marker getDetachedMarker(String name) {
+ return MARKER_FACTORY.getDetachedMarker(name);
+ }
+
+ /**
+ * Return the {@link IMarkerFactory}instance in use.
+ *
+ *
The IMarkerFactory instance is usually bound with this class at
+ * compile time.
+ *
+ * @return the IMarkerFactory instance in use
+ */
+ public static IMarkerFactory getIMarkerFactory() {
+ return MARKER_FACTORY;
+ }
}diff --git a/slf4j-api/src/main/java/org/slf4j/event/EventConstants.java b/slf4j-api/src/main/java/org/slf4j/event/EventConstants.java
old file mode 100644
new file mode 100755
index 8a7e733..00975da 100755
--- a/slf4j-api/src/main/java/org/slf4j/event/EventConstants.java
+++ b/slf4j-api/src/main/java/org/slf4j/event/EventConstants.java
@@ -1,13 +1,13 @@
-package org.slf4j.event;
-
-import org.slf4j.spi.LocationAwareLogger;
-
-public class EventConstants {
- public static final int ERROR_INT = LocationAwareLogger.ERROR_INT;
- public static final int WARN_INT = LocationAwareLogger.WARN_INT;
- public static final int INFO_INT = LocationAwareLogger.INFO_INT;
- public static final int DEBUG_INT = LocationAwareLogger.DEBUG_INT;
- public static final int TRACE_INT = LocationAwareLogger.TRACE_INT;
- public static final String NA_SUBST = "NA/SubstituteLogger";
-
-}
+package org.slf4j.event;
+
+import org.slf4j.spi.LocationAwareLogger;
+
+public class EventConstants {
+ public static final int ERROR_INT = LocationAwareLogger.ERROR_INT;
+ public static final int WARN_INT = LocationAwareLogger.WARN_INT;
+ public static final int INFO_INT = LocationAwareLogger.INFO_INT;
+ public static final int DEBUG_INT = LocationAwareLogger.DEBUG_INT;
+ public static final int TRACE_INT = LocationAwareLogger.TRACE_INT;
+ public static final String NA_SUBST = "NA/SubstituteLogger";
+
+}
diff --git a/slf4j-api/src/main/java/org/slf4j/event/EventRecodingLogger.java b/slf4j-api/src/main/java/org/slf4j/event/EventRecodingLogger.java
old file mode 100644
new file mode 100755
index 112dc33..b43a32d 100755
--- a/slf4j-api/src/main/java/org/slf4j/event/EventRecodingLogger.java
+++ b/slf4j-api/src/main/java/org/slf4j/event/EventRecodingLogger.java
@@ -1,296 +1,296 @@
-package org.slf4j.event;
-
-import java.util.Queue;
-
-import org.slf4j.Logger;
-import org.slf4j.Marker;
-import org.slf4j.helpers.SubstituteLogger;
-
-public class EventRecodingLogger implements Logger {
-
- String name;
- SubstituteLogger logger;
- Queue eventQueue;
-
- public EventRecodingLogger(SubstituteLogger logger, Queue eventQueue) {
- this.logger = logger;
- this.name = logger.getName();
- this.eventQueue = eventQueue;
- }
-
- public String getName() {
- return name;
- }
-
- private void recordEvent(Level level, String msg, Object[] args, Throwable throwable) {
- recordEvent(level, null, msg, args, throwable);
- }
-
- private void recordEvent(Level level, Marker marker, String msg, Object[] args, Throwable throwable) {
- // System.out.println("recording logger:"+name+", msg:"+msg);
- SubstituteLoggingEvent loggingEvent = new SubstituteLoggingEvent();
- loggingEvent.setTimeStamp(System.currentTimeMillis());
- loggingEvent.setLevel(level);
- loggingEvent.setLogger(logger);
- loggingEvent.setLoggerName(name);
- loggingEvent.setMarker(marker);
- loggingEvent.setMessage(msg);
- loggingEvent.setArgumentArray(args);
- loggingEvent.setThrowable(throwable);
- loggingEvent.setThreadName(Thread.currentThread().getName());
- eventQueue.add(loggingEvent);
- }
-
- public boolean isTraceEnabled() {
- return true;
- }
-
- public void trace(String msg) {
- recordEvent(Level.TRACE, msg, null, null);
- }
-
- public void trace(String format, Object arg) {
- recordEvent(Level.TRACE, format, new Object[] { arg }, null);
- }
-
- public void trace(String format, Object arg1, Object arg2) {
- recordEvent(Level.TRACE, format, new Object[] { arg1, arg2 }, null);
- }
-
- public void trace(String format, Object... arguments) {
- recordEvent(Level.TRACE, format, arguments, null);
- }
-
- public void trace(String msg, Throwable t) {
- recordEvent(Level.TRACE, msg, null, t);
- }
-
- public boolean isTraceEnabled(Marker marker) {
- return true;
- }
-
- public void trace(Marker marker, String msg) {
- recordEvent(Level.TRACE, marker, msg, null, null);
-
- }
-
- public void trace(Marker marker, String format, Object arg) {
- recordEvent(Level.TRACE, marker, format, new Object[] { arg }, null);
- }
-
- public void trace(Marker marker, String format, Object arg1, Object arg2) {
- recordEvent(Level.TRACE, marker, format, new Object[] { arg1, arg2 }, null);
- }
-
- public void trace(Marker marker, String format, Object... argArray) {
- recordEvent(Level.TRACE, marker, format, argArray, null);
-
- }
-
- public void trace(Marker marker, String msg, Throwable t) {
- recordEvent(Level.TRACE, marker, msg, null, t);
- }
-
- public boolean isDebugEnabled() {
- return true;
- }
-
- public void debug(String msg) {
- recordEvent(Level.TRACE, msg, null, null);
- }
-
- public void debug(String format, Object arg) {
- recordEvent(Level.DEBUG, format, new Object[] { arg }, null);
-
- }
-
- public void debug(String format, Object arg1, Object arg2) {
- recordEvent(Level.DEBUG, format, new Object[] { arg1, arg2 }, null);
-
- }
-
- public void debug(String format, Object... arguments) {
- recordEvent(Level.DEBUG, format, arguments, null);
- }
-
- public void debug(String msg, Throwable t) {
- recordEvent(Level.DEBUG, msg, null, t);
- }
-
- public boolean isDebugEnabled(Marker marker) {
- return true;
- }
-
- public void debug(Marker marker, String msg) {
- recordEvent(Level.DEBUG, marker, msg, null, null);
- }
-
- public void debug(Marker marker, String format, Object arg) {
- recordEvent(Level.DEBUG, marker, format, new Object[] { arg }, null);
- }
-
- public void debug(Marker marker, String format, Object arg1, Object arg2) {
- recordEvent(Level.DEBUG, marker, format, new Object[] { arg1, arg2 }, null);
- }
-
- public void debug(Marker marker, String format, Object... arguments) {
- recordEvent(Level.DEBUG, marker, format, arguments, null);
- }
-
- public void debug(Marker marker, String msg, Throwable t) {
- recordEvent(Level.DEBUG, marker, msg, null, t);
- }
-
- public boolean isInfoEnabled() {
- return true;
- }
-
- public void info(String msg) {
- recordEvent(Level.INFO, msg, null, null);
- }
-
- public void info(String format, Object arg) {
- recordEvent(Level.INFO, format, new Object[] { arg }, null);
- }
-
- public void info(String format, Object arg1, Object arg2) {
- recordEvent(Level.INFO, format, new Object[] { arg1, arg2 }, null);
- }
-
- public void info(String format, Object... arguments) {
- recordEvent(Level.INFO, format, arguments, null);
- }
-
- public void info(String msg, Throwable t) {
- recordEvent(Level.INFO, msg, null, t);
- }
-
- public boolean isInfoEnabled(Marker marker) {
- return true;
- }
-
- public void info(Marker marker, String msg) {
- recordEvent(Level.INFO, marker, msg, null, null);
- }
-
- public void info(Marker marker, String format, Object arg) {
- recordEvent(Level.INFO, marker, format, new Object[] { arg }, null);
- }
-
- public void info(Marker marker, String format, Object arg1, Object arg2) {
- recordEvent(Level.INFO, marker, format, new Object[] { arg1, arg2 }, null);
- }
-
- public void info(Marker marker, String format, Object... arguments) {
- recordEvent(Level.INFO, marker, format, arguments, null);
- }
-
- public void info(Marker marker, String msg, Throwable t) {
- recordEvent(Level.INFO, marker, msg, null, t);
-
- }
-
- public boolean isWarnEnabled() {
- return true;
- }
-
- public void warn(String msg) {
- recordEvent(Level.WARN, msg, null, null);
- }
-
- public void warn(String format, Object arg) {
- recordEvent(Level.WARN, format, new Object[] { arg }, null);
-
- }
-
- public void warn(String format, Object arg1, Object arg2) {
- recordEvent(Level.WARN, format, new Object[] { arg1, arg2 }, null);
- }
-
- public void warn(String format, Object... arguments) {
- recordEvent(Level.WARN, format, arguments, null);
- }
-
- public void warn(String msg, Throwable t) {
- recordEvent(Level.WARN, msg, null, t);
- }
-
- public boolean isWarnEnabled(Marker marker) {
- return true;
- }
-
- public void warn(Marker marker, String msg) {
- recordEvent(Level.WARN, msg, null, null);
- }
-
- public void warn(Marker marker, String format, Object arg) {
- recordEvent(Level.WARN, format, new Object[] { arg }, null);
- }
-
- public void warn(Marker marker, String format, Object arg1, Object arg2) {
- recordEvent(Level.WARN, marker, format, new Object[] { arg1, arg2 }, null);
-
- }
-
- public void warn(Marker marker, String format, Object... arguments) {
- recordEvent(Level.WARN, marker, format, arguments, null);
- }
-
- public void warn(Marker marker, String msg, Throwable t) {
- recordEvent(Level.WARN, marker, msg, null, t);
- }
-
- public boolean isErrorEnabled() {
- return true;
- }
-
- public void error(String msg) {
- recordEvent(Level.ERROR, msg, null, null);
- }
-
- public void error(String format, Object arg) {
- recordEvent(Level.ERROR, format, new Object[] { arg }, null);
-
- }
-
- public void error(String format, Object arg1, Object arg2) {
- recordEvent(Level.ERROR, format, new Object[] { arg1, arg2 }, null);
-
- }
-
- public void error(String format, Object... arguments) {
- recordEvent(Level.ERROR, format, arguments, null);
-
- }
-
- public void error(String msg, Throwable t) {
- recordEvent(Level.ERROR, msg, null, t);
- }
-
- public boolean isErrorEnabled(Marker marker) {
- return true;
- }
-
- public void error(Marker marker, String msg) {
- recordEvent(Level.ERROR, marker, msg, null, null);
-
- }
-
- public void error(Marker marker, String format, Object arg) {
- recordEvent(Level.ERROR, marker, format, new Object[] { arg }, null);
-
- }
-
- public void error(Marker marker, String format, Object arg1, Object arg2) {
- recordEvent(Level.ERROR, marker, format, new Object[] { arg1, arg2 }, null);
- }
-
- public void error(Marker marker, String format, Object... arguments) {
- recordEvent(Level.ERROR, marker, format, arguments, null);
- }
-
- public void error(Marker marker, String msg, Throwable t) {
- recordEvent(Level.ERROR, marker, msg, null, t);
- }
-
-}
+package org.slf4j.event;
+
+import java.util.Queue;
+
+import org.slf4j.Logger;
+import org.slf4j.Marker;
+import org.slf4j.helpers.SubstituteLogger;
+
+public class EventRecodingLogger implements Logger {
+
+ String name;
+ SubstituteLogger logger;
+ Queue eventQueue;
+
+ public EventRecodingLogger(SubstituteLogger logger, Queue eventQueue) {
+ this.logger = logger;
+ this.name = logger.getName();
+ this.eventQueue = eventQueue;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ private void recordEvent(Level level, String msg, Object[] args, Throwable throwable) {
+ recordEvent(level, null, msg, args, throwable);
+ }
+
+ private void recordEvent(Level level, Marker marker, String msg, Object[] args, Throwable throwable) {
+ // System.out.println("recording logger:"+name+", msg:"+msg);
+ SubstituteLoggingEvent loggingEvent = new SubstituteLoggingEvent();
+ loggingEvent.setTimeStamp(System.currentTimeMillis());
+ loggingEvent.setLevel(level);
+ loggingEvent.setLogger(logger);
+ loggingEvent.setLoggerName(name);
+ loggingEvent.setMarker(marker);
+ loggingEvent.setMessage(msg);
+ loggingEvent.setArgumentArray(args);
+ loggingEvent.setThrowable(throwable);
+ loggingEvent.setThreadName(Thread.currentThread().getName());
+ eventQueue.add(loggingEvent);
+ }
+
+ public boolean isTraceEnabled() {
+ return true;
+ }
+
+ public void trace(String msg) {
+ recordEvent(Level.TRACE, msg, null, null);
+ }
+
+ public void trace(String format, Object arg) {
+ recordEvent(Level.TRACE, format, new Object[] { arg }, null);
+ }
+
+ public void trace(String format, Object arg1, Object arg2) {
+ recordEvent(Level.TRACE, format, new Object[] { arg1, arg2 }, null);
+ }
+
+ public void trace(String format, Object... arguments) {
+ recordEvent(Level.TRACE, format, arguments, null);
+ }
+
+ public void trace(String msg, Throwable t) {
+ recordEvent(Level.TRACE, msg, null, t);
+ }
+
+ public boolean isTraceEnabled(Marker marker) {
+ return true;
+ }
+
+ public void trace(Marker marker, String msg) {
+ recordEvent(Level.TRACE, marker, msg, null, null);
+
+ }
+
+ public void trace(Marker marker, String format, Object arg) {
+ recordEvent(Level.TRACE, marker, format, new Object[] { arg }, null);
+ }
+
+ public void trace(Marker marker, String format, Object arg1, Object arg2) {
+ recordEvent(Level.TRACE, marker, format, new Object[] { arg1, arg2 }, null);
+ }
+
+ public void trace(Marker marker, String format, Object... argArray) {
+ recordEvent(Level.TRACE, marker, format, argArray, null);
+
+ }
+
+ public void trace(Marker marker, String msg, Throwable t) {
+ recordEvent(Level.TRACE, marker, msg, null, t);
+ }
+
+ public boolean isDebugEnabled() {
+ return true;
+ }
+
+ public void debug(String msg) {
+ recordEvent(Level.TRACE, msg, null, null);
+ }
+
+ public void debug(String format, Object arg) {
+ recordEvent(Level.DEBUG, format, new Object[] { arg }, null);
+
+ }
+
+ public void debug(String format, Object arg1, Object arg2) {
+ recordEvent(Level.DEBUG, format, new Object[] { arg1, arg2 }, null);
+
+ }
+
+ public void debug(String format, Object... arguments) {
+ recordEvent(Level.DEBUG, format, arguments, null);
+ }
+
+ public void debug(String msg, Throwable t) {
+ recordEvent(Level.DEBUG, msg, null, t);
+ }
+
+ public boolean isDebugEnabled(Marker marker) {
+ return true;
+ }
+
+ public void debug(Marker marker, String msg) {
+ recordEvent(Level.DEBUG, marker, msg, null, null);
+ }
+
+ public void debug(Marker marker, String format, Object arg) {
+ recordEvent(Level.DEBUG, marker, format, new Object[] { arg }, null);
+ }
+
+ public void debug(Marker marker, String format, Object arg1, Object arg2) {
+ recordEvent(Level.DEBUG, marker, format, new Object[] { arg1, arg2 }, null);
+ }
+
+ public void debug(Marker marker, String format, Object... arguments) {
+ recordEvent(Level.DEBUG, marker, format, arguments, null);
+ }
+
+ public void debug(Marker marker, String msg, Throwable t) {
+ recordEvent(Level.DEBUG, marker, msg, null, t);
+ }
+
+ public boolean isInfoEnabled() {
+ return true;
+ }
+
+ public void info(String msg) {
+ recordEvent(Level.INFO, msg, null, null);
+ }
+
+ public void info(String format, Object arg) {
+ recordEvent(Level.INFO, format, new Object[] { arg }, null);
+ }
+
+ public void info(String format, Object arg1, Object arg2) {
+ recordEvent(Level.INFO, format, new Object[] { arg1, arg2 }, null);
+ }
+
+ public void info(String format, Object... arguments) {
+ recordEvent(Level.INFO, format, arguments, null);
+ }
+
+ public void info(String msg, Throwable t) {
+ recordEvent(Level.INFO, msg, null, t);
+ }
+
+ public boolean isInfoEnabled(Marker marker) {
+ return true;
+ }
+
+ public void info(Marker marker, String msg) {
+ recordEvent(Level.INFO, marker, msg, null, null);
+ }
+
+ public void info(Marker marker, String format, Object arg) {
+ recordEvent(Level.INFO, marker, format, new Object[] { arg }, null);
+ }
+
+ public void info(Marker marker, String format, Object arg1, Object arg2) {
+ recordEvent(Level.INFO, marker, format, new Object[] { arg1, arg2 }, null);
+ }
+
+ public void info(Marker marker, String format, Object... arguments) {
+ recordEvent(Level.INFO, marker, format, arguments, null);
+ }
+
+ public void info(Marker marker, String msg, Throwable t) {
+ recordEvent(Level.INFO, marker, msg, null, t);
+
+ }
+
+ public boolean isWarnEnabled() {
+ return true;
+ }
+
+ public void warn(String msg) {
+ recordEvent(Level.WARN, msg, null, null);
+ }
+
+ public void warn(String format, Object arg) {
+ recordEvent(Level.WARN, format, new Object[] { arg }, null);
+
+ }
+
+ public void warn(String format, Object arg1, Object arg2) {
+ recordEvent(Level.WARN, format, new Object[] { arg1, arg2 }, null);
+ }
+
+ public void warn(String format, Object... arguments) {
+ recordEvent(Level.WARN, format, arguments, null);
+ }
+
+ public void warn(String msg, Throwable t) {
+ recordEvent(Level.WARN, msg, null, t);
+ }
+
+ public boolean isWarnEnabled(Marker marker) {
+ return true;
+ }
+
+ public void warn(Marker marker, String msg) {
+ recordEvent(Level.WARN, msg, null, null);
+ }
+
+ public void warn(Marker marker, String format, Object arg) {
+ recordEvent(Level.WARN, format, new Object[] { arg }, null);
+ }
+
+ public void warn(Marker marker, String format, Object arg1, Object arg2) {
+ recordEvent(Level.WARN, marker, format, new Object[] { arg1, arg2 }, null);
+
+ }
+
+ public void warn(Marker marker, String format, Object... arguments) {
+ recordEvent(Level.WARN, marker, format, arguments, null);
+ }
+
+ public void warn(Marker marker, String msg, Throwable t) {
+ recordEvent(Level.WARN, marker, msg, null, t);
+ }
+
+ public boolean isErrorEnabled() {
+ return true;
+ }
+
+ public void error(String msg) {
+ recordEvent(Level.ERROR, msg, null, null);
+ }
+
+ public void error(String format, Object arg) {
+ recordEvent(Level.ERROR, format, new Object[] { arg }, null);
+
+ }
+
+ public void error(String format, Object arg1, Object arg2) {
+ recordEvent(Level.ERROR, format, new Object[] { arg1, arg2 }, null);
+
+ }
+
+ public void error(String format, Object... arguments) {
+ recordEvent(Level.ERROR, format, arguments, null);
+
+ }
+
+ public void error(String msg, Throwable t) {
+ recordEvent(Level.ERROR, msg, null, t);
+ }
+
+ public boolean isErrorEnabled(Marker marker) {
+ return true;
+ }
+
+ public void error(Marker marker, String msg) {
+ recordEvent(Level.ERROR, marker, msg, null, null);
+
+ }
+
+ public void error(Marker marker, String format, Object arg) {
+ recordEvent(Level.ERROR, marker, format, new Object[] { arg }, null);
+
+ }
+
+ public void error(Marker marker, String format, Object arg1, Object arg2) {
+ recordEvent(Level.ERROR, marker, format, new Object[] { arg1, arg2 }, null);
+ }
+
+ public void error(Marker marker, String format, Object... arguments) {
+ recordEvent(Level.ERROR, marker, format, arguments, null);
+ }
+
+ public void error(Marker marker, String msg, Throwable t) {
+ recordEvent(Level.ERROR, marker, msg, null, t);
+ }
+
+}
diff --git a/slf4j-api/src/main/java/org/slf4j/event/Level.java b/slf4j-api/src/main/java/org/slf4j/event/Level.java
old file mode 100644
new file mode 100755
index ee4146c..5d4031c 100755
--- a/slf4j-api/src/main/java/org/slf4j/event/Level.java
+++ b/slf4j-api/src/main/java/org/slf4j/event/Level.java
@@ -1,37 +1,37 @@
-package org.slf4j.event;
-
-import static org.slf4j.event.EventConstants.DEBUG_INT;
-import static org.slf4j.event.EventConstants.ERROR_INT;
-import static org.slf4j.event.EventConstants.INFO_INT;
-import static org.slf4j.event.EventConstants.TRACE_INT;
-import static org.slf4j.event.EventConstants.WARN_INT;
-
-/**
- *
- * @author ceki
- * @since 1.7.15
- */
-public enum Level {
-
- ERROR(ERROR_INT, "ERROR"), WARN(WARN_INT, "WARN"), INFO(INFO_INT, "INFO"), DEBUG(DEBUG_INT, "DEBUG"), TRACE(TRACE_INT, "TRACE");
-
- private int levelInt;
- private String levelStr;
-
- Level(int i, String s) {
- levelInt = i;
- levelStr = s;
- }
-
- public int toInt() {
- return levelInt;
- }
-
- /**
- * Returns the string representation of this Level.
- */
- public String toString() {
- return levelStr;
- }
-
-}
+package org.slf4j.event;
+
+import static org.slf4j.event.EventConstants.DEBUG_INT;
+import static org.slf4j.event.EventConstants.ERROR_INT;
+import static org.slf4j.event.EventConstants.INFO_INT;
+import static org.slf4j.event.EventConstants.TRACE_INT;
+import static org.slf4j.event.EventConstants.WARN_INT;
+
+/**
+ *
+ * @author ceki
+ * @since 1.7.15
+ */
+public enum Level {
+
+ ERROR(ERROR_INT, "ERROR"), WARN(WARN_INT, "WARN"), INFO(INFO_INT, "INFO"), DEBUG(DEBUG_INT, "DEBUG"), TRACE(TRACE_INT, "TRACE");
+
+ private int levelInt;
+ private String levelStr;
+
+ Level(int i, String s) {
+ levelInt = i;
+ levelStr = s;
+ }
+
+ public int toInt() {
+ return levelInt;
+ }
+
+ /**
+ * Returns the string representation of this Level.
+ */
+ public String toString() {
+ return levelStr;
+ }
+
+}
diff --git a/slf4j-api/src/main/java/org/slf4j/event/LoggingEvent.java b/slf4j-api/src/main/java/org/slf4j/event/LoggingEvent.java
old file mode 100644
new file mode 100755
index d9eabed..1e26c2d 100755
--- a/slf4j-api/src/main/java/org/slf4j/event/LoggingEvent.java
+++ b/slf4j-api/src/main/java/org/slf4j/event/LoggingEvent.java
@@ -1,28 +1,28 @@
-package org.slf4j.event;
-
-import org.slf4j.Marker;
-
-/**
- *
- * @author ceki
- * @since 1.7.15
- */
-public interface LoggingEvent {
-
- Level getLevel();
-
- Marker getMarker();
-
- String getLoggerName();
-
- String getMessage();
-
- String getThreadName();
-
- Object[] getArgumentArray();
-
- long getTimeStamp();
-
- Throwable getThrowable();
-
-}
+package org.slf4j.event;
+
+import org.slf4j.Marker;
+
+/**
+ *
+ * @author ceki
+ * @since 1.7.15
+ */
+public interface LoggingEvent {
+
+ Level getLevel();
+
+ Marker getMarker();
+
+ String getLoggerName();
+
+ String getMessage();
+
+ String getThreadName();
+
+ Object[] getArgumentArray();
+
+ long getTimeStamp();
+
+ Throwable getThrowable();
+
+}
diff --git a/slf4j-api/src/main/java/org/slf4j/event/SubstituteLoggingEvent.java b/slf4j-api/src/main/java/org/slf4j/event/SubstituteLoggingEvent.java
old file mode 100644
new file mode 100755
index d352c65..8c7acbc 100755
--- a/slf4j-api/src/main/java/org/slf4j/event/SubstituteLoggingEvent.java
+++ b/slf4j-api/src/main/java/org/slf4j/event/SubstituteLoggingEvent.java
@@ -1,89 +1,89 @@
-package org.slf4j.event;
-
-import org.slf4j.Marker;
-import org.slf4j.helpers.SubstituteLogger;
-
-public class SubstituteLoggingEvent implements LoggingEvent {
-
- Level level;
- Marker marker;
- String loggerName;
- SubstituteLogger logger;
- String threadName;
- String message;
- Object[] argArray;
- long timeStamp;
- Throwable throwable;
-
- public Level getLevel() {
- return level;
- }
-
- public void setLevel(Level level) {
- this.level = level;
- }
-
- public Marker getMarker() {
- return marker;
- }
-
- public void setMarker(Marker marker) {
- this.marker = marker;
- }
-
- public String getLoggerName() {
- return loggerName;
- }
-
- public void setLoggerName(String loggerName) {
- this.loggerName = loggerName;
- }
-
- public SubstituteLogger getLogger() {
- return logger;
- }
-
- public void setLogger(SubstituteLogger logger) {
- this.logger = logger;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Object[] getArgumentArray() {
- return argArray;
- }
-
- public void setArgumentArray(Object[] argArray) {
- this.argArray = argArray;
- }
-
- public long getTimeStamp() {
- return timeStamp;
- }
-
- public void setTimeStamp(long timeStamp) {
- this.timeStamp = timeStamp;
- }
-
- public String getThreadName() {
- return threadName;
- }
-
- public void setThreadName(String threadName) {
- this.threadName = threadName;
- }
-
- public Throwable getThrowable() {
- return throwable;
- }
-
- public void setThrowable(Throwable throwable) {
- this.throwable = throwable;
- }
-}
+package org.slf4j.event;
+
+import org.slf4j.Marker;
+import org.slf4j.helpers.SubstituteLogger;
+
+public class SubstituteLoggingEvent implements LoggingEvent {
+
+ Level level;
+ Marker marker;
+ String loggerName;
+ SubstituteLogger logger;
+ String threadName;
+ String message;
+ Object[] argArray;
+ long timeStamp;
+ Throwable throwable;
+
+ public Level getLevel() {
+ return level;
+ }
+
+ public void setLevel(Level level) {
+ this.level = level;
+ }
+
+ public Marker getMarker() {
+ return marker;
+ }
+
+ public void setMarker(Marker marker) {
+ this.marker = marker;
+ }
+
+ public String getLoggerName() {
+ return loggerName;
+ }
+
+ public void setLoggerName(String loggerName) {
+ this.loggerName = loggerName;
+ }
+
+ public SubstituteLogger getLogger() {
+ return logger;
+ }
+
+ public void setLogger(SubstituteLogger logger) {
+ this.logger = logger;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public Object[] getArgumentArray() {
+ return argArray;
+ }
+
+ public void setArgumentArray(Object[] argArray) {
+ this.argArray = argArray;
+ }
+
+ public long getTimeStamp() {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(long timeStamp) {
+ this.timeStamp = timeStamp;
+ }
+
+ public String getThreadName() {
+ return threadName;
+ }
+
+ public void setThreadName(String threadName) {
+ this.threadName = threadName;
+ }
+
+ public Throwable getThrowable() {
+ return throwable;
+ }
+
+ public void setThrowable(Throwable throwable) {
+ this.throwable = throwable;
+ }
+}
diff --git a/slf4j-api/src/main/java/org/slf4j/helpers/BasicMDCAdapter.java b/slf4j-api/src/main/java/org/slf4j/helpers/BasicMDCAdapter.java
index 2269f5c..027938d 100644
--- a/slf4j-api/src/main/java/org/slf4j/helpers/BasicMDCAdapter.java
+++ b/slf4j-api/src/main/java/org/slf4j/helpers/BasicMDCAdapter.java
@@ -1,146 +1,146 @@
-/**
- * Copyright (c) 2004-2011 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-package org.slf4j.helpers;
-
-import org.slf4j.spi.MDCAdapter;
-
-import java.util.*;
-import java.util.Map;
-
-/**
- * Basic MDC implementation, which can be used with logging systems that lack
- * out-of-the-box MDC support.
- *
- * This code was initially inspired by logback's LogbackMDCAdapter. However,
- * LogbackMDCAdapter has evolved and is now considerably more sophisticated.
- *
- * @author Ceki Gulcu
- * @author Maarten Bosteels
- * @author Lukasz Cwik
- *
- * @since 1.5.0
- */
-public class BasicMDCAdapter implements MDCAdapter {
-
- private InheritableThreadLocal