slf4j-dev
Threads by month
- ----- 2025 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
June 2012
- 3 participants
- 57 discussions

[GIT] SLF4J: Simple Logging Facade for Java branch master updated. v_1.6.5-9-gfbe2e67
by git-noreply@pixie.qos.ch 11 Jun '12
by git-noreply@pixie.qos.ch 11 Jun '12
11 Jun '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via fbe2e679da6a59188a5c10696682a5e801b887cb (commit)
from 0faf4ac162f6edb220be14cd9027ff2a6935c934 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=fbe2e679da6a59188a5c106966…
http://github.com/ceki/slf4j/commit/fbe2e679da6a59188a5c10696682a5e801b887cb
commit fbe2e679da6a59188a5c10696682a5e801b887cb
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Jun 11 16:36:26 2012 +0200
typo fix
diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html
index fa60f20..486c5ac 100644
--- a/slf4j-site/src/site/pages/news.html
+++ b/slf4j-site/src/site/pages/news.html
@@ -35,8 +35,8 @@
href="https://github.com/qos-ch/slf4j">https://github.com/qos-ch/slf4j</a>
on github.</p>
- <p>In case multiple binding are found on the class path, SLF4J will
- now output the name the framework/implementation class it is
+ <p>In case multiple bindings are found on the class path, SLF4J
+ will now output the name the framework/implementation class it is
isbound to. This should make</p>
<p><a
-----------------------------------------------------------------------
Summary of changes:
slf4j-site/src/site/pages/news.html | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0

11 Jun '12
http://bugzilla.slf4j.org/show_bug.cgi?id=265
Summary: LocLoggers not working correctly with Markers
Product: SLF4J
Version: 1.6.x
Platform: PC
OS/Version: All
Status: NEW
Severity: major
Priority: P1
Component: slf4j-ext
AssignedTo: slf4j-dev(a)qos.ch
ReportedBy: campagna(a)esteco.com
There is a bug in org.slf4j.ext.LoggerWrapper which LocLogger
extends.
The logging request methods taking a Marker as first argument, invoke the wrong
method to determine if a logging request is enabled or not. For example,
methods for level INFO logging requests invoke isInfoEnabled() instead of
isInfoEnabled(marker).
This bug makes MarkerFilter turbo filters unusable when used together with
LocLoggers.
--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
1
2

[GIT] SLF4J: Simple Logging Facade for Java branch master updated. v_1.6.5-8-g0faf4ac
by git-noreply@pixie.qos.ch 11 Jun '12
by git-noreply@pixie.qos.ch 11 Jun '12
11 Jun '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via 0faf4ac162f6edb220be14cd9027ff2a6935c934 (commit)
from e5eb0b068d3e99fb5a39c82ce6f72e484f33e9d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=0faf4ac162f6edb220be14cd90…
http://github.com/ceki/slf4j/commit/0faf4ac162f6edb220be14cd9027ff2a6935c934
commit 0faf4ac162f6edb220be14cd9027ff2a6935c934
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Jun 11 16:23:20 2012 +0200
source repo moved to https://github.com/qos-ch/slf4j
diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html
index 7535468..fa60f20 100644
--- a/slf4j-site/src/site/pages/news.html
+++ b/slf4j-site/src/site/pages/news.html
@@ -30,6 +30,10 @@
<hr noshade="noshade" size="1"/>
<h3>11th of June, 2012 of SLF4J 1.6.6</h3>
+
+ <p>Source repository has been moved to <a
+ href="https://github.com/qos-ch/slf4j">https://github.com/qos-ch/slf4j</a>
+ on github.</p>
<p>In case multiple binding are found on the class path, SLF4J will
now output the name the framework/implementation class it is
diff --git a/slf4j-site/src/site/pages/repos.html b/slf4j-site/src/site/pages/repos.html
deleted file mode 100644
index d7efe04..0000000
--- a/slf4j-site/src/site/pages/repos.html
+++ /dev/null
@@ -1,104 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
- <title>SLF4J</title>
- <link rel="stylesheet" type="text/css" media="screen" href="css/site.css" />
- </head>
- <body>
- <script type="text/javascript">prefix='';</script>
-
- <script src="templates/header.js" type="text/javascript"></script>
- <div id="left">
- <script src="templates/left.js" type="text/javascript"></script>
- </div>
- <div id="content">
-
- <h1>Source code repositories</h1>
-
- <p>We store the project's source code in a revision control system
- called Git. Developers have write access to the repository, enabling
- them to make changes to the source code. Everyone else has
- read-access to the repository. Thus, anyone can check out latest
- development version of the software. Note that the latest version in
- the repository may not work as expected. It may even not compile. If
- you are looking for a stable release, then download an official
- distribution.
- </p>
-
- <p>There are several ways to access the git repository:</p>
-
- <h2>Web Access</h2>
-
- <p>If you just wish to browse around or download a few individual
- files, you can do so with your web-browser:
- </p>
-
- <table cellspacing="6">
-
- <tr>
- <td>on github</td>
- <td>
- <a href="http://github.com/ceki/slf4j/tree/master">
- http://github.com/ceki/slf4j/tree/master</a> (slow but rich)
- </td>
- </tr>
-
-
- <tr>
- <td>on git.qos.ch</td>
- <td><a href="http://git.qos.ch/gitweb/?p=slf4j.git;a=summary">
- http://git.qos.ch/gitweb/?p=slf4j.git;a=summary</a> (fast but minimal)
- </td>
- </tr>
-
- </table>
-
- <h2>Cloning</h2>
-
-
- <p>Anyone can clone the slf4j repository. All you need is a git
- client. To clone our SLF4J git repository, issue one of the two
- following commands: </p>
-
-
- <table cellpadding="4" cellspacing="1" class="bodyTable" style="font-size: 120%;">
-
- <tr class="alt">
- <th>transport protocol</th>
- <th>git clone command</th>
- </tr>
-
- <tr >
- <td>git</td>
- <td><code>git clone git://git.qos.ch/slf4j</code></td>
- </tr>
-
- <tr class="alt">
- <td>git</td>
- <td><code>git clone git://github.com/ceki/slf4j.git</code></td>
- </tr>
-
- <tr >
- <td>http</td>
- <td><code>git clone http://git.qos.ch/slf4j/</code></td>
- </tr>
- </table>
-
-
- <p>In principle, the repositories listed above have identical
- contents.</p>
-
-
- <h2>Subversion</h2>
-
- <p>Previously, we relied on Subversion as our version control
- system. Git is considerably better.</p>
-
- <script src="templates/footer.js" type="text/javascript"></script>
-
-</div>
-</body>
-</html>
diff --git a/slf4j-site/src/site/pages/templates/left.js b/slf4j-site/src/site/pages/templates/left.js
index 6df2bdf..83e1608 100644
--- a/slf4j-site/src/site/pages/templates/left.js
+++ b/slf4j-site/src/site/pages/templates/left.js
@@ -11,7 +11,7 @@ document.write(' <p class="menu_header">Support</p>');
document.write(' <a href="mailing-lists.html">Mailing Lists</a>');
document.write(' <a href="bug-reporting.html">Bug Reporting</a>');
-document.write(' <a href="repos.html">Source Repository</a>');
+document.write(' <a href="https://github.com/qos-ch/slf4j">Source Repository</a>');
document.write(' <a href="http://www.qos.ch/shop/products/professionalSupport">Support offerings</a>');
document.write(' <a href="http://www.qos.ch/shop/products/training">Training</a>');
-----------------------------------------------------------------------
Summary of changes:
slf4j-site/src/site/pages/news.html | 4 +
slf4j-site/src/site/pages/repos.html | 104 ---------------------------
slf4j-site/src/site/pages/templates/left.js | 2 +-
3 files changed, 5 insertions(+), 105 deletions(-)
delete mode 100644 slf4j-site/src/site/pages/repos.html
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0

