The branch, master has been updated
       via  7e1d1bb7e1200d9233e1c5c622cde6415ab41b42 (commit)
      from  c9abde8243fd4a77b418383b11ff3279fb236d53 (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=7e1d1bb7e1200d9233e1c5c622cde6415ab41b42
http://github.com/ceki/slf4j/commit/7e1d1bb7e1200d9233e1c5c622cde6415ab41b42

commit 7e1d1bb7e1200d9233e1c5c622cde6415ab41b42
Author: Ceki Gulcu <c...@qos.ch>
Date:   Sun Sep 13 17:50:10 2009 +0200

    - added blurb about MessageFormatter performance compred to JDK's 
MessageFormat
    
    - added link to article on "Logging with SLF4J and Guice" by Michael
      Glauche

diff --git a/slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java 
b/slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java
index 81ecc46..c41ae9a 100644
--- a/slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java
+++ b/slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java
@@ -24,6 +24,7 @@
 
 package org.slf4j.helpers;
 
+import java.text.MessageFormat;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -32,6 +33,7 @@ import java.util.Map;
 /**
  * Formats messages according to very simple substitution rules. Substitutions
  * can be made 1, 2 or more arguments.
+ * 
  * <p>
  * For example,
  * 
@@ -41,9 +43,9 @@ import java.util.Map;
  * 
  * 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
@@ -62,16 +64,13 @@ import java.util.Map;
  * 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>
@@ -79,8 +78,16 @@ import java.util.Map;
  * 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;
  */
@@ -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) {
@@ -128,13 +134,13 @@ final public class MessageFormatter {
    * 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,
@@ -148,10 +154,10 @@ final public class MessageFormatter {
    * 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,
@@ -269,8 +275,10 @@ final public class MessageFormatter {
     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()]");
     }
diff --git a/slf4j-site/src/site/pages/docs.html 
b/slf4j-site/src/site/pages/docs.html
index 989b1ca..52a3020 100644
--- a/slf4j-site/src/site/pages/docs.html
+++ b/slf4j-site/src/site/pages/docs.html
@@ -49,6 +49,12 @@
       Logger Plug-ins for RCP Applications</a>, by John J. Franey 
     </li>
 
+
+    <li><a
+    href="http://glauche.de/2009/08/24/logging-with-slf4j-and-guice/";>Logging
+    with SLF4J and Guice</a>, by Michael Glauche      
+    </li>
+
     <li>
       <a href="slf4j-in-10-slides.ppt">SLF4J in 10 slides</a>, by Ceki 
G&uuml;lc&uuml;
     </li>
@@ -76,6 +82,7 @@
       
href="http://bsnyderblog.blogspot.com/2007/08/my-soapbox-for-slf4j.html";>My
       Soapbox for SLF4J</a>, by Bruce Snyder
     </li>
+
   </ul>
 
 

-----------------------------------------------------------------------

Summary of changes:
 .../java/org/slf4j/helpers/MessageFormatter.java   |   52 +++++++++++--------
 slf4j-site/src/site/pages/docs.html                |    7 +++
 2 files changed, 37 insertions(+), 22 deletions(-)


hooks/post-receive
-- 
SLF4J: Simple Logging Facade for Java
_______________________________________________
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

Reply via email to