logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1519726 - /logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java
Date Tue, 03 Sep 2013 15:49:23 GMT
Author: ggregory
Date: Tue Sep  3 15:49:23 2013
New Revision: 1519726

URL: http://svn.apache.org/r1519726
Log:
Refactor many " " (a String with one space) into a constant space char.

Modified:
    logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java

Modified: logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java?rev=1519726&r1=1519725&r2=1519726&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java
Tue Sep  3 15:49:23 2013
@@ -37,7 +37,9 @@ import org.apache.logging.log4j.util.Pro
  */
 public class SimpleLogger extends AbstractLogger {
 
-    /**
+    private static final char SPACE = ' ';
+
+	/**
      * Used to format times.
      * <p>
      * Note that DateFormat is not Thread-safe.
@@ -112,22 +114,22 @@ public class SimpleLogger extends Abstra
                 dateText = dateFormatter.format(now);
             }
             sb.append(dateText);
-            sb.append(" ");
+            sb.append(SPACE);
         }
 
         sb.append(level.toString());
-        sb.append(" ");
+        sb.append(SPACE);
         if (logName != null && logName.length() > 0) {
             sb.append(logName);
-            sb.append(" ");
+            sb.append(SPACE);
         }
         sb.append(msg.getFormattedMessage());
         if (showContextMap) {
             final Map<String, String> mdc = ThreadContext.getContext();
             if (mdc.size() > 0) {
-                sb.append(" ");
+                sb.append(SPACE);
                 sb.append(mdc.toString());
-                sb.append(" ");
+                sb.append(SPACE);
             }
         }
         final Object[] params = msg.getParameters();
@@ -138,7 +140,7 @@ public class SimpleLogger extends Abstra
             t = throwable;
         }
         if (t != null) {
-            sb.append(" ");
+            sb.append(SPACE);
             final ByteArrayOutputStream baos = new ByteArrayOutputStream();
             t.printStackTrace(new PrintStream(baos));
             sb.append(baos.toString());



Mime
View raw message