[GIT] SLF4J: Simple Logging Facade for Java branch master updated. v_1.6.5-7-ge5eb0b0
by git-noreply@pixie.qos.ch 11 Jun '12
by git-noreply@pixie.qos.ch 11 Jun '12
11 Jun '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via e5eb0b068d3e99fb5a39c82ce6f72e484f33e9d1 (commit)
from 3e24a5c715dcd3a8597ba811716152af9aa2a37d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=e5eb0b068d3e99fb5a39c82ce6…
http://github.com/ceki/slf4j/commit/e5eb0b068d3e99fb5a39c82ce6f72e484f33e9d1
commit e5eb0b068d3e99fb5a39c82ce6f72e484f33e9d1
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Jun 11 16:16:40 2012 +0200
preparing release 1.6.6
diff --git a/integration/build.xml b/integration/build.xml
index 5ba578f..9652ce3 100644
--- a/integration/build.xml
+++ b/integration/build.xml
@@ -53,21 +53,19 @@
</path >
- <path id="multiBinding">
- <pathelement location="target/test-classes/" />
- <pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
- <pathelement location="./lib/slf4j-simple-1.5.0.jar" />
- <pathelement location="./lib/slf4j-nop-1.5.6.jar" />
- </path >
-
-
- <path id="multiBinding">
+ <path id="incompatibleMultiBinding">
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-1.5.0.jar" />
<pathelement location="./lib/slf4j-nop-1.5.6.jar" />
</path >
+ <path id="multiBinding">
+ <pathelement location="target/test-classes/" />
+ <pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
+ <pathelement location="../slf4j-simple/target/slf4j-simple-${currentVersion}.jar" />
+ <pathelement location="../slf4j-nop/target/slf4j-nop-${currentVersion}.jar" />
+ </path >
<path id="binding1699">
<pathelement location="target/test-classes/" />
@@ -104,6 +102,7 @@
testMismatch,
testMatch,
testMultiBinding,
+ testIncompatibleMultiBinding,
testFuture_16Series">
</target>
@@ -159,16 +158,26 @@
</junit>
</target>
- <target name="testMultiBinding">
+ <target name="testIncompatibleMultiBinding">
<junit printsummary="yes" fork="no" haltonfailure="yes">
- <classpath refid="multiBinding" />
+ <classpath refid="incompatibleMultiBinding" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports"
- outfile="TEST-MultiBinding"
- name="org.slf4j.MultiBindingAssertionTest" />
+ outfile="TEST-IncompatibleMultiBinding"
+ name="org.slf4j.IncompatibleMultiBindingAssertionTest" />
</junit>
</target>
+ <target name="testMultiBinding">
+ <junit printsummary="yes" fork="no" haltonfailure="yes">
+ <classpath refid="multiBinding" />
+ <formatter type="plain" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-MultiBinding"
+ name="org.slf4j.MultiBindingAssertionTest" />
+ </junit>
+ </target>
+
<target name="testFuture_16Series">
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="binding1699" />
diff --git a/integration/pom.xml b/integration/pom.xml
index 390fc0c..c5af965 100644
--- a/integration/pom.xml
+++ b/integration/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/integration/src/test/java/org/slf4j/MissingSingletonMethodAssertionTest.java b/integration/src/test/java/org/slf4j/MissingSingletonMethodAssertionTest.java
index 6b37cba..631ca09 100644
--- a/integration/src/test/java/org/slf4j/MissingSingletonMethodAssertionTest.java
+++ b/integration/src/test/java/org/slf4j/MissingSingletonMethodAssertionTest.java
@@ -80,7 +80,7 @@ public class MissingSingletonMethodAssertionTest extends TestCase {
{
String s = (String) sps.stringList.get(2);
assertTrue(s
- .contains("SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x"));
+ .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 81f679a..375f73f 100644
--- a/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
+++ b/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
@@ -51,22 +51,15 @@ public class MultiBindingAssertionTest extends TestCase {
}
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) {
- }
+ 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,
- "slf4j-api 1.6.x (or later) is incompatible with this binding");
- assertMsgContains(list, 5, "Your binding is version 1.5.5 or earlier.");
-
+ assertMsgContains(list, 4, "Actual binding is of type [");
}
void assertMsgContains(List strList, int index, String msg) {
diff --git a/jcl-over-slf4j/pom.xml b/jcl-over-slf4j/pom.xml
index 2599f41..77c77a2 100644
--- a/jcl-over-slf4j/pom.xml
+++ b/jcl-over-slf4j/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/jul-to-slf4j/pom.xml b/jul-to-slf4j/pom.xml
index 7e49d1b..bf17a52 100644
--- a/jul-to-slf4j/pom.xml
+++ b/jul-to-slf4j/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/log4j-over-slf4j/pom.xml b/log4j-over-slf4j/pom.xml
index 6730a55..4891a7b 100644
--- a/log4j-over-slf4j/pom.xml
+++ b/log4j-over-slf4j/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/osgi-over-slf4j/pom.xml b/osgi-over-slf4j/pom.xml
index 23ec0ca..b6a8715 100644
--- a/osgi-over-slf4j/pom.xml
+++ b/osgi-over-slf4j/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/pom.xml b/pom.xml
index c3a1d98..5333219 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
<packaging>pom</packaging>
<name>SLF4J</name>
diff --git a/slf4j-api/pom.xml b/slf4j-api/pom.xml
index eeb0335..383c69a 100644
--- a/slf4j-api/pom.xml
+++ b/slf4j-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
index 40284b5..e436c7b 100644
--- a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
+++ b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
@@ -38,37 +38,37 @@ import org.slf4j.impl.StaticLoggerBinder;
* 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.
- *
- * <p>
+ * <p/>
+ * <p/>
* <code>LoggerFactory</code> is essentially a wrapper around an
* {@link ILoggerFactory} instance bound with <code>LoggerFactory</code> at
* compile time.
- *
- * <p>
+ * <p/>
+ * <p/>
* Please note that all methods in <code>LoggerFactory</code> are static.
- *
+ *
* @author Ceki Gülcü
* @author Robert Elliot
*/
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 UNSUCCESSFUL_INIT_URL = CODES_PREFIX+"#unsuccessfulInit";
+ 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 UNSUCCESSFUL_INIT_URL = CODES_PREFIX + "#unsuccessfulInit";
static final String UNSUCCESSFUL_INIT_MSG = "org.slf4j.LoggerFactory could not be successfully initialized. See also "
- + UNSUCCESSFUL_INIT_URL;
+ + UNSUCCESSFUL_INIT_URL;
static final int UNINITIALIZED = 0;
- static final int ONGOING_INITILIZATION = 1;
- static final int FAILED_INITILIZATION = 2;
- static final int SUCCESSFUL_INITILIZATION = 3;
- static final int NOP_FALLBACK_INITILIZATION = 4;
+ 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 int INITIALIZATION_STATE = UNINITIALIZED;
static SubstituteLoggerFactory TEMP_FACTORY = new SubstituteLoggerFactory();
@@ -77,11 +77,11 @@ public final class LoggerFactory {
/**
* It is LoggerFactory's responsibility to track version changes and manage
* the compatibility list.
- *
- * <p>
+ * <p/>
+ * <p/>
* It is assumed that all versions in the 1.6 are mutually compatible.
- * */
- static private final String[] API_COMPATIBILITY_LIST = new String[] { "1.6" };
+ */
+ static private final String[] API_COMPATIBILITY_LIST = new String[]{"1.6"};
// private constructor prevents instantiation
private LoggerFactory() {
@@ -89,13 +89,13 @@ public final class LoggerFactory {
/**
* Force LoggerFactory to consider itself uninitialized.
- *
- * <p>
+ * <p/>
+ * <p/>
* 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.
- *
- * <p>
+ * <p/>
+ * <p/>
* You are strongly discouraged from calling this method in production code.
*/
static void reset() {
@@ -104,50 +104,50 @@ public final class LoggerFactory {
}
private final static void performInitialization() {
- singleImplementationSanityCheck();
bind();
- if (INITIALIZATION_STATE == SUCCESSFUL_INITILIZATION) {
+ if (INITIALIZATION_STATE == SUCCESSFUL_INITIALIZATION) {
versionSanityCheck();
-
}
}
private static boolean messageContainsOrgSlf4jImplStaticLoggerBinder(String msg) {
- if(msg == null)
+ if (msg == null)
return false;
- if(msg.indexOf("org/slf4j/impl/StaticLoggerBinder") != -1)
+ if (msg.indexOf("org/slf4j/impl/StaticLoggerBinder") != -1)
return true;
- if(msg.indexOf("org.slf4j.impl.StaticLoggerBinder") != -1)
+ if (msg.indexOf("org.slf4j.impl.StaticLoggerBinder") != -1)
return true;
return false;
}
private final static void bind() {
try {
+ Set staticLoggerBinderPathSet = findPossibleStaticLoggerBinderPathSet();
+ reportMultipleBindingAmbiguity(staticLoggerBinderPathSet);
// the next line does the binding
StaticLoggerBinder.getSingleton();
- INITIALIZATION_STATE = SUCCESSFUL_INITILIZATION;
+ INITIALIZATION_STATE = SUCCESSFUL_INITIALIZATION;
+ reportActualBinding(staticLoggerBinderPathSet);
emitSubstituteLoggerWarning();
} catch (NoClassDefFoundError ncde) {
String msg = ncde.getMessage();
if (messageContainsOrgSlf4jImplStaticLoggerBinder(msg)) {
- INITIALIZATION_STATE = NOP_FALLBACK_INITILIZATION;
- Util
- .report("Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".");
+ 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.");
+ + " for further details.");
} else {
failedBinding(ncde);
throw ncde;
}
- } catch(java.lang.NoSuchMethodError nsme) {
+ } catch (java.lang.NoSuchMethodError nsme) {
String msg = nsme.getMessage();
if (msg != null && msg.indexOf("org.slf4j.impl.StaticLoggerBinder.getSingleton()") != -1) {
- INITIALIZATION_STATE = FAILED_INITILIZATION;
+ 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. or 2.0.x");
+ Util.report("Upgrade your binding to version 1.6.x.");
}
throw nsme;
} catch (Exception e) {
@@ -157,7 +157,7 @@ public final class LoggerFactory {
}
static void failedBinding(Throwable t) {
- INITIALIZATION_STATE = FAILED_INITILIZATION;
+ INITIALIZATION_STATE = FAILED_INITIALIZATION;
Util.report("Failed to instantiate SLF4J LoggerFactory", t);
}
@@ -166,10 +166,8 @@ public final class LoggerFactory {
if (loggerNameList.size() == 0) {
return;
}
- Util
- .report("The following loggers will not work because they were created");
- Util
- .report("during the default configuration phase of the underlying logging system.");
+ Util.report("The following loggers will not work because they were created");
+ Util.report("during the default configuration phase of the underlying logging system.");
Util.report("See also " + SUBSTITUTE_LOGGER_URL);
for (int i = 0; i < loggerNameList.size(); i++) {
String loggerName = (String) loggerNameList.get(i);
@@ -189,8 +187,8 @@ public final class LoggerFactory {
}
if (!match) {
Util.report("The requested version " + requested
- + " by your slf4j binding is not compatible with "
- + Arrays.asList(API_COMPATIBILITY_LIST).toString());
+ + " 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) {
@@ -208,44 +206,63 @@ public final class LoggerFactory {
// the class itself.
private static String STATIC_LOGGER_BINDER_PATH = "org/slf4j/impl/StaticLoggerBinder.class";
- private static void singleImplementationSanityCheck() {
+ private 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();
+ .getClassLoader();
Enumeration paths;
if (loggerFactoryClassLoader == null) {
paths = ClassLoader.getSystemResources(STATIC_LOGGER_BINDER_PATH);
} else {
paths = loggerFactoryClassLoader
- .getResources(STATIC_LOGGER_BINDER_PATH);
+ .getResources(STATIC_LOGGER_BINDER_PATH);
}
- // use Set instead of list in order to deal with bug #138
- // LinkedHashSet appropriate here because it preserves insertion order during iteration
- Set implementationSet = new LinkedHashSet();
while (paths.hasMoreElements()) {
URL path = (URL) paths.nextElement();
- implementationSet.add(path);
- }
- if (implementationSet.size() > 1) {
- Util.report("Class path contains multiple SLF4J bindings.");
- Iterator iterator = implementationSet.iterator();
- while(iterator.hasNext()) {
- URL path = (URL) iterator.next();
- Util.report("Found binding in [" + path + "]");
- }
- Util.report("See " + MULTIPLE_BINDINGS_URL + " for an explanation.");
+ staticLoggerBinderPathSet.add(path);
}
} catch (IOException ioe) {
Util.report("Error getting resources from path", ioe);
}
+ return staticLoggerBinderPathSet;
+ }
+
+ private static boolean isAmbiguousStaticLoggerBinderPathSet(Set staticLoggerBinderPathSet) {
+ return staticLoggerBinderPathSet.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 staticLoggerBinderPathSet) {
+ if (isAmbiguousStaticLoggerBinderPathSet(staticLoggerBinderPathSet)) {
+ Util.report("Class path contains multiple SLF4J bindings.");
+ Iterator iterator = staticLoggerBinderPathSet.iterator();
+ while (iterator.hasNext()) {
+ URL path = (URL) iterator.next();
+ Util.report("Found binding in [" + path + "]");
+ }
+ Util.report("See " + MULTIPLE_BINDINGS_URL + " for an explanation.");
+ }
}
+ private static void reportActualBinding(Set staticLoggerBinderPathSet) {
+ if (isAmbiguousStaticLoggerBinderPathSet(staticLoggerBinderPathSet)) {
+ 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.
+ *
+ * @param name The name of the logger.
* @return logger
*/
public static Logger getLogger(String name) {
@@ -256,9 +273,8 @@ public final class LoggerFactory {
/**
* Return a logger named corresponding to the class passed as parameter, using
* the statically bound {@link ILoggerFactory} instance.
- *
- * @param clazz
- * the returned logger will be named after clazz
+ *
+ * @param clazz the returned logger will be named after clazz
* @return logger
*/
public static Logger getLogger(Class clazz) {
@@ -267,29 +283,28 @@ public final class LoggerFactory {
/**
* Return the {@link ILoggerFactory} instance in use.
- *
- * <p>
+ * <p/>
+ * <p/>
* ILoggerFactory instance is bound with this class at compile time.
- *
+ *
* @return the ILoggerFactory instance in use
*/
public static ILoggerFactory getILoggerFactory() {
if (INITIALIZATION_STATE == UNINITIALIZED) {
- INITIALIZATION_STATE = ONGOING_INITILIZATION;
+ INITIALIZATION_STATE = ONGOING_INITIALIZATION;
performInitialization();
-
}
switch (INITIALIZATION_STATE) {
- case SUCCESSFUL_INITILIZATION:
- return StaticLoggerBinder.getSingleton().getLoggerFactory();
- case NOP_FALLBACK_INITILIZATION:
- return NOP_FALLBACK_FACTORY;
- case FAILED_INITILIZATION:
- throw new IllegalStateException(UNSUCCESSFUL_INIT_MSG);
- case ONGOING_INITILIZATION:
- // support re-entrant behavior.
- // See also http://bugzilla.slf4j.org/show_bug.cgi?id=106
- return TEMP_FACTORY;
+ 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://bugzilla.slf4j.org/show_bug.cgi?id=106
+ return TEMP_FACTORY;
}
throw new IllegalStateException("Unreachable code");
}
diff --git a/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index f3ec28b..151f24e 100644
--- a/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -60,14 +60,14 @@ public class StaticLoggerBinder {
public static String REQUESTED_API_VERSION = "1.6"; // !final
private StaticLoggerBinder() {
- throw new UnsupportedOperationException("This code should have never made it into the jar");
+ throw new UnsupportedOperationException("This code should have never made it into slf4j-api.jar");
}
public ILoggerFactory getLoggerFactory() {
- throw new UnsupportedOperationException("This code should never make it into the jar");
+ throw new UnsupportedOperationException("This code should never make it into slf4j-api.jar");
}
public String getLoggerFactoryClassStr() {
- throw new UnsupportedOperationException("This code should never make it into the jar");
+ throw new UnsupportedOperationException("This code should never make it into slf4j-api.jar");
}
}
diff --git a/slf4j-ext/pom.xml b/slf4j-ext/pom.xml
index f331f0a..991c29a 100644
--- a/slf4j-ext/pom.xml
+++ b/slf4j-ext/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-jcl/pom.xml b/slf4j-jcl/pom.xml
index 42df659..98c21ab 100644
--- a/slf4j-jcl/pom.xml
+++ b/slf4j-jcl/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-jdk14/pom.xml b/slf4j-jdk14/pom.xml
index 62817b7..9fa8df7 100644
--- a/slf4j-jdk14/pom.xml
+++ b/slf4j-jdk14/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-log4j12/pom.xml b/slf4j-log4j12/pom.xml
index e1d70a0..c0bbf56 100644
--- a/slf4j-log4j12/pom.xml
+++ b/slf4j-log4j12/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-migrator/pom.xml b/slf4j-migrator/pom.xml
index c4f5f48..57807d7 100644
--- a/slf4j-migrator/pom.xml
+++ b/slf4j-migrator/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-nop/pom.xml b/slf4j-nop/pom.xml
index 9d2f182..3b348f9 100644
--- a/slf4j-nop/pom.xml
+++ b/slf4j-nop/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-osgi-integration-test/pom.xml b/slf4j-osgi-integration-test/pom.xml
index ec4519b..1302ed8 100644
--- a/slf4j-osgi-integration-test/pom.xml
+++ b/slf4j-osgi-integration-test/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-osgi-test-bundle/pom.xml b/slf4j-osgi-test-bundle/pom.xml
index d6da1ab..808a517 100644
--- a/slf4j-osgi-test-bundle/pom.xml
+++ b/slf4j-osgi-test-bundle/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-simple/pom.xml b/slf4j-simple/pom.xml
index b9a131f..757ebbd 100644
--- a/slf4j-simple/pom.xml
+++ b/slf4j-simple/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-site/pom.xml b/slf4j-site/pom.xml
index 7ff8d72..47646e5 100644
--- a/slf4j-site/pom.xml
+++ b/slf4j-site/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.6-SNAPSHOT</version>
+ <version>1.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-site/src/site/pages/codes.html b/slf4j-site/src/site/pages/codes.html
index 8919963..6b24388 100644
--- a/slf4j-site/src/site/pages/codes.html
+++ b/slf4j-site/src/site/pages/codes.html
@@ -150,19 +150,22 @@
<p>SLF4J API is desinged to bind with one and only one underlying
logging framework at a time. If more than one binding is present
on the class path, SLF4J will emit a warning, listing the location
- of those bindings. When this happens, select the one and only one
- binding you wish to use, and remove the other bindings.
- </p>
+ of those bindings.</p>
- <p>For example, if you have both
+ <p>When multiple bindings are available on the class path, select
+ one and only one binding you wish to use, and remove the other
+ bindings. For example, if you have both
<em>slf4j-simple-${version}.jar</em> and
<em>slf4j-nop-${version}.jar</em> on the class path and you wish
to use the nop (no-operation) binding, then remove
- <em>slf4j-simple-${version}.jar</em> from the class path.</p>
+ <em>slf4j-simple-${version}.jar</em> from the class path. If it is
+ not possible to remove the superflous bindings, SLF4J will still
+ bind with one logging framework/implementation. As of version
+ 1.6.6, SLF4J will name the framework/implementation class it is
+ actually bound to.</p>
<p><span class="label notice">Note</span> The warning emitted by
- SLF4J is just that, a warning. SLF4J will still bind with the
- first framework it finds on the class path.
+ SLF4J is just that, a warning.
</p>
<!-- ====================================================== -->
diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html
index 4ad5429..7535468 100644
--- a/slf4j-site/src/site/pages/news.html
+++ b/slf4j-site/src/site/pages/news.html
@@ -29,7 +29,20 @@
<hr noshade="noshade" size="1"/>
- <h3> ... - Release of SLF4J 1.6.6</h3>
+ <h3>11th of June, 2012 of SLF4J 1.6.6</h3>
+
+ <p>In case multiple binding are found on the class path, SLF4J will
+ now output the name the framework/implementation class it is
+ isbound to. This should make</p>
+
+ <p><a
+ href="apidocs/org/slf4j/impl/SimpleLogger.html">SimpleLogger</a>
+ now supports configuration properties. </p>
+
+ <p>LoggerWrapper in the slf4j-ext module now correctly deals with
+ markers. This fixes <a
+ href="http://bugzilla.slf4j.org/show_bug.cgi?id=265">bug #265</a>
+ reported by Dario Campagna.</p>
<p>The log4j-over-slf4j module now supports legacy projects
providing their own log4j <code>LoggerFactory</code>. This fixes <a
-----------------------------------------------------------------------
Summary of changes:
integration/build.xml | 35 +++--
integration/pom.xml | 2 +-
.../slf4j/MissingSingletonMethodAssertionTest.java | 2 +-
.../java/org/slf4j/MultiBindingAssertionTest.java | 15 +--
jcl-over-slf4j/pom.xml | 2 +-
jul-to-slf4j/pom.xml | 2 +-
log4j-over-slf4j/pom.xml | 2 +-
osgi-over-slf4j/pom.xml | 2 +-
pom.xml | 2 +-
slf4j-api/pom.xml | 2 +-
.../src/main/java/org/slf4j/LoggerFactory.java | 181 +++++++++++---------
.../java/org/slf4j/impl/StaticLoggerBinder.java | 6 +-
slf4j-ext/pom.xml | 2 +-
slf4j-jcl/pom.xml | 2 +-
slf4j-jdk14/pom.xml | 2 +-
slf4j-log4j12/pom.xml | 2 +-
slf4j-migrator/pom.xml | 2 +-
slf4j-nop/pom.xml | 2 +-
slf4j-osgi-integration-test/pom.xml | 2 +-
slf4j-osgi-test-bundle/pom.xml | 2 +-
slf4j-simple/pom.xml | 2 +-
slf4j-site/pom.xml | 2 +-
slf4j-site/src/site/pages/codes.html | 17 +-
slf4j-site/src/site/pages/news.html | 15 ++-
24 files changed, 169 insertions(+), 136 deletions(-)
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0

[GIT] SLF4J: Simple Logging Facade for Java branch master updated. v_1.6.5-6-g3e24a5c
by git-noreply@pixie.qos.ch 11 Jun '12
by git-noreply@pixie.qos.ch 11 Jun '12
11 Jun '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via 3e24a5c715dcd3a8597ba811716152af9aa2a37d (commit)
via 28888760f52700bedb40594b04edd1501cd3b4d6 (commit)
via aa26ba12ec328af87609906238e1422e6f0f3ce1 (commit)
from e4f061bdc2ecf0b86544203cb1c8a45e54654daa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=3e24a5c715dcd3a8597ba81171…
http://github.com/ceki/slf4j/commit/3e24a5c715dcd3a8597ba811716152af9aa2a37d
commit 3e24a5c715dcd3a8597ba811716152af9aa2a37d
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Jun 11 16:14:39 2012 +0200
fix bug 234
diff --git a/integration/src/test/java/org/slf4j/IncompatibleMultiBindingAssertionTest.java b/integration/src/test/java/org/slf4j/IncompatibleMultiBindingAssertionTest.java
new file mode 100644
index 0000000..455da4b
--- /dev/null
+++ b/integration/src/test/java/org/slf4j/IncompatibleMultiBindingAssertionTest.java
@@ -0,0 +1,75 @@
+/**
+ * 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/slf4j-ext/src/main/java/org/slf4j/ext/LoggerWrapper.java b/slf4j-ext/src/main/java/org/slf4j/ext/LoggerWrapper.java
index d776c1f..c1aeaff 100644
--- a/slf4j-ext/src/main/java/org/slf4j/ext/LoggerWrapper.java
+++ b/slf4j-ext/src/main/java/org/slf4j/ext/LoggerWrapper.java
@@ -163,7 +163,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void trace(Marker marker, String msg) {
- if (!logger.isTraceEnabled())
+ if (!logger.isTraceEnabled(marker))
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
@@ -177,7 +177,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void trace(Marker marker, String format, Object arg) {
- if (!logger.isTraceEnabled())
+ if (!logger.isTraceEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg)
@@ -194,7 +194,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void trace(Marker marker, String format, Object arg1, Object arg2) {
- if (!logger.isTraceEnabled())
+ if (!logger.isTraceEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2)
@@ -211,7 +211,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void trace(Marker marker, String format, Object[] argArray) {
- if (!logger.isTraceEnabled())
+ if (!logger.isTraceEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray)
@@ -227,7 +227,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void trace(Marker marker, String msg, Throwable t) {
- if (!logger.isTraceEnabled())
+ if (!logger.isTraceEnabled(marker))
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
@@ -338,7 +338,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void debug(Marker marker, String msg) {
- if (!logger.isDebugEnabled())
+ if (!logger.isDebugEnabled(marker))
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
@@ -352,7 +352,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void debug(Marker marker, String format, Object arg) {
- if (!logger.isDebugEnabled())
+ if (!logger.isDebugEnabled(marker))
return;
if (instanceofLAL) {
FormattingTuple ft = MessageFormatter.format(format, arg);
@@ -368,7 +368,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void debug(Marker marker, String format, Object arg1, Object arg2) {
- if (!logger.isDebugEnabled())
+ if (!logger.isDebugEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2)
@@ -385,7 +385,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void debug(Marker marker, String format, Object[] argArray) {
- if (!logger.isDebugEnabled())
+ if (!logger.isDebugEnabled(marker))
return;
if (instanceofLAL) {
@@ -402,7 +402,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void debug(Marker marker, String msg, Throwable t) {
- if (!logger.isDebugEnabled())
+ if (!logger.isDebugEnabled(marker))
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
@@ -513,7 +513,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void info(Marker marker, String msg) {
- if (!logger.isInfoEnabled())
+ if (!logger.isInfoEnabled(marker))
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
@@ -527,7 +527,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void info(Marker marker, String format, Object arg) {
- if (!logger.isInfoEnabled())
+ if (!logger.isInfoEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg)
@@ -544,7 +544,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void info(Marker marker, String format, Object arg1, Object arg2) {
- if (!logger.isInfoEnabled())
+ if (!logger.isInfoEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2)
@@ -561,7 +561,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void info(Marker marker, String format, Object[] argArray) {
- if (!logger.isInfoEnabled())
+ if (!logger.isInfoEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray)
@@ -577,7 +577,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void info(Marker marker, String msg, Throwable t) {
- if (!logger.isInfoEnabled())
+ if (!logger.isInfoEnabled(marker))
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
@@ -685,7 +685,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void warn(Marker marker, String msg) {
- if (!logger.isWarnEnabled())
+ if (!logger.isWarnEnabled(marker))
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
@@ -699,7 +699,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void warn(Marker marker, String format, Object arg) {
- if (!logger.isWarnEnabled())
+ if (!logger.isWarnEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg)
@@ -716,7 +716,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void warn(Marker marker, String format, Object arg1, Object arg2) {
- if (!logger.isWarnEnabled())
+ if (!logger.isWarnEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2)
@@ -733,7 +733,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void warn(Marker marker, String format, Object[] argArray) {
- if (!logger.isWarnEnabled())
+ if (!logger.isWarnEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray)
@@ -749,7 +749,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void warn(Marker marker, String msg, Throwable t) {
- if (!logger.isWarnEnabled())
+ if (!logger.isWarnEnabled(marker))
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
@@ -860,7 +860,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void error(Marker marker, String msg) {
- if (!logger.isErrorEnabled())
+ if (!logger.isErrorEnabled(marker))
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
@@ -874,7 +874,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void error(Marker marker, String format, Object arg) {
- if (!logger.isErrorEnabled())
+ if (!logger.isErrorEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg)
@@ -891,7 +891,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void error(Marker marker, String format, Object arg1, Object arg2) {
- if (!logger.isErrorEnabled())
+ if (!logger.isErrorEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2)
@@ -908,7 +908,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void error(Marker marker, String format, Object[] argArray) {
- if (!logger.isErrorEnabled())
+ if (!logger.isErrorEnabled(marker))
return;
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray)
@@ -924,7 +924,7 @@ public class LoggerWrapper implements Logger {
* Delegate to the appropriate method of the underlying logger.
*/
public void error(Marker marker, String msg, Throwable t) {
- if (!logger.isErrorEnabled())
+ if (!logger.isErrorEnabled(marker))
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=28888760f52700bedb40594b04…
http://github.com/ceki/slf4j/commit/28888760f52700bedb40594b04edd1501cd3b4d6
commit 28888760f52700bedb40594b04edd1501cd3b4d6
Merge: e4f061b aa26ba1
Author: javabean <GitHub(a)cedrik.fr>
Date: Fri Jun 8 09:04:49 2012 -0700
Merge pull request #18 from javabean/bug186
Bug 186: light-weight configuration like commons-logging's SimpleLog
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=aa26ba12ec328af87609906238…
http://github.com/ceki/slf4j/commit/aa26ba12ec328af87609906238e1422e6f0f3ce1
commit aa26ba12ec328af87609906238e1422e6f0f3ce1
Author: Cédrik LIME <github(a)cedrik.fr>
Date: Fri Jun 8 15:59:56 2012 +0200
Light-weight configuration like commons-logging's SimpleLog
Improve SimpleLogger to be more like commons-logging's SimpleLog,
including look-alike configuration file.
If no configuration file is found, behave like the previous revision of
this (SimpleLogger).
diff --git a/slf4j-simple/src/main/java/org/slf4j/impl/SimpleLogger.java b/slf4j-simple/src/main/java/org/slf4j/impl/SimpleLogger.java
index 7dc0da4..a8587a8 100644
--- a/slf4j-simple/src/main/java/org/slf4j/impl/SimpleLogger.java
+++ b/slf4j-simple/src/main/java/org/slf4j/impl/SimpleLogger.java
@@ -1,366 +1,635 @@
/**
* 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,
+ * 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
+ *
+ * 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.FormattingTuple;
-import org.slf4j.helpers.MarkerIgnoringBase;
-import org.slf4j.helpers.MessageFormatter;
-
-/**
- * A simple (and direct) implementation that logs messages of level INFO or
- * higher on the console (<code>System.err<code>).
- *
- * <p>The output includes the relative time in milliseconds, thread
- * name, the level, logger name, and the message followed by the line
- * separator for the host. In log4j terms it amounts to the "%r [%t]
- * %level %logger - %m%n" pattern. </p>
- *
- * <p>Sample output follows.</p>
-<pre>
-176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse order.
-225 [main] INFO examples.SortAlgo - Entered the sort method.
-304 [main] INFO examples.SortAlgo - Dump of integer array:
-317 [main] INFO examples.SortAlgo - Element [0] = 0
-331 [main] INFO examples.SortAlgo - Element [1] = 1
-343 [main] INFO examples.Sort - The next log statement should be an error message.
-346 [main] ERROR examples.SortAlgo - Tried to dump an uninitialized array.
- at org.log4j.examples.SortAlgo.dump(SortAlgo.java:58)
- at org.log4j.examples.Sort.main(Sort.java:64)
-467 [main] INFO examples.Sort - Exiting main method.
-</pre>
- *
- * @author Ceki Gülcü
- */
-public class SimpleLogger extends MarkerIgnoringBase {
-
- private static final long serialVersionUID = -6560244151660620173L;
-
- /**
- * Mark the time when this class gets loaded into memory.
- */
- private static long startTime = System.currentTimeMillis();
- public static final String LINE_SEPARATOR = System
- .getProperty("line.separator");
- private static String INFO_STR = "INFO";
- private static String WARN_STR = "WARN";
- private static String ERROR_STR = "ERROR";
-
- /**
- * Package access allows only {@link SimpleLoggerFactory} to instantiate
- * SimpleLogger instances.
- */
- SimpleLogger(String name) {
- this.name = name;
- }
-
- /**
- * Always returns false.
- *
- * @return always false
- */
- public boolean isTraceEnabled() {
- return false;
- }
-
- /**
- * A NOP implementation, as this logger is permanently disabled for the TRACE
- * level.
- */
- public void trace(String msg) {
- // NOP
- }
-
- /**
- * A NOP implementation, as this logger is permanently disabled for the TRACE
- * level.
- */
- public void trace(String format, Object param1) {
- // NOP
- }
-
- /**
- * A NOP implementation, as this logger is permanently disabled for the TRACE
- * level.
- */
- public void trace(String format, Object param1, Object param2) {
- // NOP
- }
-
- public void trace(String format, Object[] argArray) {
- // NOP
- }
-
- /**
- * A NOP implementation, as this logger is permanently disabled for the TRACE
- * level.
- */
- public void trace(String msg, Throwable t) {
- // NOP
- }
-
- /**
- * Always returns false.
- *
- * @return always false
- */
- public boolean isDebugEnabled() {
- return false;
- }
-
- /**
- * A NOP implementation, as this logger is permanently disabled for the DEBUG
- * level.
- */
- public void debug(String msg) {
- // NOP
- }
-
- /**
- * A NOP implementation, as this logger is permanently disabled for the DEBUG
- * level.
- */
- public void debug(String format, Object param1) {
- // NOP
- }
-
- /**
- * A NOP implementation, as this logger is permanently disabled for the DEBUG
- * level.
- */
- public void debug(String format, Object param1, Object param2) {
- // NOP
- }
-
- public void debug(String format, Object[] argArray) {
- // NOP
- }
-
- /**
- * A NOP implementation, as this logger is permanently disabled for the DEBUG
- * level.
- */
- public void debug(String msg, Throwable t) {
- // NOP
- }
-
- /**
- * This is our internal implementation for logging regular (non-parameterized)
- * log messages.
- *
- * @param level
- * @param message
- * @param t
- */
- private void log(String level, String message, Throwable t) {
- StringBuffer buf = new StringBuffer();
-
- long millis = System.currentTimeMillis();
- buf.append(millis - startTime);
-
- buf.append(" [");
- buf.append(Thread.currentThread().getName());
- buf.append("] ");
-
- buf.append(level);
- buf.append(" ");
-
- buf.append(name);
- buf.append(" - ");
-
- buf.append(message);
-
- buf.append(LINE_SEPARATOR);
-
- System.err.print(buf.toString());
- if (t != null) {
- t.printStackTrace(System.err);
- }
- System.err.flush();
- }
-
- /**
- * For formatted messages, first substitute arguments and then log.
- *
- * @param level
- * @param format
- * @param param1
- * @param param2
- */
- private void formatAndLog(String level, String format, Object arg1,
- Object arg2) {
- FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
- log(level, tp.getMessage(), tp.getThrowable());
- }
-
- /**
- * For formatted messages, first substitute arguments and then log.
- *
- * @param level
- * @param format
- * @param argArray
- */
- private void formatAndLog(String level, String format, Object[] argArray) {
- FormattingTuple tp = MessageFormatter.arrayFormat(format, argArray);
- log(level, tp.getMessage(), tp.getThrowable());
- }
-
- /**
- * Always returns true.
- */
- public boolean isInfoEnabled() {
- return true;
- }
-
- /**
- * A simple implementation which always logs messages of level INFO according
- * to the format outlined above.
- */
- public void info(String msg) {
- log(INFO_STR, msg, null);
- }
-
- /**
- * Perform single parameter substitution before logging the message of level
- * INFO according to the format outlined above.
- */
- public void info(String format, Object arg) {
- formatAndLog(INFO_STR, format, arg, null);
- }
-
- /**
- * Perform double parameter substitution before logging the message of level
- * INFO according to the format outlined above.
- */
- public void info(String format, Object arg1, Object arg2) {
- formatAndLog(INFO_STR, format, arg1, arg2);
- }
-
- /**
- * Perform double parameter substitution before logging the message of level
- * INFO according to the format outlined above.
- */
- public void info(String format, Object[] argArray) {
- formatAndLog(INFO_STR, format, argArray);
- }
-
- /**
- * Log a message of level INFO, including an exception.
- */
- public void info(String msg, Throwable t) {
- log(INFO_STR, msg, t);
- }
-
- /**
- * Always returns true.
- */
- public boolean isWarnEnabled() {
- return true;
- }
-
- /**
- * A simple implementation which always logs messages of level WARN according
- * to the format outlined above.
- */
- public void warn(String msg) {
- log(WARN_STR, msg, null);
- }
-
- /**
- * Perform single parameter substitution before logging the message of level
- * WARN according to the format outlined above.
- */
- public void warn(String format, Object arg) {
- formatAndLog(WARN_STR, format, arg, null);
- }
-
- /**
- * Perform double parameter substitution before logging the message of level
- * WARN according to the format outlined above.
- */
- public void warn(String format, Object arg1, Object arg2) {
- formatAndLog(WARN_STR, format, arg1, arg2);
- }
-
- /**
- * Perform double parameter substitution before logging the message of level
- * WARN according to the format outlined above.
- */
- public void warn(String format, Object[] argArray) {
- formatAndLog(WARN_STR, format, argArray);
- }
-
- /**
- * Log a message of level WARN, including an exception.
- */
- public void warn(String msg, Throwable t) {
- log(WARN_STR, msg, t);
- }
-
- /**
- * Always returns true.
- */
- public boolean isErrorEnabled() {
- return true;
- }
-
- /**
- * A simple implementation which always logs messages of level ERROR according
- * to the format outlined above.
- */
- public void error(String msg) {
- log(ERROR_STR, msg, null);
- }
-
- /**
- * Perform single parameter substitution before logging the message of level
- * ERROR according to the format outlined above.
- */
- public void error(String format, Object arg) {
- formatAndLog(ERROR_STR, format, arg, null);
- }
-
- /**
- * Perform double parameter substitution before logging the message of level
- * ERROR according to the format outlined above.
- */
- public void error(String format, Object arg1, Object arg2) {
- formatAndLog(ERROR_STR, format, arg1, arg2);
- }
-
- /**
- * Perform double parameter substitution before logging the message of level
- * ERROR according to the format outlined above.
- */
- public void error(String format, Object[] argArray) {
- formatAndLog(ERROR_STR, format, argArray);
- }
-
- /**
- * Log a message of level ERROR, including an exception.
- */
- public void error(String msg, Throwable t) {
- log(ERROR_STR, msg, t);
- }
-}
+ *
+ */
+
+package org.slf4j.impl;
+
+import java.io.InputStream;
+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.slf4j.Logger;
+import org.slf4j.helpers.FormattingTuple;
+import org.slf4j.helpers.MarkerIgnoringBase;
+import org.slf4j.helpers.MessageFormatter;
+import org.slf4j.helpers.Util;
+import org.slf4j.spi.LocationAwareLogger;
+
+/**
+ * <p>Simple implementation of {@link Logger} that sends all enabled log messages,
+ * for all defined loggers, to the console ({@code System.err}).
+ * The following system properties are supported to configure the behavior of this logger:</p>
+ * <ul>
+ * <li><code>org.slf4j.simplelogger.defaultlog</code> -
+ * Default logging detail level for all instances of SimpleLogger.
+ * Must be one of ("trace", "debug", "info", "warn", or "error").
+ * If not specified, defaults to "info". </li>
+ * <li><code>org.slf4j.simplelogger.log.xxxxx</code> -
+ * Logging detail level for a SimpleLogger instance named "xxxxx".
+ * Must be one of ("trace", "debug", "info", "warn", or "error").
+ * If not specified, the default logging detail level is used.</li>
+ * <li><code>org.slf4j.simplelogger.showdatetime</code> -
+ * Set to <code>true</code> if you want the current date and time
+ * to be included in output messages. Default is <code>false</code>,
+ * and will output the number of milliseconds elapsed since startup.</li>
+ * <li><code>org.slf4j.simplelogger.dateTimeFormat</code> -
+ * 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 <code>java.text.SimpleDateFormat</code>. If the format is not
+ * specified or is invalid, the default format is used.
+ * The default format is <code>yyyy-MM-dd HH:mm:ss:SSS Z</code>.</li>
+ * <li><code>org.slf4j.simplelogger.showthreadname</code> -
+ * Set to <code>true</code> if you want to output the current thread name.
+ * Defaults to <code>true</code>.</li>
+ * <li><code>org.slf4j.simplelogger.showlogname</code> -
+ * Set to <code>true</code> if you want the Logger instance name to be
+ * included in output messages. Defaults to <code>true</code>.</li>
+ * <li><code>org.slf4j.simplelogger.showShortLogname</code> -
+ * Set to <code>true</code> if you want the last component of the name to be
+ * included in output messages. Defaults to <code>false</code>.</li>
+ * </ul>
+ *
+ * <p>In addition to looking for system properties with the names specified
+ * above, this implementation also checks for a class loader resource named
+ * <code>"simplelogger.properties"</code>, and includes any matching definitions
+ * from this resource (if it exists).</p>
+ *
+ *
+ * <p>With no configurationn, the default output includes the relative time in milliseconds,
+ * thread name, the level, logger name, and the message followed by the line
+ * separator for the host. In log4j terms it amounts to the "%r [%t]
+ * %level %logger - %m%n" pattern. </p>
+ *
+ * <p>Sample output follows.</p>
+<pre>
+176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse order.
+225 [main] INFO examples.SortAlgo - Entered the sort method.
+304 [main] INFO examples.SortAlgo - Dump of integer array:
+317 [main] INFO examples.SortAlgo - Element [0] = 0
+331 [main] INFO examples.SortAlgo - Element [1] = 1
+343 [main] INFO examples.Sort - The next log statement should be an error message.
+346 [main] ERROR examples.SortAlgo - Tried to dump an uninitialized array.
+ at org.log4j.examples.SortAlgo.dump(SortAlgo.java:58)
+ at org.log4j.examples.Sort.main(Sort.java:64)
+467 [main] INFO examples.Sort - Exiting main method.
+</pre>
+ *
+ * <p>This implementation is heavily inspired by
+ * <a href="http://commons.apache.org/logging/">Apache Commons Logging</a>'s SimpleLog.
+ *
+ * @author Ceki Gülcü
+ * @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
+ * @author Rod Waldhoff
+ * @author Robert Burrell Donkin
+ * @author Cédrik LIME
+ */
+public class SimpleLogger extends MarkerIgnoringBase {
+
+ private static final long serialVersionUID = -632788891211436180L;
+
+ /**
+ * Mark the time when this class gets loaded into memory.
+ */
+ private static long startTime = System.currentTimeMillis();
+
+ private static final String CONFIGURATION_FILE = "simplelogger.properties";
+
+ /** All system properties used by <code>SimpleLogger</code> start with this */
+ private static final String systemPrefix = "org.slf4j.simplelogger.";
+
+ /** Properties loaded from simplelogger.properties */
+ private static final Properties simpleLoggerProps = new Properties();
+
+ /** The default format to use when formating dates */
+ private static final String DEFAULT_DATE_TIME_FORMAT =
+ "yyyy-MM-dd HH:mm:ss:SSS Z";
+
+ /** Include the instance name in the log message? */
+ private static boolean showLogName = true;
+ /** 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.
+ */
+ private static boolean showShortName = false;
+ /** Include the current time in the log message */
+ private static boolean showDateTime = false;
+ /** The date and time format to use in the log message */
+ private static String dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
+
+ /** Include the current thread name in the log message */
+ private static boolean showThreadName = true;
+
+ /**
+ * Used to format times.
+ * <p>
+ * Any code that accesses this object should first obtain a lock on it,
+ * ie use synchronized(dateFormatter); this requirement is
+ * to fix an existing thread safety bug (SimpleDateFormat.format
+ * is not thread-safe).
+ */
+ private static DateFormat dateFormatter = null;
+
+ /** "Trace" level logging. */
+ public static final int LOG_LEVEL_TRACE = LocationAwareLogger.TRACE_INT;
+ /** "Debug" level logging. */
+ public static final int LOG_LEVEL_DEBUG = LocationAwareLogger.DEBUG_INT;
+ /** "Info" level logging. */
+ public static final int LOG_LEVEL_INFO = LocationAwareLogger.INFO_INT;
+ /** "Warn" level logging. */
+ public static final int LOG_LEVEL_WARN = LocationAwareLogger.WARN_INT;
+ /** "Error" level logging. */
+ public static final int LOG_LEVEL_ERROR = LocationAwareLogger.ERROR_INT;
+ /** "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 - 10);
+
+ /** Enable no logging levels */
+ public static final int LOG_LEVEL_OFF = (LOG_LEVEL_ERROR + 10);
+
+
+ private static String getStringProperty(String name) {
+ String prop = null;
+ try {
+ prop = System.getProperty(name);
+ } catch (SecurityException e) {
+ ; // Ignore
+ }
+ return (prop == null) ? simpleLoggerProps.getProperty(name) : prop;
+ }
+
+ private static String getStringProperty(String name, String defaultValue) {
+ String prop = getStringProperty(name);
+ return (prop == null) ? defaultValue : prop;
+ }
+
+ private static boolean getBooleanProperty(String name, boolean defaultValue) {
+ String prop = getStringProperty(name);
+ return (prop == null) ? defaultValue : "true".equalsIgnoreCase(prop);
+ }
+
+ // Initialize class attributes.
+ // Load properties file, if found.
+ // Override with system properties.
+ static {
+ // Add props from the resource simplelogger.properties
+ InputStream in = (InputStream)AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ ClassLoader threadCL = Thread.currentThread().getContextClassLoader();
+ if (threadCL != null) {
+ return threadCL.getResourceAsStream(CONFIGURATION_FILE);
+ } else {
+ return ClassLoader.getSystemResourceAsStream(CONFIGURATION_FILE);
+ }
+ }
+ });
+ if(null != in) {
+ try {
+ simpleLoggerProps.load(in);
+ in.close();
+ } catch(java.io.IOException e) {
+ // ignored
+ }
+ }
+
+ showLogName = getBooleanProperty(systemPrefix + "showlogname", showLogName);
+ showShortName = getBooleanProperty(systemPrefix + "showShortLogname", showShortName);
+ showDateTime = getBooleanProperty(systemPrefix + "showdatetime", showDateTime);
+ showThreadName = getBooleanProperty(systemPrefix + "showthreadname", showThreadName);
+ dateTimeFormat = getStringProperty(systemPrefix + "dateTimeFormat", dateTimeFormat);
+
+ if(showDateTime) {
+ try {
+ dateFormatter = new SimpleDateFormat(dateTimeFormat);
+ } catch(IllegalArgumentException e) {
+ Util.report("Bad date format in " + CONFIGURATION_FILE + "; reverting to default", e);
+ // If the format pattern is invalid - use the default format
+ dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
+ dateFormatter = new SimpleDateFormat(dateTimeFormat);
+ }
+ }
+ }
+
+
+ /** The name of this simple log instance */
+ //protected String logName = null;// == name
+ /** The current log level */
+ protected int currentLogLevel = LOG_LEVEL_INFO;
+ /** The short name of this simple log instance */
+ private transient String shortLogName = null;
+
+ /**
+ * Package access allows only {@link SimpleLoggerFactory} to instantiate
+ * SimpleLogger instances.
+ */
+ SimpleLogger(String name) {
+ this.name = name;
+
+ // Set initial log level
+ this.currentLogLevel = LOG_LEVEL_INFO;
+
+ // Set log level from properties
+ String lvl = getStringProperty(systemPrefix + "log." + name);
+ 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)) {
+ this.currentLogLevel = LOG_LEVEL_ALL;
+ } else if("trace".equalsIgnoreCase(lvl)) {
+ this.currentLogLevel = LOG_LEVEL_TRACE;
+ } else if("debug".equalsIgnoreCase(lvl)) {
+ this.currentLogLevel = LOG_LEVEL_DEBUG;
+ } else if("info".equalsIgnoreCase(lvl)) {
+ this.currentLogLevel = LOG_LEVEL_INFO;
+ } else if("warn".equalsIgnoreCase(lvl)) {
+ this.currentLogLevel = LOG_LEVEL_WARN;
+ } else if("error".equalsIgnoreCase(lvl)) {
+ this.currentLogLevel = LOG_LEVEL_ERROR;
+// } else if("fatal".equalsIgnoreCase(lvl)) {
+// setLevel(LOG_LEVEL_FATAL);
+ } else if("off".equalsIgnoreCase(lvl)) {
+ this.currentLogLevel = LOG_LEVEL_OFF;
+ }
+ }
+
+
+ /**
+ * This is our internal implementation for logging regular (non-parameterized)
+ * log messages.
+ *
+ * @param level One of the LOG_LEVEL_XXX constants defining the log level
+ * @param message The message itself
+ * @param t The exception whose stack trace should be logged
+ */
+ private void log(int level, String message, Throwable t) {
+ if (! isLevelEnabled(level)) {
+ return;
+ }
+
+ StringBuffer buf = new StringBuffer(32);
+
+ // Append date-time if so configured
+ if(showDateTime) {
+ Date now = new Date();
+ String dateText;
+ synchronized(dateFormatter) {
+ dateText = dateFormatter.format(now);
+ }
+ buf.append(dateText);
+ buf.append(' ');
+ } else {
+ buf.append(System.currentTimeMillis() - startTime);
+ buf.append(' ');
+ }
+
+ // Append current thread name if so configured
+ if (showThreadName) {
+ buf.append('[');
+ buf.append(Thread.currentThread().getName());
+ buf.append("] ");
+ }
+
+ // Append a readable representation of the log level
+ switch(level) {
+ case LOG_LEVEL_TRACE: buf.append("TRACE"); break;
+ case LOG_LEVEL_DEBUG: buf.append("DEBUG"); break;
+ case LOG_LEVEL_INFO: buf.append("INFO"); break;
+ case LOG_LEVEL_WARN: buf.append("WARN"); break;
+ case LOG_LEVEL_ERROR: buf.append("ERROR"); break;
+// case LOG_LEVEL_FATAL: buf.append("[FATAL] "); break;
+ }
+ buf.append(' ');
+
+ // 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 = name.substring(name.lastIndexOf(".") + 1);
+ shortLogName =
+ shortLogName.substring(shortLogName.lastIndexOf("/") + 1);
+ }
+ buf.append(String.valueOf(shortLogName)).append(" - ");
+ } else if(showLogName) {
+ buf.append(String.valueOf(name)).append(" - ");
+ }
+
+ // Append the message
+ buf.append(message);
+
+ System.err.println(buf.toString());
+ // Append stack trace if not null
+ if (t != null) {
+ t.printStackTrace(System.err);
+ }
+ System.err.flush();
+ }
+
+ /**
+ * For formatted messages, first substitute arguments and then log.
+ *
+ * @param level
+ * @param format
+ * @param param1
+ * @param param2
+ */
+ private void formatAndLog(int level, String format, Object arg1,
+ Object arg2) {
+ if (! isLevelEnabled(level)) {
+ return;
+ }
+ FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
+ log(level, tp.getMessage(), tp.getThrowable());
+ }
+
+ /**
+ * For formatted messages, first substitute arguments and then log.
+ *
+ * @param level
+ * @param format
+ * @param argArray
+ */
+ private void formatAndLog(int level, String format, Object[] argArray) {
+ if (! isLevelEnabled(level)) {
+ return;
+ }
+ FormattingTuple tp = MessageFormatter.arrayFormat(format, argArray);
+ log(level, tp.getMessage(), tp.getThrowable());
+ }
+
+ /**
+ * 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);
+ }
+
+
+ /**
+ * Are {@code trace} messages currently enabled?
+ */
+ public boolean isTraceEnabled() {
+ return isLevelEnabled(LOG_LEVEL_TRACE);
+ }
+
+ /**
+ * A simple implementation which logs messages of level TRACE according
+ * to the format outlined above.
+ */
+ public void trace(String msg) {
+ log(LOG_LEVEL_TRACE, msg, null);
+ }
+
+ /**
+ * Perform single parameter substitution before logging the message of level
+ * TRACE according to the format outlined above.
+ */
+ public void trace(String format, Object param1) {
+ formatAndLog(LOG_LEVEL_TRACE, format, param1, null);
+ }
+
+ /**
+ * Perform double parameter substitution before logging the message of level
+ * TRACE according to the format outlined above.
+ */
+ public void trace(String format, Object param1, Object param2) {
+ formatAndLog(LOG_LEVEL_TRACE, format, param1, param2);
+ }
+
+ /**
+ * Perform double parameter substitution before logging the message of level
+ * TRACE according to the format outlined above.
+ */
+ public void trace(String format, Object[] argArray) {
+ formatAndLog(LOG_LEVEL_TRACE, format, argArray);
+ }
+
+ /**
+ * Log a message of level TRACE, including an exception.
+ */
+ public void trace(String msg, Throwable t) {
+ log(LOG_LEVEL_TRACE, msg, t);
+ }
+
+ /**
+ * Are {@code debug} messages currently enabled?
+ */
+ public boolean isDebugEnabled() {
+ return isLevelEnabled(LOG_LEVEL_DEBUG);
+ }
+
+ /**
+ * A simple implementation which logs messages of level DEBUG according
+ * to the format outlined above.
+ */
+ public void debug(String msg) {
+ log(LOG_LEVEL_DEBUG, msg, null);
+ }
+
+ /**
+ * Perform single parameter substitution before logging the message of level
+ * DEBUG according to the format outlined above.
+ */
+ public void debug(String format, Object param1) {
+ formatAndLog(LOG_LEVEL_DEBUG, format, param1, null);
+ }
+
+ /**
+ * Perform double parameter substitution before logging the message of level
+ * DEBUG according to the format outlined above.
+ */
+ public void debug(String format, Object param1, Object param2) {
+ formatAndLog(LOG_LEVEL_DEBUG, format, param1, param2);
+ }
+
+ /**
+ * Perform double parameter substitution before logging the message of level
+ * DEBUG according to the format outlined above.
+ */
+ public void debug(String format, Object[] argArray) {
+ formatAndLog(LOG_LEVEL_DEBUG, format, argArray);
+ }
+
+ /**
+ * Log a message of level DEBUG, including an exception.
+ */
+ public void debug(String msg, Throwable t) {
+ log(LOG_LEVEL_DEBUG, msg, t);
+ }
+
+ /**
+ * Are {@code info} messages currently enabled?
+ */
+ public boolean isInfoEnabled() {
+ return isLevelEnabled(LOG_LEVEL_INFO);
+ }
+
+ /**
+ * A simple implementation which logs messages of level INFO according
+ * to the format outlined above.
+ */
+ public void info(String msg) {
+ log(LOG_LEVEL_INFO, msg, null);
+ }
+
+ /**
+ * Perform single parameter substitution before logging the message of level
+ * INFO according to the format outlined above.
+ */
+ public void info(String format, Object arg) {
+ formatAndLog(LOG_LEVEL_INFO, format, arg, null);
+ }
+
+ /**
+ * Perform double parameter substitution before logging the message of level
+ * INFO according to the format outlined above.
+ */
+ public void info(String format, Object arg1, Object arg2) {
+ formatAndLog(LOG_LEVEL_INFO, format, arg1, arg2);
+ }
+
+ /**
+ * Perform double parameter substitution before logging the message of level
+ * INFO according to the format outlined above.
+ */
+ public void info(String format, Object[] argArray) {
+ formatAndLog(LOG_LEVEL_INFO, format, argArray);
+ }
+
+ /**
+ * Log a message of level INFO, including an exception.
+ */
+ public void info(String msg, Throwable t) {
+ log(LOG_LEVEL_INFO, msg, t);
+ }
+
+ /**
+ * Are {@code warn} messages currently enabled?
+ */
+ public boolean isWarnEnabled() {
+ return isLevelEnabled(LOG_LEVEL_WARN);
+ }
+
+ /**
+ * A simple implementation which always logs messages of level WARN according
+ * to the format outlined above.
+ */
+ public void warn(String msg) {
+ log(LOG_LEVEL_WARN, msg, null);
+ }
+
+ /**
+ * Perform single parameter substitution before logging the message of level
+ * WARN according to the format outlined above.
+ */
+ public void warn(String format, Object arg) {
+ formatAndLog(LOG_LEVEL_WARN, format, arg, null);
+ }
+
+ /**
+ * Perform double parameter substitution before logging the message of level
+ * WARN according to the format outlined above.
+ */
+ public void warn(String format, Object arg1, Object arg2) {
+ formatAndLog(LOG_LEVEL_WARN, format, arg1, arg2);
+ }
+
+ /**
+ * Perform double parameter substitution before logging the message of level
+ * WARN according to the format outlined above.
+ */
+ public void warn(String format, Object[] argArray) {
+ formatAndLog(LOG_LEVEL_WARN, format, argArray);
+ }
+
+ /**
+ * Log a message of level WARN, including an exception.
+ */
+ public void warn(String msg, Throwable t) {
+ log(LOG_LEVEL_WARN, msg, t);
+ }
+
+ /**
+ * Are {@code error} messages currently enabled?
+ */
+ public boolean isErrorEnabled() {
+ return isLevelEnabled(LOG_LEVEL_ERROR);
+ }
+
+ /**
+ * A simple implementation which always logs messages of level ERROR according
+ * to the format outlined above.
+ */
+ public void error(String msg) {
+ log(LOG_LEVEL_ERROR, msg, null);
+ }
+
+ /**
+ * Perform single parameter substitution before logging the message of level
+ * ERROR according to the format outlined above.
+ */
+ public void error(String format, Object arg) {
+ formatAndLog(LOG_LEVEL_ERROR, format, arg, null);
+ }
+
+ /**
+ * Perform double parameter substitution before logging the message of level
+ * ERROR according to the format outlined above.
+ */
+ public void error(String format, Object arg1, Object arg2) {
+ formatAndLog(LOG_LEVEL_ERROR, format, arg1, arg2);
+ }
+
+ /**
+ * Perform double parameter substitution before logging the message of level
+ * ERROR according to the format outlined above.
+ */
+ public void error(String format, Object[] argArray) {
+ formatAndLog(LOG_LEVEL_ERROR, format, argArray);
+ }
+
+ /**
+ * Log a message of level ERROR, including an exception.
+ */
+ public void error(String msg, Throwable t) {
+ log(LOG_LEVEL_ERROR, msg, t);
+ }
+}
diff --git a/slf4j-simple/src/test/resources/simplelogger.properties b/slf4j-simple/src/test/resources/simplelogger.properties
new file mode 100644
index 0000000..dc9d4f0
--- /dev/null
+++ b/slf4j-simple/src/test/resources/simplelogger.properties
@@ -0,0 +1,34 @@
+# SLF4J's SimpleLogger configuration file
+# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err.
+
+# Default logging detail level for all instances of SimpleLogger.
+# Must be one of ("trace", "debug", "info", "warn", or "error").
+# If not specified, defaults to "info".
+#org.slf4j.simplelogger.defaultlog=info
+
+# Logging detail level for a SimpleLogger instance named "xxxxx".
+# Must be one of ("trace", "debug", "info", "warn", or "error").
+# If not specified, the default logging detail level is used.
+#org.slf4j.simplelogger.log.xxxxx=
+
+# Set to true if you want the current date and time to be included in output messages.
+# Default is false, and will output the number of milliseconds elapsed since startup.
+#org.slf4j.simplelogger.showdatetime=false
+
+# 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 Z.
+#org.slf4j.simplelogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z
+
+# Set to true if you want to output the current thread name.
+# Defaults to true.
+#org.slf4j.simplelogger.showthreadname=true
+
+# Set to true if you want the Logger instance name to be included in output messages.
+# Defaults to true.
+#org.slf4j.simplelogger.showlogname=true
+
+# Set to true if you want the last component of the name to be included in output messages.
+# Defaults to false.
+#org.slf4j.simplelogger.showShortLogname=false
-----------------------------------------------------------------------
Summary of changes:
... => IncompatibleMultiBindingAssertionTest.java} | 4 +-
.../src/main/java/org/slf4j/ext/LoggerWrapper.java | 50 +-
.../src/main/java/org/slf4j/impl/SimpleLogger.java | 975 +++++++++++++-------
.../src/test/resources/simplelogger.properties | 34 +
4 files changed, 683 insertions(+), 380 deletions(-)
copy integration/src/test/java/org/slf4j/{MultiBindingAssertionTest.java => IncompatibleMultiBindingAssertionTest.java} (95%)
create mode 100644 slf4j-simple/src/test/resources/simplelogger.properties
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0

[GIT] SLF4J: Simple Logging Facade for Java branch master updated. v_1.6.5-3-ge4f061b
by git-noreply@pixie.qos.ch 05 Jun '12
by git-noreply@pixie.qos.ch 05 Jun '12
05 Jun '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via e4f061bdc2ecf0b86544203cb1c8a45e54654daa (commit)
from 7f888049bc1f266d73645c09647608633cc82629 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=e4f061bdc2ecf0b86544203cb1…
http://github.com/ceki/slf4j/commit/e4f061bdc2ecf0b86544203cb1c8a45e54654daa
commit e4f061bdc2ecf0b86544203cb1c8a45e54654daa
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Jun 5 19:02:05 2012 +0200
minor edit
diff --git a/slf4j-site/src/site/pages/faq.html b/slf4j-site/src/site/pages/faq.html
index 475161f..939228e 100644
--- a/slf4j-site/src/site/pages/faq.html
+++ b/slf4j-site/src/site/pages/faq.html
@@ -596,7 +596,7 @@ org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
logging. While one can come up with a seemingly working
SLF4J-wrapper within hours, many technical issues will emerge
over time which Wombat developers will have to deal with. Note
- that SLF4J has evolved over several years and has 170 bug
+ that SLF4J has evolved over several years and has 260 bug
reports filed against it.</p>
<p>For the above reasons, developers of frameworks should resist
-----------------------------------------------------------------------
Summary of changes:
slf4j-site/src/site/pages/faq.html | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0

[Bug 234] New: log4j-over-slf4j and legacy projects providing their own log4j LoggerFactory
by bugzilla-daemon@pixie.qos.ch 04 Jun '12
by bugzilla-daemon@pixie.qos.ch 04 Jun '12
04 Jun '12
http://bugzilla.slf4j.org/show_bug.cgi?id=234
Summary: log4j-over-slf4j and legacy projects providing their
own log4j LoggerFactory
Product: SLF4J
Version: 1.6.x
Platform: All
OS/Version: All
Status: NEW
Severity: blocker
Priority: P1
Component: log4j-over-slf4j
AssignedTo: slf4j-dev(a)qos.ch
ReportedBy: laurent.pellegrino(a)gmail.com
I tried to use log4j-over-slf4j in a legacy project that provides its own
LoggerFactory and when I use log4j-over-slf4j I get a
java.lang.NoSuchMethodError for Logger#getLogger(String name, LoggerFactory
factory). After having inspected the log4j-over-slf4j source code, it seems
that the bridge does not provide an implementation for the
Logger#getLogger(String name, LoggerFactory factory) method. Is there any
reason for that?
--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
2
5

[GIT] SLF4J: Simple Logging Facade for Java branch master updated. v_1.6.5-2-g7f88804
by git-noreply@pixie.qos.ch 04 Jun '12
by git-noreply@pixie.qos.ch 04 Jun '12
04 Jun '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via 7f888049bc1f266d73645c09647608633cc82629 (commit)
from 1d518fd925183869994bd4b4e89aeefd1f10c715 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=7f888049bc1f266d73645c0964…
http://github.com/ceki/slf4j/commit/7f888049bc1f266d73645c09647608633cc82629
commit 7f888049bc1f266d73645c09647608633cc82629
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Jun 4 22:24:31 2012 +0200
start work on 1.6.6. Fix bug #234
diff --git a/integration/pom.xml b/integration/pom.xml
index fadec39..390fc0c 100644
--- a/integration/pom.xml
+++ b/integration/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/jcl-over-slf4j/pom.xml b/jcl-over-slf4j/pom.xml
index a6a13c0..2599f41 100644
--- a/jcl-over-slf4j/pom.xml
+++ b/jcl-over-slf4j/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/jul-to-slf4j/pom.xml b/jul-to-slf4j/pom.xml
index 9b93e97..7e49d1b 100644
--- a/jul-to-slf4j/pom.xml
+++ b/jul-to-slf4j/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/log4j-over-slf4j/pom.xml b/log4j-over-slf4j/pom.xml
index 51e0d17..6730a55 100644
--- a/log4j-over-slf4j/pom.xml
+++ b/log4j-over-slf4j/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
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 bcab830..0738092 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
@@ -16,22 +16,24 @@
package org.apache.log4j;
+import org.apache.log4j.spi.LoggerFactory;
+
import java.util.Enumeration;
import java.util.Vector;
/**
- * <p>
+ * <p/>
* This class is a minimal implementation of the original
* <code>org.apache.log4j.LogManager</code> class (as found in log4j 1.2)
* delegating all calls to SLF4J.
- *
- * <p>
+ * <p/>
+ * <p/>
* This implementation does <b>NOT</b> implement the setRepositorySelector(),
* getLoggerRepository(), exists(), getCurrentLoggers(), shutdown() and
* resetConfiguration() methods which do not have SLF4J equivalents.
- *
+ *
* @author Ceki Gülcü
- * */
+ */
public class LogManager {
public static Logger getRootLogger() {
@@ -45,10 +47,25 @@ public class LogManager {
public static Logger getLogger(final Class clazz) {
return Log4jLoggerFactory.getLogger(clazz.getName());
}
-
+
+ /**
+ * Returns a logger instance created by loggerFactory. This method was requested in
+ * <a href="http://bugzilla.slf4j.org/show_bug.cgi?id=234">bug #234</a>. Note that
+ * 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() {
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 7d3c6ca..98c1d64 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
@@ -31,7 +31,7 @@ public class Logger extends Category {
private static final String LOGGER_FQCN = Logger.class.getName();
- Logger(String name) {
+ protected Logger(String name) {
super(name);
}
diff --git a/osgi-over-slf4j/pom.xml b/osgi-over-slf4j/pom.xml
index e034e30..23ec0ca 100644
--- a/osgi-over-slf4j/pom.xml
+++ b/osgi-over-slf4j/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/pom.xml b/pom.xml
index d3bacfa..c3a1d98 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
<packaging>pom</packaging>
<name>SLF4J</name>
diff --git a/slf4j-api/pom.xml b/slf4j-api/pom.xml
index 5454cd7..eeb0335 100644
--- a/slf4j-api/pom.xml
+++ b/slf4j-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-ext/pom.xml b/slf4j-ext/pom.xml
index c409606..f331f0a 100644
--- a/slf4j-ext/pom.xml
+++ b/slf4j-ext/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-jcl/pom.xml b/slf4j-jcl/pom.xml
index e04fe02..42df659 100644
--- a/slf4j-jcl/pom.xml
+++ b/slf4j-jcl/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-jdk14/pom.xml b/slf4j-jdk14/pom.xml
index a66d977..62817b7 100644
--- a/slf4j-jdk14/pom.xml
+++ b/slf4j-jdk14/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-log4j12/pom.xml b/slf4j-log4j12/pom.xml
index 5c95754..e1d70a0 100644
--- a/slf4j-log4j12/pom.xml
+++ b/slf4j-log4j12/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-migrator/pom.xml b/slf4j-migrator/pom.xml
index 0d7555b..c4f5f48 100644
--- a/slf4j-migrator/pom.xml
+++ b/slf4j-migrator/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-nop/pom.xml b/slf4j-nop/pom.xml
index aa5158d..9d2f182 100644
--- a/slf4j-nop/pom.xml
+++ b/slf4j-nop/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-osgi-integration-test/pom.xml b/slf4j-osgi-integration-test/pom.xml
index 403ebda..ec4519b 100644
--- a/slf4j-osgi-integration-test/pom.xml
+++ b/slf4j-osgi-integration-test/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-osgi-test-bundle/pom.xml b/slf4j-osgi-test-bundle/pom.xml
index 60cfcbd..d6da1ab 100644
--- a/slf4j-osgi-test-bundle/pom.xml
+++ b/slf4j-osgi-test-bundle/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-simple/pom.xml b/slf4j-simple/pom.xml
index 9025037..b9a131f 100644
--- a/slf4j-simple/pom.xml
+++ b/slf4j-simple/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-site/pom.xml b/slf4j-site/pom.xml
index 123a7c8..7ff8d72 100644
--- a/slf4j-site/pom.xml
+++ b/slf4j-site/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html
index ca5430b..4ad5429 100644
--- a/slf4j-site/src/site/pages/news.html
+++ b/slf4j-site/src/site/pages/news.html
@@ -29,6 +29,14 @@
<hr noshade="noshade" size="1"/>
+ <h3> ... - Release of SLF4J 1.6.6</h3>
+
+ <p>The log4j-over-slf4j module now supports legacy projects
+ providing their own log4j <code>LoggerFactory</code>. This fixes <a
+ href="http://bugzilla.slf4j.org/show_bug.cgi?id=234">bug #234</a>
+ reported by Laurent Pellegrino with Piotr Jagielski providing the
+ appropriate patch.</p>
+
<h3>4th of June, 2012 - Release of SLF4J 1.6.5</h3>
<p>In the slf4j-log4j12 module, upgraded the log4j dependency to
-----------------------------------------------------------------------
Summary of changes:
integration/pom.xml | 2 +-
jcl-over-slf4j/pom.xml | 2 +-
jul-to-slf4j/pom.xml | 2 +-
log4j-over-slf4j/pom.xml | 2 +-
.../src/main/java/org/apache/log4j/LogManager.java | 29 +++++++++++++++----
.../src/main/java/org/apache/log4j/Logger.java | 2 +-
osgi-over-slf4j/pom.xml | 2 +-
pom.xml | 2 +-
slf4j-api/pom.xml | 2 +-
slf4j-ext/pom.xml | 2 +-
slf4j-jcl/pom.xml | 2 +-
slf4j-jdk14/pom.xml | 2 +-
slf4j-log4j12/pom.xml | 2 +-
slf4j-migrator/pom.xml | 2 +-
slf4j-nop/pom.xml | 2 +-
slf4j-osgi-integration-test/pom.xml | 2 +-
slf4j-osgi-test-bundle/pom.xml | 2 +-
slf4j-simple/pom.xml | 2 +-
slf4j-site/pom.xml | 2 +-
slf4j-site/src/site/pages/news.html | 8 +++++
20 files changed, 49 insertions(+), 24 deletions(-)
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0

[GIT] SLF4J: Simple Logging Facade for Java branch master updated. v_1.6.5-1-g1d518fd
by git-noreply@pixie.qos.ch 04 Jun '12
by git-noreply@pixie.qos.ch 04 Jun '12
04 Jun '12
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via 1d518fd925183869994bd4b4e89aeefd1f10c715 (commit)
from b48ade9995a90fbd406b322080b99b10b303c320 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=1d518fd925183869994bd4b4e8…
http://github.com/ceki/slf4j/commit/1d518fd925183869994bd4b4e89aeefd1f10c715
commit 1d518fd925183869994bd4b4e89aeefd1f10c715
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Jun 4 18:36:03 2012 +0200
typo fixes
diff --git a/slf4j-site/src/site/pages/codes.html b/slf4j-site/src/site/pages/codes.html
index 08212ff..8919963 100644
--- a/slf4j-site/src/site/pages/codes.html
+++ b/slf4j-site/src/site/pages/codes.html
@@ -187,7 +187,7 @@
with <em>slf4j-api-M.jar</em> for any N and M. You only need to
ensure that the version of your binding matches that of the
slf4j-api.jar. You do not have to worry about the version of
- slf4j-api.jar used by a given dependendency in your project. You
+ slf4j-api.jar used by a given dependency in your project. You
can always use any version of <em>slf4j-api.jar</em>, and as long
as the version of <em>slf4j-api.jar</em> and its binding match,
you should be fine.
diff --git a/slf4j-site/src/site/pages/manual.html b/slf4j-site/src/site/pages/manual.html
index 8b13734..2141882 100644
--- a/slf4j-site/src/site/pages/manual.html
+++ b/slf4j-site/src/site/pages/manual.html
@@ -328,7 +328,7 @@ SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further detail
any N and M. You only need to ensure that the version of your
binding matches that of the slf4j-api.jar. You do not have to
worry about the version of slf4j-api.jar used by a given
- dependendency in your project. </p>
+ dependency in your project. </p>
<p>Mixing mixing different versions of <em>slf4j-api.jar</em>
@@ -343,16 +343,16 @@ SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further detail
will run perfectly fine with <em>slf4j-api-M.jar</em> for any N
and M. You only need to ensure that the version of your binding
matches that of the slf4j-api.jar. You do not have to worry
- about the version of slf4j-api.jar used by a given dependendency
- in your project. You can always use any version of
+ about the version of slf4j-api.jar used by a given dependency in
+ your project. You can always use any version of
<em>slf4j-api.jar</em>, and as long as the version of
<em>slf4j-api.jar</em> and its binding match, you should be
fine.
</p>
- <p>At initialization time, if SLF4J suspects that there may be a
- api vs. binding version mismatch problem, it will emit a warning
- about the suspected mismatch.
+ <p>At initialization time, if SLF4J suspects that there may be
+ an slf4j-api vs. binding version mismatch problem, it will emit
+ a warning about the suspected mismatch.
</p>
-----------------------------------------------------------------------
Summary of changes:
slf4j-site/src/site/pages/codes.html | 2 +-
slf4j-site/src/site/pages/manual.html | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0
Hello all,
I am happy to announce the immediate availability of SLF4J version
1.6.5 consisting of minor code and documentation improvements. It should
hit the Maven central repository within the next 24 hours.
The Simple Logging Facade for Java or (SLF4J) serves as a simple
facade or abstraction for various logging frameworks,
e.g. java.util.logging, log4j and logback, allowing the end user to
plug in the desired logging framework at deployment time.
In the absence of a binding on the classpath:
In the 1.6.x series, in the absence of an SLF4J binding, slf4j-api
will default to a no-operation implementation discarding all log
requests. Thus, instead of throwing an exception, SLF4J will emit a
single warning message about the absence of a binding and proceed to
discard all log requests without further protest. In other words,
libraries no longer need to bundle an slf4j binding along with
slf4j-api.jar in order to function out-of-the-box.
Binary compatibility:
Mixing mixing different versions of slf4j-api.jar and SLF4J binding
can cause problems. For example, if you are using slf4j-api-1.6.5.jar,
then you should also use slf4j-simple-1.6.5.jar, using
slf4j-simple-1.5.5.jar will not work.
From the client's perspective all versions of slf4j-api are
compatible. Client code compiled with slf4j-api-N.jar will run
perfectly fine with slf4j-api-M.jar for any N and M. You only need to
ensure that the version of your binding matches that of the
slf4j-api.jar. You do not have to worry about the version of
slf4j-api.jar used by a given dependency in your project. You can
always use any version of slf4j-api.jar, and as long as the version of
slf4j-api.jar and its binding match, you should be fine.
At initialization time, if SLF4J suspects that there may be a api
vs. binding version mismatch problem, it will emit a warning about the
suspected mismatch.
Release notes:
Please refer to the the news page for precise details.
http://www.slf4j.org/news.html
You can download SLF4J, including full source code, class files and
documentation on our download page, shown below.
http://www.slf4j.org/download.html
Announcement mailing list:
You can receive SLF4J related announcements by subscribing to the
SLF4J announce mailing list. To subscribe to QOS.ch announce list,
please visit the following URL.
http://www.qos.ch/mailman/listinfo/announce
Enjoy,
--
Ceki
http://twitter.com/#!/ceki
1
0