You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2013/01/18 13:40:19 UTC

svn commit: r1435115 - in /commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl: AvalonLogger.java SimpleLog.java

Author: tn
Date: Fri Jan 18 12:40:19 2013
New Revision: 1435115

URL: http://svn.apache.org/viewvc?rev=1435115&view=rev
Log:
[LOGGING-135] Improved thread-safety for SimpleLog, AvalonLogger.

Modified:
    commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/AvalonLogger.java
    commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/SimpleLog.java

Modified: commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/AvalonLogger.java
URL: http://svn.apache.org/viewvc/commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/AvalonLogger.java?rev=1435115&r1=1435114&r2=1435115&view=diff
==============================================================================
--- commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/AvalonLogger.java (original)
+++ commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/AvalonLogger.java Fri Jan 18 12:40:19 2013
@@ -52,7 +52,7 @@ import org.apache.commons.logging.Log;
 public class AvalonLogger implements Log {
 
     /** Ancestral Avalon logger. */
-    private static Logger defaultLogger = null;
+    private static volatile Logger defaultLogger = null;
     /** Avalon logger used to perform log. */
     private final transient Logger logger;
 

Modified: commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
URL: http://svn.apache.org/viewvc/commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/SimpleLog.java?rev=1435115&r1=1435114&r2=1435115&view=diff
==============================================================================
--- commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/SimpleLog.java (original)
+++ commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/SimpleLog.java Fri Jan 18 12:40:19 2013
@@ -85,19 +85,19 @@ public class SimpleLog implements Log, S
     static protected final String DEFAULT_DATE_TIME_FORMAT = "yyyy/MM/dd HH:mm:ss:SSS zzz";
 
     /** Include the instance name in the log message? */
-    static protected boolean showLogName = false;
+    static volatile protected boolean showLogName = false;
 
     /** Include the short name ( last component ) of the logger in the log
      *  message. Defaults to true - otherwise we'll be lost in a flood of
      *  messages without knowing who sends them.
      */
-    static protected boolean showShortName = true;
+    static volatile protected boolean showShortName = true;
 
     /** Include the current time in the log message */
-    static protected boolean showDateTime = false;
+    static volatile protected boolean showDateTime = false;
 
     /** The date and time format to use in the log message */
-    static protected String dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
+    static volatile protected String dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
 
     /**
      * Used to format times.
@@ -187,11 +187,11 @@ public class SimpleLog implements Log, S
     // ------------------------------------------------------------- Attributes
 
     /** The name of this simple log instance */
-    protected String logName = null;
+    protected volatile String logName = null;
     /** The current log level */
-    protected int currentLogLevel;
+    protected volatile int currentLogLevel;
     /** The short name of this simple log instance */
-    private String shortLogName = null;
+    private volatile String shortLogName = null;
 
     // ------------------------------------------------------------ Constructor