You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2013/01/20 20:59:57 UTC

svn commit: r1435937 [3/3] - in /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core: ./ appender/ appender/rewrite/ appender/rolling/ config/ config/plugins/ filter/ helpers/ impl/ layout/ lookup/ net/ pattern/ selector/

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/AbstractStyleNameConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/AbstractStyleNameConverter.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/AbstractStyleNameConverter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/AbstractStyleNameConverter.java Sun Jan 20 19:59:55 2013
@@ -30,6 +30,23 @@ import org.apache.logging.log4j.core.lay
  */
 public abstract class AbstractStyleNameConverter extends LogEventPatternConverter {
 
+    private final List<PatternFormatter> formatters;
+
+    private final String style;
+
+    /**
+     * Constructs the converter.
+     *
+     * @param formatters The PatternFormatters to generate the text to manipulate.
+     * @param styling The styling that should encapsulate the pattern.
+     */
+    protected AbstractStyleNameConverter(final String name, final List<PatternFormatter> formatters,
+                                         final String styling) {
+        super(name, "style");
+        this.formatters = formatters;
+        this.style = styling;
+    }
+
     /**
      * Black style pattern converter. Adds ANSI color styling to the result of the enclosed pattern.
      */
@@ -37,32 +54,29 @@ public abstract class AbstractStyleNameC
     @ConverterKeys(Black.NAME)
     public static final class Black extends AbstractStyleNameConverter {
 
+        /** Black */
         protected static final String NAME = "black";
 
         /**
-         * Gets an instance of the class (called via reflection).
+         * Constructs the converter. This constructor must be public.
          *
-         * @param config
-         *            The current Configuration.
-         * @param options
-         *            The pattern options, may be null. If the first element is "short", only the first line of the throwable will be
-         *            formatted.
-         * @return new instance of class or null
+         * @param formatters The PatternFormatters to generate the text to manipulate.
+         * @param styling The styling that should encapsulate the pattern.
          */
-        public static Black newInstance(final Configuration config, final String[] options) {
-            return newInstance(Black.class, NAME, config, options);
+        public Black(final List<PatternFormatter> formatters, final String styling) {
+            super(NAME, formatters, styling);
         }
 
         /**
-         * Constructs the converter. This constructor must be public.
+         * Gets an instance of the class (called via reflection).
          *
-         * @param formatters
-         *            The PatternFormatters to generate the text to manipulate.
-         * @param styling
-         *            The styling that should encapsulate the pattern.
+         * @param config The current Configuration.
+         * @param options The pattern options, may be null. If the first element is "short", only the first line of the
+         *            throwable will be formatted.
+         * @return new instance of class or null
          */
-        public Black(final List<PatternFormatter> formatters, final String styling) {
-            super(NAME, formatters, styling);
+        public static Black newInstance(final Configuration config, final String[] options) {
+            return newInstance(Black.class, NAME, config, options);
         }
     }
 
@@ -73,32 +87,29 @@ public abstract class AbstractStyleNameC
     @ConverterKeys(Blue.NAME)
     public static final class Blue extends AbstractStyleNameConverter {
 
+        /** Blue */
         protected static final String NAME = "blue";
 
         /**
-         * Gets an instance of the class (called via reflection).
+         * Constructs the converter. This constructor must be public.
          *
-         * @param config
-         *            The current Configuration.
-         * @param options
-         *            The pattern options, may be null. If the first element is "short", only the first line of the throwable will be
-         *            formatted.
-         * @return new instance of class or null
+         * @param formatters The PatternFormatters to generate the text to manipulate.
+         * @param styling The styling that should encapsulate the pattern.
          */
-        public static Blue newInstance(final Configuration config, final String[] options) {
-            return newInstance(Blue.class, NAME, config, options);
+        public Blue(final List<PatternFormatter> formatters, final String styling) {
+            super(NAME, formatters, styling);
         }
 
         /**
-         * Constructs the converter. This constructor must be public.
+         * Gets an instance of the class (called via reflection).
          *
-         * @param formatters
-         *            The PatternFormatters to generate the text to manipulate.
-         * @param styling
-         *            The styling that should encapsulate the pattern.
+         * @param config The current Configuration.
+         * @param options The pattern options, may be null. If the first element is "short", only the first line of the
+         *                throwable will be formatted.
+         * @return new instance of class or null
          */
-        public Blue(final List<PatternFormatter> formatters, final String styling) {
-            super(NAME, formatters, styling);
+        public static Blue newInstance(final Configuration config, final String[] options) {
+            return newInstance(Blue.class, NAME, config, options);
         }
     }
 
@@ -109,32 +120,29 @@ public abstract class AbstractStyleNameC
     @ConverterKeys(Cyan.NAME)
     public static final class Cyan extends AbstractStyleNameConverter {
 
+        /** Cyan */
         protected static final String NAME = "cyan";
 
         /**
-         * Gets an instance of the class (called via reflection).
+         * Constructs the converter. This constructor must be public.
          *
-         * @param config
-         *            The current Configuration.
-         * @param options
-         *            The pattern options, may be null. If the first element is "short", only the first line of the throwable will be
-         *            formatted.
-         * @return new instance of class or null
+         * @param formatters The PatternFormatters to generate the text to manipulate.
+         * @param styling The styling that should encapsulate the pattern.
          */
-        public static Cyan newInstance(final Configuration config, final String[] options) {
-            return newInstance(Cyan.class, NAME, config, options);
+        public Cyan(final List<PatternFormatter> formatters, final String styling) {
+            super(NAME, formatters, styling);
         }
 
         /**
-         * Constructs the converter. This constructor must be public.
+         * Gets an instance of the class (called via reflection).
          *
-         * @param formatters
-         *            The PatternFormatters to generate the text to manipulate.
-         * @param styling
-         *            The styling that should encapsulate the pattern.
+         * @param config The current Configuration.
+         * @param options The pattern options, may be null. If the first element is "short", only the first line of the
+         *                throwable will be formatted.
+         * @return new instance of class or null
          */
-        public Cyan(final List<PatternFormatter> formatters, final String styling) {
-            super(NAME, formatters, styling);
+        public static Cyan newInstance(final Configuration config, final String[] options) {
+            return newInstance(Cyan.class, NAME, config, options);
         }
     }
 
@@ -145,32 +153,29 @@ public abstract class AbstractStyleNameC
     @ConverterKeys(Green.NAME)
     public static final class Green extends AbstractStyleNameConverter {
 
+        /** Green */
         protected static final String NAME = "green";
 
         /**
-         * Gets an instance of the class (called via reflection).
+         * Constructs the converter. This constructor must be public.
          *
-         * @param config
-         *            The current Configuration.
-         * @param options
-         *            The pattern options, may be null. If the first element is "short", only the first line of the throwable will be
-         *            formatted.
-         * @return new instance of class or null
+         * @param formatters The PatternFormatters to generate the text to manipulate.
+         * @param styling The styling that should encapsulate the pattern.
          */
-        public static Green newInstance(final Configuration config, final String[] options) {
-            return newInstance(Green.class, NAME, config, options);
+        public Green(final List<PatternFormatter> formatters, final String styling) {
+            super(NAME, formatters, styling);
         }
 
         /**
-         * Constructs the converter. This constructor must be public.
+         * Gets an instance of the class (called via reflection).
          *
-         * @param formatters
-         *            The PatternFormatters to generate the text to manipulate.
-         * @param styling
-         *            The styling that should encapsulate the pattern.
+         * @param config The current Configuration.
+         * @param options The pattern options, may be null. If the first element is "short", only the first line of the
+         *                throwable will be formatted.
+         * @return new instance of class or null
          */
-        public Green(final List<PatternFormatter> formatters, final String styling) {
-            super(NAME, formatters, styling);
+        public static Green newInstance(final Configuration config, final String[] options) {
+            return newInstance(Green.class, NAME, config, options);
         }
     }
 
@@ -181,32 +186,29 @@ public abstract class AbstractStyleNameC
     @ConverterKeys(Magenta.NAME)
     public static final class Magenta extends AbstractStyleNameConverter {
 
+        /** Magenta */
         protected static final String NAME = "magenta";
 
         /**
-         * Gets an instance of the class (called via reflection).
+         * Constructs the converter. This constructor must be public.
          *
-         * @param config
-         *            The current Configuration.
-         * @param options
-         *            The pattern options, may be null. If the first element is "short", only the first line of the throwable will be
-         *            formatted.
-         * @return new instance of class or null
+         * @param formatters The PatternFormatters to generate the text to manipulate.
+         * @param styling The styling that should encapsulate the pattern.
          */
-        public static Magenta newInstance(final Configuration config, final String[] options) {
-            return newInstance(Magenta.class, NAME, config, options);
+        public Magenta(final List<PatternFormatter> formatters, final String styling) {
+            super(NAME, formatters, styling);
         }
 
         /**
-         * Constructs the converter. This constructor must be public.
+         * Gets an instance of the class (called via reflection).
          *
-         * @param formatters
-         *            The PatternFormatters to generate the text to manipulate.
-         * @param styling
-         *            The styling that should encapsulate the pattern.
+         * @param config The current Configuration.
+         * @param options The pattern options, may be null. If the first element is "short", only the first line of the
+         *                throwable will be formatted.
+         * @return new instance of class or null
          */
-        public Magenta(final List<PatternFormatter> formatters, final String styling) {
-            super(NAME, formatters, styling);
+        public static Magenta newInstance(final Configuration config, final String[] options) {
+            return newInstance(Magenta.class, NAME, config, options);
         }
     }
 
@@ -217,32 +219,29 @@ public abstract class AbstractStyleNameC
     @ConverterKeys(Red.NAME)
     public static final class Red extends AbstractStyleNameConverter {
 
+        /** Red */
         protected static final String NAME = "red";
 
         /**
-         * Gets an instance of the class (called via reflection).
+         * Constructs the converter. This constructor must be public.
          *
-         * @param config
-         *            The current Configuration.
-         * @param options
-         *            The pattern options, may be null. If the first element is "short", only the first line of the throwable will be
-         *            formatted.
-         * @return new instance of class or null
+         * @param formatters The PatternFormatters to generate the text to manipulate.
+         * @param styling The styling that should encapsulate the pattern.
          */
-        public static Red newInstance(final Configuration config, final String[] options) {
-            return newInstance(Red.class, NAME, config, options);
+        public Red(final List<PatternFormatter> formatters, final String styling) {
+            super(NAME, formatters, styling);
         }
 
         /**
-         * Constructs the converter. This constructor must be public.
+         * Gets an instance of the class (called via reflection).
          *
-         * @param formatters
-         *            The PatternFormatters to generate the text to manipulate.
-         * @param styling
-         *            The styling that should encapsulate the pattern.
+         * @param config The current Configuration.
+         * @param options The pattern options, may be null. If the first element is "short", only the first line of the
+         *                throwable will be formatted.
+         * @return new instance of class or null
          */
-        public Red(final List<PatternFormatter> formatters, final String styling) {
-            super(NAME, formatters, styling);
+        public static Red newInstance(final Configuration config, final String[] options) {
+            return newInstance(Red.class, NAME, config, options);
         }
     }
 
@@ -253,32 +252,29 @@ public abstract class AbstractStyleNameC
     @ConverterKeys(White.NAME)
     public static final class White extends AbstractStyleNameConverter {
 
+        /** White */
         protected static final String NAME = "white";
 
         /**
-         * Gets an instance of the class (called via reflection).
+         * Constructs the converter. This constructor must be public.
          *
-         * @param config
-         *            The current Configuration.
-         * @param options
-         *            The pattern options, may be null. If the first element is "short", only the first line of the throwable will be
-         *            formatted.
-         * @return new instance of class or null
+         * @param formatters The PatternFormatters to generate the text to manipulate.
+         * @param styling The styling that should encapsulate the pattern.
          */
-        public static White newInstance(final Configuration config, final String[] options) {
-            return newInstance(White.class, NAME, config, options);
+        public White(final List<PatternFormatter> formatters, final String styling) {
+            super(NAME, formatters, styling);
         }
 
         /**
-         * Constructs the converter. This constructor must be public.
+         * Gets an instance of the class (called via reflection).
          *
-         * @param formatters
-         *            The PatternFormatters to generate the text to manipulate.
-         * @param styling
-         *            The styling that should encapsulate the pattern.
+         * @param config The current Configuration.
+         * @param options The pattern options, may be null. If the first element is "short", only the first line of the
+         *                throwable will be formatted.
+         * @return new instance of class or null
          */
-        public White(final List<PatternFormatter> formatters, final String styling) {
-            super(NAME, formatters, styling);
+        public static White newInstance(final Configuration config, final String[] options) {
+            return newInstance(White.class, NAME, config, options);
         }
     }
 
@@ -289,46 +285,43 @@ public abstract class AbstractStyleNameC
     @ConverterKeys(Yellow.NAME)
     public static final class Yellow extends AbstractStyleNameConverter {
 
+        /** Yellow */
         protected static final String NAME = "yellow";
 
         /**
-         * Gets an instance of the class (called via reflection).
+         * Constructs the converter. This constructor must be public.
          *
-         * @param config
-         *            The current Configuration.
-         * @param options
-         *            The pattern options, may be null. If the first element is "short", only the first line of the throwable will be
-         *            formatted.
-         * @return new instance of class or null
+         * @param formatters The PatternFormatters to generate the text to manipulate.
+         * @param styling The styling that should encapsulate the pattern.
          */
-        public static Yellow newInstance(final Configuration config, final String[] options) {
-            return newInstance(Yellow.class, NAME, config, options);
+        public Yellow(final List<PatternFormatter> formatters, final String styling) {
+            super(NAME, formatters, styling);
         }
 
         /**
-         * Constructs the converter.
+         * Gets an instance of the class (called via reflection).
          *
-         * @param formatters
-         *            The PatternFormatters to generate the text to manipulate.
-         * @param styling
-         *            The styling that should encapsulate the pattern.
+         * @param config The current Configuration.
+         * @param options The pattern options, may be null. If the first element is "short", only the first line of the
+         *                throwable will be formatted.
+         * @return new instance of class or null
          */
-        public Yellow(final List<PatternFormatter> formatters, final String styling) {
-            super(NAME, formatters, styling);
+        public static Yellow newInstance(final Configuration config, final String[] options) {
+            return newInstance(Yellow.class, NAME, config, options);
         }
     }
 
     /**
      * Gets an instance of the class (called via reflection).
      *
-     * @param config
-     *            The current Configuration.
-     * @param options
-     *            The pattern options, may be null. If the first element is "short", only the first line of the throwable will be formatted.
+     * @param config The current Configuration.
+     * @param options The pattern options, may be null. If the first element is "short", only the first line of the
+     *                throwable will be formatted.
      * @return new instance of class or null
      */
-    protected static <T extends AbstractStyleNameConverter> T newInstance(final Class<T> asnConverterClass, final String name, final Configuration config,
-            final String[] options) {
+    protected static <T extends AbstractStyleNameConverter> T newInstance(final Class<T> asnConverterClass,
+                                                                          final String name, final Configuration config,
+                                                                          final String[] options) {
         final List<PatternFormatter> formatters = toPatternFormatterList(config, options);
         if (formatters == null) {
             return null;
@@ -355,10 +348,8 @@ public abstract class AbstractStyleNameC
     /**
      * Creates a list of PatternFormatter from the given configuration and options or null if no pattern is supplied.
      *
-     * @param config
-     *            A configuration
-     * @param options
-     *            pattern options
+     * @param config A configuration.
+     * @param options pattern options.
      * @return a list of PatternFormatter from the given configuration and options or null if no pattern is supplied.
      */
     private static List<PatternFormatter> toPatternFormatterList(final Configuration config, final String[] options) {
@@ -374,24 +365,6 @@ public abstract class AbstractStyleNameC
         return parser.parse(options[0]);
     }
 
-    private final List<PatternFormatter> formatters;
-
-    private final String style;
-
-    /**
-     * Constructs the converter.
-     *
-     * @param formatters
-     *            The PatternFormatters to generate the text to manipulate.
-     * @param styling
-     *            The styling that should encapsulate the pattern.
-     */
-    protected AbstractStyleNameConverter(final String name, final List<PatternFormatter> formatters, final String styling) {
-        super(name, "style");
-        this.formatters = formatters;
-        this.style = styling;
-    }
-
     /**
      * {@inheritDoc}
      */

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/AnsiEscape.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/AnsiEscape.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/AnsiEscape.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/AnsiEscape.java Sun Jan 20 19:59:55 2013
@@ -24,8 +24,8 @@ import java.util.Map;
 /**
  * Converts text into ANSI escape sequences.
  * <p>
- * The names for colors and attributes are standard, but the exact shade/hue/value of colors are not, and depend on the device used to
- * display them.
+ * The names for colors and attributes are standard, but the exact shade/hue/value of colors are not, and depend on the
+ * device used to display them.
  * </p>
  */
 public enum AnsiEscape {
@@ -218,8 +218,8 @@ public enum AnsiEscape {
     }
 
     /**
-     * Gets the default style
-     * 
+     * Gets the default style.
+     *
      * @return the default style
      */
     public static String getDefaultStyle() {
@@ -232,7 +232,7 @@ public enum AnsiEscape {
 
     /**
      * Gets the escape code.
-     * 
+     *
      * @return the escape code.
      */
     public String getCode() {
@@ -241,24 +241,22 @@ public enum AnsiEscape {
 
     /**
      * Creates a Map from a source array where values are ANSI escape sequences. The format is:
-     * 
+     *
      * <pre>
      * Key1=Value, Key2=Value, ...
      * </pre>
-     * 
+     *
      * For example:
-     * 
+     *
      * <pre>
      * ERROR=red bold, WARN=yellow bold, INFO=green, ...
      * </pre>
-     * 
-     * You can use whitespace around the comma and equal sign. The names in values MUST come from the {@linkplain AnsiEscape} enum, case is
-     * normalized to upper-case internally.
-     * 
-     * @param values
-     *            the source string to parse.
-     * @param dontEscapeKeys
-     *            do not escape these keys, leave the values as is in the map
+     *
+     * You can use whitespace around the comma and equal sign. The names in values MUST come from the
+     * {@linkplain AnsiEscape} enum, case is normalized to upper-case internally.
+     *
+     * @param values the source string to parse.
+     * @param dontEscapeKeys do not escape these keys, leave the values as is in the map
      * @return a new map
      */
     public static Map<String, String> createMap(final String values, final String[] dontEscapeKeys) {
@@ -267,20 +265,20 @@ public enum AnsiEscape {
 
     /**
      * Creates a Map from a source array where values are ANSI escape sequences. Each array entry must be in the format:
-     * 
+     *
      * <pre>
      * Key1 = Value
      * </pre>
-     * 
+     *
      * For example:
-     * 
+     *
      * <pre>
      * ERROR=red bold
      * </pre>
-     * 
-     * You can use whitespace around the equal sign and between the value elements. The names in values MUST come from the
-     * {@linkplain AnsiEscape} enum, case is normalized to upper-case internally.
-     * 
+     *
+     * You can use whitespace around the equal sign and between the value elements. The names in values MUST come from
+     * the {@linkplain AnsiEscape} enum, case is normalized to upper-case internally.
+     *
      * @param values
      *            the source array to parse.
      * @param dontEscapeKeys
@@ -305,7 +303,7 @@ public enum AnsiEscape {
 
     /**
      * Creates an ANSI escape sequence from the given {@linkplain AnsiEscape} names.
-     * 
+     *
      * @param names
      *            {@linkplain AnsiEscape} names.
      * @return An ANSI escape sequence.

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/CachedDateFormat.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/CachedDateFormat.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/CachedDateFormat.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/CachedDateFormat.java Sun Jan 20 19:59:55 2013
@@ -35,8 +35,6 @@ import java.util.TimeZone;
  */
 final class CachedDateFormat extends DateFormat {
 
-    private static final long serialVersionUID = -1253877934598423628L;
-
     /**
      * Constant used to represent that there was no change
      * observed when changing the millisecond count.
@@ -49,6 +47,8 @@ final class CachedDateFormat extends Dat
      */
     public static final int UNRECOGNIZED_MILLISECONDS = -1;
 
+    private static final long serialVersionUID = -1253877934598423628L;
+
     /**
      * Supported digit set.  If the wrapped DateFormat uses
      * a different unit set, the millisecond pattern

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/ClassNamePatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/ClassNamePatternConverter.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/ClassNamePatternConverter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/ClassNamePatternConverter.java Sun Jan 20 19:59:55 2013
@@ -28,7 +28,7 @@ import org.apache.logging.log4j.core.con
 public final class ClassNamePatternConverter extends NamePatternConverter {
 
     private static final String NA = "?";
-    
+
     /**
      * Private constructor.
      *

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java Sun Jan 20 19:59:55 2013
@@ -35,12 +35,12 @@ public final class DatePatternConverter 
      * ABSOLUTE string literal.
      */
     private static final String ABSOLUTE_FORMAT = "ABSOLUTE";
-    
+
     /**
      * COMPACT string literal.
      */
     private static final String COMPACT_FORMAT = "COMPACT";
-    
+
     /**
      * SimpleTimePattern for ABSOLUTE.
      */
@@ -50,7 +50,7 @@ public final class DatePatternConverter 
      * DATE string literal.
      */
     private static final String DATE_AND_TIME_FORMAT = "DATE";
-    
+
     /**
      * SimpleTimePattern for DATE.
      */
@@ -60,27 +60,27 @@ public final class DatePatternConverter 
      * ISO8601 string literal.
      */
     private static final String ISO8601_FORMAT = "ISO8601";
-    
+
     /**
      * ISO8601_BASIC string literal.
      */
     private static final String ISO8601_BASIC_FORMAT = "ISO8601_BASIC";
-    
+
     /**
      * SimpleTimePattern for ISO8601.
      */
     private static final String ISO8601_PATTERN = "yyyy-MM-dd HH:mm:ss,SSS";
-    
+
     /**
      * SimpleTimePattern for ISO8601_BASIC.
      */
     private static final String ISO8601_BASIC_PATTERN = "yyyyMMdd HHmmss,SSS";
-    
+
     /**
      * SimpleTimePattern for COMPACT.
      */
     private static final String COMPACT_PATTERN = "yyyyMMddHHmmssSSS";
-    
+
     /**
      * Date format.
      */
@@ -125,7 +125,7 @@ public final class DatePatternConverter 
         }
 
         SimpleDateFormat tempFormat;
-        
+
         try {
             tempFormat = new SimpleDateFormat(pattern);
         } catch (final IllegalArgumentException e) {
@@ -140,7 +140,7 @@ public final class DatePatternConverter 
             final TimeZone tz = TimeZone.getTimeZone(options[1]);
             tempFormat.setTimeZone(tz);
         }
-        simpleFormat = tempFormat; 
+        simpleFormat = tempFormat;
     }
 
     /**

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/HighlightConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/HighlightConverter.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/HighlightConverter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/HighlightConverter.java Sun Jan 20 19:59:55 2013
@@ -33,23 +33,24 @@ import org.apache.logging.log4j.core.lay
  * Highlight pattern converter. Formats the result of a pattern using a color appropriate for the Level in the LogEvent.
  * <p>
  * For example:
- * 
+ *
  * <pre>
  * %highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}
  * </pre>
  * </p>
- * 
+ *
  * <p>
  * You can define custom colors for each Level:
- * 
+ *
  * <pre>
- * %highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=cyan, TRACE=black}
+ * %highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=cyan,
+ * TRACE=black}
  * </pre>
  * </p>
- * 
+ *
  * <p>
  * You can use a predefined style:
- * 
+ *
  * <pre>
  * %highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}{STYLE=Log4J}
  * </pre>
@@ -60,9 +61,10 @@ import org.apache.logging.log4j.core.lay
  * <li>{@code Logback}</li>
  * </ul>
  * </p>
- * 
+ *
  * <p>
- * You can use whitespace around the comma and equal sign. The names in values MUST come from the {@linkplain AnsiEscape} enum, case is
+ * You can use whitespace around the comma and equal sign. The names in values MUST come from the
+ * {@linkplain AnsiEscape} enum, case is
  * normalized to upper-case internally.
  * </p>
  */
@@ -82,6 +84,10 @@ public final class HighlightConverter ex
 
     private static final Map<String, EnumMap<Level, String>> STYLES = new HashMap<String, EnumMap<Level, String>>();
 
+    private final List<PatternFormatter> formatters;
+
+    private final EnumMap<Level, String> levelStyles;
+
     static {
         // Default styles:
         DEFAULT_STYLES.put(Level.FATAL, AnsiEscape.createSequence("BRIGHT", "RED"));
@@ -103,23 +109,37 @@ public final class HighlightConverter ex
     }
 
     /**
-     * Creates a level style map where values are ANSI escape sequences given configuration options in {@code option[1]}.
+     * Construct the converter.
+     *
+     * @param formatters
+     *            The PatternFormatters to generate the text to manipulate.
+     */
+    private HighlightConverter(final List<PatternFormatter> formatters, final EnumMap<Level, String> levelStyles) {
+        super("style", "style");
+        this.formatters = formatters;
+        this.levelStyles = levelStyles;
+    }
+
+    /**
+     * Creates a level style map where values are ANSI escape sequences given configuration options in
+     * {@code option[1]}.
      * <p/>
      * The format of the option string in {@code option[1]} is:
-     * 
+     *
      * <pre>
      * Level1=Value, Level2=Value, ...
      * </pre>
-     * 
+     *
      * For example:
-     * 
+     *
      * <pre>
      * ERROR=red bold, WARN=yellow bold, INFO=green, ...
      * </pre>
-     * 
-     * You can use whitespace around the comma and equal sign. The names in values MUST come from the {@linkplain AnsiEscape} enum, case is
+     *
+     * You can use whitespace around the comma and equal sign. The names in values MUST come from the
+     * {@linkplain AnsiEscape} enum, case is
      * normalized to upper-case internally.
-     * 
+     *
      * @param options
      *            The second slot can optionally contain the style map.
      * @return a new map
@@ -128,7 +148,7 @@ public final class HighlightConverter ex
         if (options.length < 2) {
             return DEFAULT_STYLES;
         }
-        final Map<String, String> styles = AnsiEscape.createMap(options[1], new String[] { STYLE_KEY });
+        final Map<String, String> styles = AnsiEscape.createMap(options[1], new String[] {STYLE_KEY});
         final EnumMap<Level, String> levelStyles = new EnumMap<Level, String>(DEFAULT_STYLES);
         for (final Map.Entry<String, String> entry : styles.entrySet()) {
             final String key = entry.getKey().toUpperCase(Locale.ENGLISH);
@@ -136,14 +156,16 @@ public final class HighlightConverter ex
             if (STYLE_KEY.equalsIgnoreCase(key)) {
                 final EnumMap<Level, String> enumMap = STYLES.get(value.toUpperCase(Locale.ENGLISH));
                 if (enumMap == null) {
-                    LOGGER.error("Unkown level style: " + value + ". Use one of " + Arrays.toString(STYLES.keySet().toArray()));
+                    LOGGER.error("Unkown level style: " + value + ". Use one of " +
+                        Arrays.toString(STYLES.keySet().toArray()));
                 } else {
                     levelStyles.putAll(enumMap);
                 }
             } else {
                 final Level level = Level.valueOf(key);
                 if (level == null) {
-                    LOGGER.error("Unkown level name: " + key + ". Use one of " + Arrays.toString(DEFAULT_STYLES.keySet().toArray()));
+                    LOGGER.error("Unkown level name: " + key + ". Use one of " +
+                        Arrays.toString(DEFAULT_STYLES.keySet().toArray()));
                 } else {
                     levelStyles.put(level, value);
                 }
@@ -154,11 +176,10 @@ public final class HighlightConverter ex
 
     /**
      * Gets an instance of the class.
-     * 
-     * @param config
-     *            The current Configuration.
-     * @param options
-     *            pattern options, may be null. If first element is "short", only the first line of the throwable will be formatted.
+     *
+     * @param config The current Configuration.
+     * @param options pattern options, may be null. If first element is "short", only the first line of the
+     *                throwable will be formatted.
      * @return instance of class.
      */
     public static HighlightConverter newInstance(final Configuration config, final String[] options) {
@@ -175,22 +196,6 @@ public final class HighlightConverter ex
         return new HighlightConverter(formatters, createLevelStyleMap(options));
     }
 
-    private final List<PatternFormatter> formatters;
-
-    private final EnumMap<Level, String> levelStyles;
-
-    /**
-     * Construct the converter.
-     * 
-     * @param formatters
-     *            The PatternFormatters to generate the text to manipulate.
-     */
-    private HighlightConverter(final List<PatternFormatter> formatters, final EnumMap<Level, String> levelStyles) {
-        super("style", "style");
-        this.formatters = formatters;
-        this.levelStyles = levelStyles;
-    }
-
     /**
      * {@inheritDoc}
      */
@@ -202,7 +207,8 @@ public final class HighlightConverter ex
         }
 
         if (buf.length() > 0) {
-            toAppendTo.append(levelStyles.get(event.getLevel())).append(buf.toString()).append(AnsiEscape.getDefaultStyle());
+            toAppendTo.append(levelStyles.get(event.getLevel())).append(buf.toString()).
+                append(AnsiEscape.getDefaultStyle());
         }
     }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/LogEventPatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/LogEventPatternConverter.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/LogEventPatternConverter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/LogEventPatternConverter.java Sun Jan 20 19:59:55 2013
@@ -25,12 +25,12 @@ import org.apache.logging.log4j.status.S
  * that can format information from instances of LoggingEvent.
  */
 public abstract class LogEventPatternConverter extends AbstractPatternConverter {
-    
+
     /**
      * Allow subclasses access to the status logger without creating another instance.
      */
     protected static final Logger LOGGER = StatusLogger.getLogger();
-    
+
     /**
      * Constructs an instance of LoggingEventPatternConverter.
      *

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/SequenceNumberPatternConverter.java Sun Jan 20 19:59:55 2013
@@ -28,9 +28,9 @@ import java.util.concurrent.atomic.Atomi
 @Plugin(name = "SequenceNumberPatternConverter", type = "Converter")
 @ConverterKeys({"sn", "sequenceNumber" })
 public final class SequenceNumberPatternConverter extends LogEventPatternConverter {
-    
-    private static final AtomicLong sequence = new AtomicLong();
-    
+
+    private static final AtomicLong SEQUENCE = new AtomicLong();
+
     /**
      * Singleton.
      */
@@ -60,6 +60,6 @@ public final class SequenceNumberPattern
      */
     @Override
     public void format(final LogEvent event, final StringBuilder toAppendTo) {
-        toAppendTo.append(Long.toString(sequence.incrementAndGet()));
+        toAppendTo.append(Long.toString(SEQUENCE.incrementAndGet()));
     }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/ThrowablePatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/ThrowablePatternConverter.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/ThrowablePatternConverter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/ThrowablePatternConverter.java Sun Jan 20 19:59:55 2013
@@ -32,6 +32,9 @@ import java.io.StringWriter;
 @ConverterKeys({"ex", "throwable", "exception" })
 public class ThrowablePatternConverter extends LogEventPatternConverter {
 
+    /**
+     * Do not format the exception.
+     */
     protected static final String NONE = "none";
     /**
      * Format the whole stack trace.

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/BasicContextSelector.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/BasicContextSelector.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/BasicContextSelector.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/BasicContextSelector.java Sun Jan 20 19:59:55 2013
@@ -28,16 +28,16 @@ import java.util.List;
  */
 public class BasicContextSelector implements ContextSelector {
 
-    private static final LoggerContext context = new LoggerContext("Default");
+    private static final LoggerContext CONTEXT = new LoggerContext("Default");
 
     public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext) {
 
         final LoggerContext ctx = ContextAnchor.THREAD_CONTEXT.get();
-        return ctx != null ? ctx : context;
+        return ctx != null ? ctx : CONTEXT;
     }
 
     public LoggerContext locateContext(final String name, final String configLocation) {
-        return context;
+        return CONTEXT;
     }
 
     public void removeContext(final LoggerContext context) {
@@ -46,7 +46,7 @@ public class BasicContextSelector implem
 
     public List<LoggerContext> getLoggerContexts() {
         final List<LoggerContext> list = new ArrayList<LoggerContext>();
-        list.add(context);
+        list.add(CONTEXT);
         return Collections.unmodifiableList(list);
     }
 

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/ClassLoaderContextSelector.java Sun Jan 20 19:59:55 2013
@@ -46,15 +46,15 @@ import java.util.concurrent.atomic.Atomi
  */
 public class ClassLoaderContextSelector implements ContextSelector {
 
-    private static final AtomicReference<LoggerContext> context = new AtomicReference<LoggerContext>();
+    private static final AtomicReference<LoggerContext> CONTEXT = new AtomicReference<LoggerContext>();
 
     private static PrivateSecurityManager securityManager;
 
     private static Method getCallerClass;
 
-    private static final StatusLogger logger = StatusLogger.getLogger();
+    private static final StatusLogger LOGGER = StatusLogger.getLogger();
 
-    private static final ConcurrentMap<String, AtomicReference<WeakReference<LoggerContext>>> contextMap =
+    private static final ConcurrentMap<String, AtomicReference<WeakReference<LoggerContext>>> CONTEXT_MAP =
         new ConcurrentHashMap<String, AtomicReference<WeakReference<LoggerContext>>>();
 
     static {
@@ -135,17 +135,17 @@ public class ClassLoaderContextSelector 
     }
 
     public void removeContext(final LoggerContext context) {
-        for (final Map.Entry<String, AtomicReference<WeakReference<LoggerContext>>> entry : contextMap.entrySet()) {
+        for (final Map.Entry<String, AtomicReference<WeakReference<LoggerContext>>> entry : CONTEXT_MAP.entrySet()) {
             final LoggerContext ctx = entry.getValue().get().get();
             if (ctx == context) {
-                contextMap.remove(entry.getKey());
+                CONTEXT_MAP.remove(entry.getKey());
             }
         }
     }
 
     public List<LoggerContext> getLoggerContexts() {
         final List<LoggerContext> list = new ArrayList<LoggerContext>();
-        final Collection<AtomicReference<WeakReference<LoggerContext>>> coll = contextMap.values();
+        final Collection<AtomicReference<WeakReference<LoggerContext>>> coll = CONTEXT_MAP.values();
         for (final AtomicReference<WeakReference<LoggerContext>> ref : coll) {
             final LoggerContext ctx = ref.get().get();
             if (ctx != null) {
@@ -157,14 +157,14 @@ public class ClassLoaderContextSelector 
 
     private LoggerContext locateContext(final ClassLoader loader, final String configLocation) {
         final String name = loader.toString();
-        final AtomicReference<WeakReference<LoggerContext>> ref = contextMap.get(name);
+        final AtomicReference<WeakReference<LoggerContext>> ref = CONTEXT_MAP.get(name);
         if (ref == null) {
             LoggerContext ctx = new LoggerContext(name, null, configLocation);
             final AtomicReference<WeakReference<LoggerContext>> r =
                 new AtomicReference<WeakReference<LoggerContext>>();
             r.set(new WeakReference<LoggerContext>(ctx));
-            contextMap.putIfAbsent(loader.toString(), r);
-            ctx = contextMap.get(name).get().get();
+            CONTEXT_MAP.putIfAbsent(loader.toString(), r);
+            ctx = CONTEXT_MAP.get(name).get().get();
             return ctx;
         } else {
             final WeakReference<LoggerContext> r = ref.get();
@@ -191,23 +191,23 @@ public class ClassLoaderContextSelector 
                 }
             }
         } catch (final ClassNotFoundException cnfe) {
-            logger.debug("sun.reflect.Reflection is not installed");
+            LOGGER.debug("sun.reflect.Reflection is not installed");
         }
         try {
             securityManager = new PrivateSecurityManager();
         } catch (final Exception ex) {
             ex.printStackTrace();
-            logger.debug("Unable to install security manager", ex);
+            LOGGER.debug("Unable to install security manager", ex);
         }
     }
 
     private LoggerContext getDefault() {
-        final LoggerContext ctx = context.get();
+        final LoggerContext ctx = CONTEXT.get();
         if (ctx != null) {
             return ctx;
         }
-        context.compareAndSet(null, new LoggerContext("Default"));
-        return context.get();
+        CONTEXT.compareAndSet(null, new LoggerContext("Default"));
+        return CONTEXT.get();
     }
 
     /**

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/JNDIContextSelector.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/JNDIContextSelector.java?rev=1435937&r1=1435936&r2=1435937&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/JNDIContextSelector.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/selector/JNDIContextSelector.java Sun Jan 20 19:59:55 2013
@@ -86,9 +86,9 @@ import java.util.concurrent.ConcurrentMa
  */
 public class JNDIContextSelector implements NamedContextSelector {
 
-    private static final LoggerContext context = new LoggerContext("Default");
+    private static final LoggerContext CONTEXT = new LoggerContext("Default");
 
-    private static final ConcurrentMap<String, LoggerContext> contextMap =
+    private static final ConcurrentMap<String, LoggerContext> CONTEXT_MAP =
         new ConcurrentHashMap<String, LoggerContext>();
 
     private static final StatusLogger LOGGER = StatusLogger.getLogger();
@@ -109,7 +109,7 @@ public class JNDIContextSelector impleme
             LOGGER.error("Unable to lookup " + Constants.JNDI_CONTEXT_NAME, ne);
         }
 
-        return loggingContextName == null ? context : locateContext(loggingContextName, null);
+        return loggingContextName == null ? CONTEXT : locateContext(loggingContextName, null);
     }
 
     public LoggerContext locateContext(final String name, final String configLocation) {
@@ -117,28 +117,28 @@ public class JNDIContextSelector impleme
             LOGGER.error("A context name is required to locate a LoggerContext");
             return null;
         }
-        if (!contextMap.containsKey(name)) {
+        if (!CONTEXT_MAP.containsKey(name)) {
             final LoggerContext ctx = new LoggerContext(name, null, configLocation);
-            contextMap.putIfAbsent(name, ctx);
+            CONTEXT_MAP.putIfAbsent(name, ctx);
         }
-        return contextMap.get(name);
+        return CONTEXT_MAP.get(name);
     }
 
     public void removeContext(final LoggerContext context) {
 
-        for (final Map.Entry<String, LoggerContext> entry : contextMap.entrySet()) {
+        for (final Map.Entry<String, LoggerContext> entry : CONTEXT_MAP.entrySet()) {
             if (entry.getValue().equals(context)) {
-                contextMap.remove(entry.getKey());
+                CONTEXT_MAP.remove(entry.getKey());
             }
         }
     }
 
     public LoggerContext removeContext(final String name) {
-        return contextMap.remove(name);
+        return CONTEXT_MAP.remove(name);
     }
 
     public List<LoggerContext> getLoggerContexts() {
-        final List<LoggerContext> list = new ArrayList<LoggerContext>(contextMap.values());
+        final List<LoggerContext> list = new ArrayList<LoggerContext>(CONTEXT_MAP.values());
         return Collections.unmodifiableList(list);
     }