Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/ceki/slf4j
Browse files Browse the repository at this point in the history
  • Loading branch information
rgoers committed Oct 17, 2009
2 parents 551c9a5 + 745cf07 commit cb849ce
Show file tree
Hide file tree
Showing 37 changed files with 226 additions and 89 deletions.
2 changes: 1 addition & 1 deletion integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion jcl-over-slf4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
3 changes: 2 additions & 1 deletion jcl104-over-slf4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>

<groupId>org.slf4j</groupId>
<artifactId>jcl104-over-slf4j</artifactId>
<packaging>pom</packaging>
<name>DEPRECATED - JCL 1.0.4 implemented over SLF4J</name>

<url>http://www.slf4j.org</url>
Expand Down
2 changes: 1 addition & 1 deletion jul-to-slf4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion log4j-over-slf4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* <p>
* This class is a minimal implementation of the original
* <code>org.apache.log4j.Category</code> class (as found in log4j 1.2) by
* delegation of all calls to a {@link org.slf4j.Logger.Logger} instance.
* delegation of all calls to a {@link org.slf4j.Logger} instance.
* </p>
*
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/**
* This class is a factory that creates and maintains org.apache.log4j.Loggers
* warpping org.slf4j.Loggers.
* wrapping org.slf4j.Loggers.
*
* It keeps a hashtable of all created org.apache.log4j.Logger instances so that
* all newly created instances are not dulpicates of existing loggers.
Expand Down
45 changes: 45 additions & 0 deletions log4j-over-slf4j/src/main/java/org/apache/log4j/LogManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.log4j;

/**
* <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>
* 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&uuml;lc&uuml;
* */
public class LogManager {

public static Logger getRootLogger() {
return Log4jLoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
}

public static Logger getLogger(final String name) {
return Log4jLoggerFactory.getLogger(name);
}

public static Logger getLogger(final Class clazz) {
return Log4jLoggerFactory.getLogger(clazz.getName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* <p>
* This class is a minimal implementation of the original
* <code>org.apache.log4j.Logger</code> class (as found in log4j 1.2)
* by delegation of all calls to a {@link org.slf4j.Logger.Logger} instance.
* delegating all calls to a {@link org.slf4j.Logger} instance.
* </p>
*
* @author Ceki G&uuml;lc&uuml;
Expand Down
2 changes: 1 addition & 1 deletion osgi-over-slf4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
12 changes: 2 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>

<packaging>pom</packaging>
<name>SLF4J</name>
Expand Down Expand Up @@ -279,17 +279,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>jxr</report>
<report>test-jxr</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<aggregate>true</aggregate>
<javadocDir>target/site/api/</javadocDir>
<javadocDir>target/site/apidocs/</javadocDir>
<linkJavadoc>true</linkJavadoc>
</configuration>
</plugin>
Expand Down
2 changes: 1 addition & 1 deletion slf4j-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
3 changes: 1 addition & 2 deletions slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public final class LoggerFactory {
* <p>
*/
static private final String[] API_COMPATIBILITY_LIST = new String[] {
"1.5.5", "1.5.6", "1.5.7", "1.5.8", "1.5.9-RC0", "1.5.9" };
"1.5.5", "1.5.6", "1.5.7", "1.5.8", "1.5.9-RC0", "1.5.10" };

// private constructor prevents instantiation
private LoggerFactory() {
Expand Down Expand Up @@ -231,7 +231,6 @@ private final static StaticLoggerBinder getSingleton() {
GET_SINGLETON_METHOD = GET_SINGLETON_INEXISTENT;
return StaticLoggerBinder.SINGLETON;
}

}

/**
Expand Down
52 changes: 30 additions & 22 deletions slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

package org.slf4j.helpers;

import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -32,6 +33,7 @@
/**
* Formats messages according to very simple substitution rules. Substitutions
* can be made 1, 2 or more arguments.
*
* <p>
* For example,
*
Expand All @@ -41,9 +43,9 @@
*
* will return the string "Hi there.".
* <p>
* The {} pair is called the <em>formatting anchor</em>. It serves to
* designate the location where arguments need to be substituted within the
* message pattern.
* The {} pair is called the <em>formatting anchor</em>. It serves to designate
* the location where arguments need to be substituted within the message
* pattern.
* <p>
* In case your message contains the '{' or the '}' character, you do not have
* to do anything special unless the '}' character immediately follows '{'. For
Expand All @@ -62,25 +64,30 @@
* character should be escaped. There is no need to escape the '}' character.
* For example,
*
* <pre>
* MessageFormatter.format(&quot;Set \\{} is not equal to {}.&quot;, &quot;1,2&quot;);
* </pre>
* <pre>MessageFormatter.format(&quot;Set \\{} is not equal to {}.&quot;, &quot;1,2&quot;);</pre>
*
* will return the string "Set {} is not equal to 1,2.".
*
* <p>
* The escaping behavior just described can be overridden by escaping the escape
* character '\'. Calling
*
* <pre>
* MessageFormatter.format(&quot;File name is C:\\\\{}.&quot;, &quot;file.zip&quot;);
* </pre>
*
* will return the string "File name is C:\file.zip".
*
* <p>
* See {@link #format(String, Object)}, {@link #format(String, Object, Object)}
* and {@link #arrayFormat(String, Object[])} methods for more details.
* The formatting conventions are different than those of {@link MessageFormat}
* which ships with the Java platform. This is justified by the fact that
* SLF4J's implementation is 10 times faster than that of {@link MessageFormat}.
* This local performance difference is both measurable and significant in the
* larger context of the complete logging processing chain.
*
* <p>
* See also {@link #format(String, Object)},
* {@link #format(String, Object, Object)} and
* {@link #arrayFormat(String, Object[])} methods for more details.
*
* @author Ceki G&uuml;lc&uuml;
*/
Expand All @@ -104,10 +111,9 @@ final public class MessageFormatter {
* <p>
*
* @param messagePattern
* The message pattern which will be parsed and formatted
* The message pattern which will be parsed and formatted
* @param argument
* The argument to be substituted in place of the formatting
* anchor
* The argument to be substituted in place of the formatting anchor
* @return The formatted message
*/
final public static String format(String messagePattern, Object arg) {
Expand All @@ -128,13 +134,13 @@ final public static String format(String messagePattern, Object arg) {
* will return the string "Hi Alice. My name is Bob.".
*
* @param messagePattern
* The message pattern which will be parsed and formatted
* The message pattern which will be parsed and formatted
* @param arg1
* The argument to be substituted in place of the first
* formatting anchor
* The argument to be substituted in place of the first formatting
* anchor
* @param arg2
* The argument to be substituted in place of the second
* formatting anchor
* The argument to be substituted in place of the second formatting
* anchor
* @return The formatted message
*/
final public static String format(final String messagePattern, Object arg1,
Expand All @@ -148,10 +154,10 @@ final public static String format(final String messagePattern, Object arg1,
* arguments can be passed in an array.
*
* @param messagePattern
* The message pattern which will be parsed and formatted
* The message pattern which will be parsed and formatted
* @param argArray
* An array of arguments to be substituted in place of
* formatting anchors
* An array of arguments to be substituted in place of formatting
* anchors
* @return The formatted message
*/
final public static String arrayFormat(final String messagePattern,
Expand Down Expand Up @@ -269,8 +275,10 @@ private static void safeObjectAppend(StringBuffer sbuf, Object o) {
try {
String oAsString = o.toString();
sbuf.append(oAsString);
} catch( Throwable t) {
System.err.println("SLF4J: Failed toString() invocation on an object of type ["+o.getClass().getName()+"]");
} catch (Throwable t) {
System.err
.println("SLF4J: Failed toString() invocation on an object of type ["
+ o.getClass().getName() + "]");
t.printStackTrace();
sbuf.append("[FAILED toString()]");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static final StaticLoggerBinder getSingleton() {
* The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
public static String REQUESTED_API_VERSION = "1.5.9-RC0"; // !final
public static String REQUESTED_API_VERSION = "1.5.10"; // !final

private StaticLoggerBinder() {
throw new UnsupportedOperationException("This code should have never made it into the jar");
Expand Down
2 changes: 1 addition & 1 deletion slf4j-ext/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion slf4j-jcl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static final StaticLoggerBinder getSingleton() {
*/

//to avoid constant folding by the compiler, this field must *not* be final
public static String REQUESTED_API_VERSION = "1.5.9-RC0";
public static String REQUESTED_API_VERSION = "1.5.10";

// Binding specific code:
private static final String loggerFactoryClassStr = JCLLoggerFactory.class
Expand Down
2 changes: 1 addition & 1 deletion slf4j-jdk14/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static final StaticLoggerBinder getSingleton() {
* The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
public static String REQUESTED_API_VERSION = "1.5.9-RC0"; // !final
public static String REQUESTED_API_VERSION = "1.5.10"; // !final


private static final String loggerFactoryClassStr = org.slf4j.impl.JDK14LoggerFactory.class.getName();
Expand Down
2 changes: 1 addition & 1 deletion slf4j-log4j12/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static final StaticLoggerBinder getSingleton() {
* against. The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
public static String REQUESTED_API_VERSION = "1.5.9-RC0"; // !final
public static String REQUESTED_API_VERSION = "1.5.10"; // !final

private static final String loggerFactoryClassStr = Log4jLoggerFactory.class
.getName();
Expand Down
2 changes: 1 addition & 1 deletion slf4j-migrator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.5.9-RC0</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Loading

0 comments on commit cb849ce

Please sign in to comment.