logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattsic...@apache.org
Subject svn commit: r1592142 [1/2] - in /logging/log4j/log4j2/branches/experimental: ./ log4j-1.2-api/ log4j-api/src/main/java/org/apache/logging/log4j/ log4j-api/src/main/java/org/apache/logging/log4j/spi/ log4j-bom/ log4j-core/ log4j-core/src/main/java/org/a...
Date Sat, 03 May 2014 03:45:42 GMT
Author: mattsicker
Date: Sat May  3 03:45:40 2014
New Revision: 1592142

URL: http://svn.apache.org/r1592142
Log:
Merge from trunk.

Added:
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/osgi/
      - copied from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/osgi/
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/package-info.java
      - copied unchanged from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/package-info.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/
      - copied from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/
      - copied from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/lang/
      - copied from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/lang/
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/resources/META-INF/services/javax.annotation.processing.Processor
      - copied unchanged from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/main/resources/META-INF/services/javax.annotation.processing.Processor
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/LookupTest.java
      - copied unchanged from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/LookupTest.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/config/json/
      - copied from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/json/
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/processor/
      - copied from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/processor/
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/
      - copied from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/log4j-collectionLogging.xml
      - copied unchanged from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-collectionLogging.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/log4j-config.json
      - copied unchanged from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-config.json
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/log4j-fatalOnly.xml
      - copied unchanged from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-fatalOnly.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/log4j-lookup.xml
      - copied unchanged from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-lookup.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/serializedEvent.dat
      - copied unchanged from r1592141, logging/log4j/log4j2/trunk/log4j-core/src/test/resources/serializedEvent.dat
    logging/log4j/log4j2/branches/experimental/log4j-nosql/
      - copied from r1592141, logging/log4j/log4j2/trunk/log4j-nosql/
Removed:
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/AppendersPlugin.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/LoggersPlugin.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginBuilder.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginManager.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginType.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PropertiesPlugin.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/ResolverUtil.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/nosql/
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/ResolverUtilTest.java
    logging/log4j/log4j2/branches/experimental/log4j-osgi/
    logging/log4j/log4j2/branches/experimental/log4j-plugin-processor/
    logging/log4j/log4j2/branches/experimental/log4j-slf4j-impl/src/main/java/org/slf4j/helpers/
Modified:
    logging/log4j/log4j2/branches/experimental/   (props changed)
    logging/log4j/log4j2/branches/experimental/log4j-1.2-api/pom.xml
    logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/Level.java
    logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
    logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java
    logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/MarkerManager.java
    logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerProvider.java
    logging/log4j/log4j2/branches/experimental/log4j-bom/pom.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/pom.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Node.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/SensitivePluginAttribute.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfiguration.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfigurationFactory.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/CachedClock.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/ClockFactory.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Loader.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Throwables.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ReflectiveCallerClassUtility.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/net/MulticastDNSAdvertiser.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/CollectionLoggingTest.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/DataSourceConnectionSourceTest.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/FactoryMethodConnectionSourceTest.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/XMLConfigurationPropsTest.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/HTMLLayoutTest.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/JSONLayoutTest.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/XMLLayoutTest.java
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/log4j-filetest.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/log4j-reference-level.json
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/log4j-routing2.json
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-data-source.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-h2-factory-method.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc/log4j2-hsqldb-factory-method.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-base.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-h2-jpa-basic.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-hsqldb-jpa-base.xml
    logging/log4j/log4j2/branches/experimental/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jpa/log4j2-hsqldb-jpa-basic.xml
    logging/log4j/log4j2/branches/experimental/log4j-flume-ng/pom.xml
    logging/log4j/log4j2/branches/experimental/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java
    logging/log4j/log4j2/branches/experimental/log4j-jcl/pom.xml
    logging/log4j/log4j2/branches/experimental/log4j-jmx-gui/pom.xml
    logging/log4j/log4j2/branches/experimental/log4j-samples/flume-common/pom.xml
    logging/log4j/log4j2/branches/experimental/log4j-samples/flume-embedded/pom.xml
    logging/log4j/log4j2/branches/experimental/log4j-samples/flume-remote/pom.xml
    logging/log4j/log4j2/branches/experimental/log4j-slf4j-impl/pom.xml
    logging/log4j/log4j2/branches/experimental/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jMarker.java
    logging/log4j/log4j2/branches/experimental/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/package-info.java
    logging/log4j/log4j2/branches/experimental/log4j-taglib/pom.xml
    logging/log4j/log4j2/branches/experimental/log4j-to-slf4j/pom.xml
    logging/log4j/log4j2/branches/experimental/pom.xml
    logging/log4j/log4j2/branches/experimental/src/changes/changes.xml
    logging/log4j/log4j2/branches/experimental/src/site/xdoc/manual/configuration.xml.vm
    logging/log4j/log4j2/branches/experimental/src/site/xdoc/manual/layouts.xml.vm
    logging/log4j/log4j2/branches/experimental/src/site/xdoc/manual/plugins.xml

Propchange: logging/log4j/log4j2/branches/experimental/
------------------------------------------------------------------------------
  Merged /logging/log4j/log4j2/trunk:r1588796-1592141

Modified: logging/log4j/log4j2/branches/experimental/log4j-1.2-api/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-1.2-api/pom.xml?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-1.2-api/pom.xml (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-1.2-api/pom.xml Sat May  3 03:45:40 2014
@@ -99,7 +99,6 @@
         <configuration>
           <instructions>
             <Export-Package>org.apache.log4j.*</Export-Package>
-            <Fragment-Host>org.apache.logging.log4j.api;bundle-version=${project.version.osgi}</Fragment-Host>
           </instructions>
         </configuration>
       </plugin>

Modified: logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/Level.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/Level.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/Level.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/Level.java Sat May  3 03:45:40 2014
@@ -50,42 +50,42 @@ public final class Level implements Comp
      * No events will be logged.
      */
     public static final Level OFF;
-    
+
     /**
      * A severe error that will prevent the application from continuing.
      */
     public static final Level FATAL;
-    
+
     /**
      * An error in the application, possibly recoverable.
      */
     public static final Level ERROR;
-    
+
     /**
      * An event that might possible lead to an error.
      */
     public static final Level WARN;
-    
+
     /**
      * An event for informational purposes.
      */
     public static final Level INFO;
-    
+
     /**
      * A general debugging event.
      */
     public static final Level DEBUG;
-    
+
     /**
      * A fine-grained debug message, typically capturing the flow through the application.
      */
     public static final Level TRACE;
-    
+
     /**
      * All events should be logged.
      */
     public static final Level ALL;
-    
+
     static {
         OFF = new Level("OFF", StandardLevel.OFF.intLevel());
         FATAL = new Level("FATAL", StandardLevel.FATAL.intLevel());
@@ -101,7 +101,7 @@ public final class Level implements Comp
     private final int intLevel;
     private final StandardLevel standardLevel;
 
-    private Level(String name, int intLevel) {
+    private Level(final String name, final int intLevel) {
         if (name == null || name.isEmpty()) {
             throw new IllegalArgumentException("Illegal null Level constant");
         }
@@ -127,7 +127,7 @@ public final class Level implements Comp
     /**
      * Compares this level against the level passed as an argument and returns true if this level is the same or is less
      * specific.T
-     * 
+     *
      * @param level
      *            The level to test.
      * @return True if this level Level is less specific or the same as the given Level.
@@ -139,7 +139,7 @@ public final class Level implements Comp
     /**
      * Compares this level against the level passed as an argument and returns true if this level is the same or is more
      * specific.
-     * 
+     *
      * @param level
      *            The level to test.
      * @return True if this level Level is more specific or the same as the given Level.
@@ -190,7 +190,7 @@ public final class Level implements Comp
      * @return The Level.
      * @throws java.lang.IllegalArgumentException if the name is null or intValue is less than zero.
      */
-    public static Level forName(String name, int intValue) {
+    public static Level forName(final String name, final int intValue) {
         Level level = levels.get(name);
         if (level != null) {
             return level;
@@ -204,11 +204,11 @@ public final class Level implements Comp
     }
 
     /**
-     * Return the Level assoicated with the name or null if the Level cannot be found.
+     * Return the Level associated with the name or null if the Level cannot be found.
      * @param name The name of the Level.
      * @return The Level or null.
      */
-    public static Level getLevel(String name) {
+    public static Level getLevel(final String name) {
         return levels.get(name);
     }
 
@@ -253,20 +253,21 @@ public final class Level implements Comp
      * Return the Level associated with the name.
      * @param name The name of the Level to return.
      * @return The Level.
+     * @throws java.lang.NullPointerException if the Level name is {@code null}.
      * @throws java.lang.IllegalArgumentException if the Level name is not registered.
      */
-    public static Level valueOf(String name) {
+    public static Level valueOf(final String name) {
         if (name == null) {
-            throw new IllegalArgumentException("Unknown level constant [" + name + "].");
+            throw new NullPointerException("No level name given.");
         }
-        name = name.toUpperCase();
-        if (levels.containsKey(name)) {
-            return levels.get(name);
+        final String levelName = name.toUpperCase();
+        if (levels.containsKey(levelName)) {
+            return levels.get(levelName);
         }
-        throw new IllegalArgumentException("Unknown level constant [" + name + "].");
+        throw new IllegalArgumentException("Unknown level constant [" + levelName + "].");
     }
 
-    public static <T extends Enum<T>> T valueOf(Class<T> enumType, String name) {
+    public static <T extends Enum<T>> T valueOf(final Class<T> enumType, final String name) {
         return Enum.valueOf(enumType, name);
     }
 

Modified: logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java Sat May  3 03:45:40 2014
@@ -36,7 +36,7 @@ import org.apache.logging.log4j.util.Pro
  */
 public class LogManager {
 
-    private static LoggerContextFactory factory;
+    private static volatile LoggerContextFactory factory;
 
     private static final String FACTORY_PROPERTY_NAME = "log4j2.loggerContextFactory";
 
@@ -81,18 +81,17 @@ public class LogManager {
                             if (LoggerContextFactory.class.isAssignableFrom(clazz)) {
                                 factories.put(provider.getPriority(), (LoggerContextFactory) clazz.newInstance());
                             } else {
-                                LOGGER.error(className + " does not implement " + LoggerContextFactory.class.getName());
+                                LOGGER.error("{} does not implement {}", className, LoggerContextFactory.class.getName());
                             }
                         } catch (final ClassNotFoundException cnfe) {
-                            LOGGER.error("Unable to locate class " + className + " specified in " +
+                            LOGGER.error("Unable to locate class {} specified in {}", className,
                                 provider.getURL().toString(), cnfe);
                         } catch (final IllegalAccessException iae) {
-                            LOGGER.error("Unable to create class " + className + " specified in " +
+                            LOGGER.error("Unable to create class {} specified in {}", className,
                                 provider.getURL().toString(), iae);
                         } catch (final Exception e) {
-                            LOGGER.error("Unable to create class " + className + " specified in " +
+                            LOGGER.error("Unable to create class {} specified in {}", className,
                                 provider.getURL().toString(), e);
-                            e.printStackTrace();
                         }
                     }
                 }
@@ -126,7 +125,7 @@ public class LogManager {
      * @return true if the Logger exists, false otherwise.
      * @see LoggerContext#hasLogger(String)
      */
-    public static boolean exists(String name) {
+    public static boolean exists(final String name) {
         return getContext().hasLogger(name);
     }
 
@@ -285,7 +284,7 @@ public class LogManager {
     }
 
     /**
-     * Returns the LoggerContextFactory.
+     * Returns the current LoggerContextFactory.
      * @return The LoggerContextFactory.
      */
     public static LoggerContextFactory getFactory() {
@@ -293,6 +292,24 @@ public class LogManager {
     }
 
     /**
+     * Sets the current LoggerContextFactory to use. Normally, the appropriate LoggerContextFactory is created at
+     * startup, but in certain environments, a LoggerContextFactory implementation may not be available at this point.
+     * Thus, an alternative LoggerContextFactory can be set at runtime.
+     *
+     * <p>
+     * Note that any Logger or LoggerContext objects already created will still be valid, but they will no longer be
+     * accessible through LogManager. Thus, <strong>it is a bad idea to use this method without a good reason</strong>!
+     * Generally, this method should be used only during startup before any code starts caching Logger objects.
+     * </p>
+     *
+     * @param factory the LoggerContextFactory to use.
+     */
+    // FIXME: should we allow only one update of the factory?
+    public static void setFactory(final LoggerContextFactory factory) {
+        LogManager.factory = factory;
+    }
+
+    /**
      * Returns a formatter Logger using the fully qualified name of the Class as the Logger name.
      * <p>
      * This logger let you use a {@link java.util.Formatter} string in the message to format parameters.

Modified: logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java Sat May  3 03:45:40 2014
@@ -35,34 +35,37 @@ public interface Marker extends Serializ
 
     /**
      * Returns the first parent of this Marker.
-     * @return The first parent Marker or null if this Marker has no parents.
+     * @return The first parent Marker or {@code null} if this Marker has no parents.
      * @deprecated Use getParents() instead.
      */
+    @Deprecated
     Marker getParent();
 
     /**
      * Returns a list of parents of this Marker.
-     * @return The parent Markers or null if this Marker has no parents.
+     * @return The parent Markers or {@code null} if this Marker has no parents.
      */
     Marker[] getParents();
 
     /**
      * Indicates whether this Marker has references to any other Markers.
-     * @return true if the Marker has parent Markers.
+     * @return {@code true} if the Marker has parent Markers
      */
     boolean hasParents();
 
     /**
      * Checks whether this Marker is an instance of the specified Marker.
      * @param m The Marker to check.
-     * @return true of this Marker or one of its ancestors is the specified Marker, false otherwise.
+     * @return {@code true} if this Marker or one of its ancestors is the specified Marker, {@code false} otherwise.
+     * @throws IllegalArgumentException if the argument is {@code null}
      */
     boolean isInstanceOf(Marker m);
 
     /**
      * Checks whether this Marker is an instance of the specified Marker.
      * @param name The name of the Marker.
-     * @return true of this Marker or one of its ancestors matches the specified name, false otherwise.
+     * @return {@code true} if this Marker or one of its ancestors matches the specified name, {@code false} otherwise.
+     * @throws IllegalArgumentException if the argument is {@code null}
      */
     boolean isInstanceOf(String name);
 
@@ -70,12 +73,13 @@ public interface Marker extends Serializ
      * Adds a Marker as a parent to this Marker.
      * @param marker The parent marker to add.
      * @return The current Marker object, thus allowing multiple adds to be concatenated.
+     * @throws IllegalArgumentException if the argument is {@code null}
      */
     Marker add(Marker marker);
 
     /**
      * Replaces the set of parent Markers with the provided Markers.
-     * @param markers The new set of parent Markers or null.
+     * @param markers The new set of parent Markers or {@code null} to clear the parents.
      * @return The current Marker object.
      */
     Marker setParents(Marker... markers);
@@ -83,7 +87,8 @@ public interface Marker extends Serializ
     /**
      * Removes the specified Marker as a parent of this Marker.
      * @param marker The marker to remove.
-     * @return true if the marker was removed.
+     * @return {@code true} if the marker was removed.
+     * @throws IllegalArgumentException if the argument is {@code null}
      */
     boolean remove(Marker marker);
 }

Modified: logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/MarkerManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/MarkerManager.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/MarkerManager.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/MarkerManager.java Sat May  3 03:45:40 2014
@@ -17,8 +17,6 @@
 package org.apache.logging.log4j;
 
 import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
@@ -29,7 +27,7 @@ import java.util.concurrent.ConcurrentMa
  */
 public final class MarkerManager {
 
-    private static ConcurrentMap<String, Marker> markerMap = new ConcurrentHashMap<String, Marker>();
+    private static final ConcurrentMap<String, Marker> markerMap = new ConcurrentHashMap<String, Marker>();
 
     private MarkerManager() {
     }
@@ -38,6 +36,7 @@ public final class MarkerManager {
      * Retrieve a Marker or create a Marker that has no parent.
      * @param name The name of the Marker.
      * @return The Marker with the specified name.
+     * @throws IllegalArgumentException if the argument is {@code null}
      */
     public static Marker getMarker(final String name) {
         markerMap.putIfAbsent(name, new Log4jMarker(name));
@@ -52,12 +51,15 @@ public final class MarkerManager {
      * @throws IllegalArgumentException if the parent Marker does not exist.
      * @deprecated Use the Marker add or set methods to add parent Markers. Will be removed by final GA release.
      */
+    @Deprecated
     public static Marker getMarker(final String name, final String parent) {
         final Marker parentMarker = markerMap.get(parent);
         if (parentMarker == null) {
             throw new IllegalArgumentException("Parent Marker " + parent + " has not been defined");
         }
-        return getMarker(name, parentMarker);
+        @SuppressWarnings("deprecation")
+        final Marker marker = getMarker(name, parentMarker);
+        return marker;
     }
 
     /**
@@ -65,8 +67,10 @@ public final class MarkerManager {
      * @param name The name of the Marker.
      * @param parent The parent Marker.
      * @return The Marker with the specified name.
+     * @throws IllegalArgumentException if any argument is {@code null}
      * @deprecated Use the Marker add or set methods to add parent Markers. Will be removed by final GA release.
      */
+    @Deprecated
     public static Marker getMarker(final String name, final Marker parent) {
         markerMap.putIfAbsent(name, new Log4jMarker(name));
         return markerMap.get(name).add(parent);
@@ -81,26 +85,40 @@ public final class MarkerManager {
         private final String name;
         private volatile Marker[] parents;
 
+        /**
+         * Constructs a new Marker.
+         * @param name the name of the Marker.
+         * @throws IllegalArgumentException if the argument is {@code null}
+         */
         public Log4jMarker(final String name) {
+            if (name == null) {
+                // we can't store null references in a ConcurrentHashMap as it is, not to mention that a null Marker
+                // name seems rather pointless. To get an "anonymous" Marker, just use an empty string.
+                throw new IllegalArgumentException("Marker name cannot be null.");
+            }
             this.name = name;
             this.parents = null;
         }
 
+        // TODO: use java.util.concurrent
+
         @Override
-        public synchronized Marker add(Marker parent) {
+        public synchronized Marker add(final Marker parent) {
             if (parent == null) {
                 throw new IllegalArgumentException("A parent marker must be specified");
             }
             // It is not strictly necessary to copy the variable here but it should perform better than
             // Accessing a volatile variable multiple times.
-            Marker[] localParents = this.parents;
+            final Marker[] localParents = this.parents;
             // Don't add a parent that is already in the hierarchy.
             if (localParents != null && (contains(parent, localParents) || parent.isInstanceOf(this))) {
                 return this;
             }
-            int size = localParents == null ? 1 : localParents.length + 1;
-            Marker[] markers = new Marker[size];
+            final int size = localParents == null ? 1 : localParents.length + 1;
+            final Marker[] markers = new Marker[size];
             if (localParents != null) {
+                // It's perfectly OK to call arraycopy in a synchronized context; it's still faster
+                //noinspection CallToNativeMethodWhileLocked
                 System.arraycopy(localParents, 0, markers, 0, localParents.length);
             }
             markers[size - 1] = parent;
@@ -108,16 +126,19 @@ public final class MarkerManager {
             return this;
         }
 
+        // TODO: add(Marker parent, Marker... moreParents)
+
         @Override
-        public synchronized boolean remove(Marker parent) {
+        public synchronized boolean remove(final Marker parent) {
             if (parent == null) {
                 throw new IllegalArgumentException("A parent marker must be specified");
             }
-            Marker[] localParents = this.parents;
+            final Marker[] localParents = this.parents;
             if (localParents == null) {
                 return false;
             }
-            if (localParents.length == 1) {
+            final int localParentsLength = localParents.length;
+            if (localParentsLength == 1) {
                 if (localParents[0].equals(parent)) {
                     parents = null;
                     return true;
@@ -125,11 +146,13 @@ public final class MarkerManager {
                 return false;
             }
             int index = 0;
-            Marker[] markers = new Marker[localParents.length - 1];
-            for (int i = 0; i < localParents.length; ++i) {
-                Marker marker = localParents[i];
+            final Marker[] markers = new Marker[localParentsLength - 1];
+            //noinspection ForLoopReplaceableByForEach
+            for (int i = 0; i < localParentsLength; i++) {
+                final Marker marker = localParents[i];
                 if (!marker.equals(parent)) {
-                    if (index == localParents.length - 1) {
+                    if (index == localParentsLength - 1) {
+                        // no need to swap array
                         return false;
                     }
                     markers[index++] = marker;
@@ -140,11 +163,11 @@ public final class MarkerManager {
         }
 
         @Override
-        public Marker setParents(Marker... markers) {
+        public Marker setParents(final Marker... markers) {
             if (markers == null || markers.length == 0) {
                 this.parents = null;
             } else {
-                Marker[] array = new Marker[markers.length];
+                final Marker[] array = new Marker[markers.length];
                 System.arraycopy(markers, 0, array, 0, markers.length);
                 this.parents = array;
             }
@@ -182,17 +205,20 @@ public final class MarkerManager {
             if (this == marker) {
                 return true;
             }
-            Marker[] localParents = parents;
+            final Marker[] localParents = parents;
             if (localParents != null) {
                 // With only one or two parents the for loop is slower.
-                if (localParents.length == 1) {
+                final int localParentsLength = localParents.length;
+                if (localParentsLength == 1) {
                     return checkParent(localParents[0], marker);
                 }
-                if (localParents.length == 2) {
+                if (localParentsLength == 2) {
                     return checkParent(localParents[0], marker) || checkParent(localParents[1], marker);
                 }
-                for (int i = 0; i < localParents.length; ++i) {
-                    if (checkParent(localParents[i], marker)) {
+                //noinspection ForLoopReplaceableByForEach
+                for (int i = 0; i < localParentsLength; i++) {
+                    final Marker localParent = localParents[i];
+                    if (checkParent(localParent, marker)) {
                         return true;
                     }
                 }
@@ -209,20 +235,23 @@ public final class MarkerManager {
                 return true;
             }
             // Use a real marker for child comparisons. It is faster than comparing the names.
-            Marker marker = markerMap.get(markerName);
+            final Marker marker = markerMap.get(markerName);
             if (marker == null) {
-                throw new IllegalArgumentException("No marker exists with the name " + markerName);
+                return false;
             }
-            Marker[] localParents = parents;
+            final Marker[] localParents = parents;
             if (localParents != null) {
-                if (localParents.length == 1) {
+                final int localParentsLength = localParents.length;
+                if (localParentsLength == 1) {
                     return checkParent(localParents[0], marker);
                 }
-                if (localParents.length == 2) {
+                if (localParentsLength == 2) {
                     return checkParent(localParents[0], marker) || checkParent(localParents[1], marker);
                 }
-                for (int i = 0; i < localParents.length; ++i) {
-                    if (checkParent(localParents[i], marker)) {
+                //noinspection ForLoopReplaceableByForEach
+                for (int i = 0; i < localParentsLength; i++) {
+                    final Marker localParent = localParents[i];
+                    if (checkParent(localParent, marker)) {
                         return true;
                     }
                 }
@@ -231,20 +260,23 @@ public final class MarkerManager {
             return false;
         }
 
-        private boolean checkParent(Marker parent, Marker marker) {
+        private static boolean checkParent(final Marker parent, final Marker marker) {
             if (parent == marker) {
                 return true;
             }
-            Marker[] localParents = parent instanceof Log4jMarker ? ((Log4jMarker)parent).parents : parent.getParents();
+            final Marker[] localParents = parent instanceof Log4jMarker ? ((Log4jMarker)parent).parents : parent.getParents();
             if (localParents != null) {
-                if (localParents.length == 1) {
+                final int localParentsLength = localParents.length;
+                if (localParentsLength == 1) {
                     return checkParent(localParents[0], marker);
                 }
-                if (localParents.length == 2) {
+                if (localParentsLength == 2) {
                     return checkParent(localParents[0], marker) || checkParent(localParents[1], marker);
                 }
-                for (int i = 0; i < localParents.length; ++i) {
-                    if (checkParent(localParents[i], marker)) {
+                //noinspection ForLoopReplaceableByForEach
+                for (int i = 0; i < localParentsLength; i++) {
+                    final Marker localParent = localParents[i];
+                    if (checkParent(localParent, marker)) {
                         return true;
                     }
                 }
@@ -255,9 +287,10 @@ public final class MarkerManager {
         /*
          * Called from add while synchronized.
          */
-        private boolean contains(Marker parent, Marker[] localParents) {
-
-            for (Marker marker : localParents) {
+        private static boolean contains(final Marker parent, final Marker... localParents) {
+            //noinspection ForLoopReplaceableByForEach
+            for (int i = 0, localParentsLength = localParents.length; i < localParentsLength; i++) {
+                final Marker marker = localParents[i];
                 if (marker == parent) {
                     return true;
                 }
@@ -273,43 +306,40 @@ public final class MarkerManager {
             if (o == null || !(o instanceof Marker)) {
                 return false;
             }
-
             final Marker marker = (Marker) o;
-
-            if (name != null ? !name.equals(marker.getName()) : marker.getName() != null) {
-                return false;
-            }
-
-            return true;
+            return name.equals(marker.getName());
         }
 
         @Override
         public int hashCode() {
-            return name != null ? name.hashCode() : 0;
+            return name.hashCode();
         }
 
         @Override
         public String toString() {
+            // FIXME: might want to use an initial capacity; the default is 16 (or str.length() + 16)
             final StringBuilder sb = new StringBuilder(name);
-            Marker[] localParents = parents;
+            final Marker[] localParents = parents;
             if (localParents != null) {
-                addParentInfo(localParents, sb);
+                addParentInfo(sb, localParents);
             }
             return sb.toString();
         }
 
-        private void addParentInfo(Marker[] parents, StringBuilder sb) {
+        private static void addParentInfo(final StringBuilder sb, final Marker... parents) {
             sb.append("[ ");
             boolean first = true;
-            for (Marker marker : parents) {
+            //noinspection ForLoopReplaceableByForEach
+            for (int i = 0, parentsLength = parents.length; i < parentsLength; i++) {
+                final Marker marker = parents[i];
                 if (!first) {
                     sb.append(", ");
                 }
                 first = false;
                 sb.append(marker.getName());
-                Marker[] p = marker instanceof Log4jMarker ? ((Log4jMarker)marker).parents : marker.getParents();
+                final Marker[] p = marker instanceof Log4jMarker ? ((Log4jMarker) marker).parents : marker.getParents();
                 if (p != null) {
-                    addParentInfo(p, sb);
+                    addParentInfo(sb, p);
                 }
             }
             sb.append(" ]");

Modified: logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerProvider.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerProvider.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerProvider.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLoggerProvider.java Sat May  3 03:45:40 2014
@@ -42,12 +42,12 @@ public abstract class AbstractLoggerProv
     /**
      * Marker for method entry tracing.
      */
-    public static final Marker ENTRY_MARKER = MarkerManager.getMarker("ENTRY", FLOW_MARKER);
+    public static final Marker ENTRY_MARKER = MarkerManager.getMarker("ENTRY").add(FLOW_MARKER);
 
     /**
      * Marker for method exit tracing.
      */
-    public static final Marker EXIT_MARKER = MarkerManager.getMarker("EXIT", FLOW_MARKER);
+    public static final Marker EXIT_MARKER = MarkerManager.getMarker("EXIT").add(FLOW_MARKER);
 
     /**
      * Marker for exception tracing.
@@ -57,12 +57,12 @@ public abstract class AbstractLoggerProv
     /**
      * Marker for throwing exceptions.
      */
-    public static final Marker THROWING_MARKER = MarkerManager.getMarker("THROWING", EXCEPTION_MARKER);
+    public static final Marker THROWING_MARKER = MarkerManager.getMarker("THROWING").add(EXCEPTION_MARKER);
 
     /**
      * Marker for catching exceptions.
      */
-    public static final Marker CATCHING_MARKER = MarkerManager.getMarker("CATCHING", EXCEPTION_MARKER);
+    public static final Marker CATCHING_MARKER = MarkerManager.getMarker("CATCHING").add(EXCEPTION_MARKER);
 
     /**
      * The default MessageFactory class.

Modified: logging/log4j/log4j2/branches/experimental/log4j-bom/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-bom/pom.xml?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-bom/pom.xml (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-bom/pom.xml Sat May  3 03:45:40 2014
@@ -12,7 +12,6 @@
   <name>Apache Log4j 2 BOM</name>
   <description>Apache Log4j 2 Bill of Material</description>
   <artifactId>log4j-bom</artifactId>
-  <version>${project.parent.version}</version>
   <packaging>pom</packaging>
   <dependencyManagement>
     <dependencies>

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/pom.xml?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/pom.xml (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/pom.xml Sat May  3 03:45:40 2014
@@ -38,11 +38,6 @@
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-api</artifactId>
     </dependency>
-    <!-- Used for pre-caching the standard plugins -->
-    <dependency>
-      <groupId>org.apache.logging.log4j</groupId>
-      <artifactId>log4j-plugin-processor</artifactId>
-    </dependency>
     <!-- Used for OSGi bundle support -->
     <dependency>
       <groupId>org.osgi</groupId>
@@ -200,7 +195,7 @@
       <artifactId>logback-classic</artifactId>
       <scope>test</scope>
     </dependency>
-    <!-- XXX: Spring tests? -->
+    <!-- Spring tests (JNDI and such) -->
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-test</artifactId>
@@ -221,86 +216,53 @@
   <build>
     <plugins>
       <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
+        <artifactId>maven-compiler-plugin</artifactId>
         <executions>
           <execution>
+            <!-- disable annotation processing for first pass -->
+            <id>default-compile</id>
             <goals>
-              <goal>test-jar</goal>
+              <goal>compile</goal>
+            </goals>
+            <phase>compile</phase>
+            <configuration>
+              <proc>none</proc>
+            </configuration>
+          </execution>
+          <execution>
+            <!-- then do a processing-only pass to generate plugins .dat file -->
+            <id>process-plugins</id>
+            <goals>
+              <goal>compile</goal>
             </goals>
+            <phase>process-classes</phase>
+            <configuration>
+              <proc>only</proc>
+            </configuration>
           </execution>
         </executions>
       </plugin>
-      <!-- TODO: verify this is no longer required -->
-      <!--
       <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>exec-maven-plugin</artifactId>
-        <version>1.2.1</version>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
         <executions>
           <execution>
-            <phase>process-classes</phase>
             <goals>
-              <goal>java</goal>
+              <goal>test-jar</goal>
             </goals>
           </execution>
         </executions>
-        <configuration>
-          <mainClass>org.apache.logging.log4j.core.config.plugins.PluginManager</mainClass>
-          <arguments>
-            <argument>${project.build.outputDirectory}</argument>
-          </arguments>
-        </configuration>
       </plugin>
-      -->
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
         <configuration>
-          <!--
-            dummy entry to stop bundle plugin from picking up jar config and reporting
-            WARNING: Duplicate name in Manifest
-            See http://markmail.org/message/mpkl24wk3jrjhhjg
-          -->
-          <archive>
-            <forced>true</forced>
-          </archive>
-          <excludeDependencies>true</excludeDependencies>
-          <manifestLocation>target/osgi</manifestLocation>
           <instructions>
-            <!-- stops the "uses" clauses being added to "Export-Package" manifest entry -->
-            <_nouses>true</_nouses>
-            <!-- Stop the JAVA_1_n_HOME variables from being treated as headers by Bnd -->
-            <_removeheaders>JAVA_1_3_HOME,JAVA_1_4_HOME,JAVA_1_5_HOME,JAVA_1_6_HOME,JAVA_1_7_HOME,JAVA_1_8_HOME,JAVA_1_9_HOME</_removeheaders>
-            <Bundle-SymbolicName>${osgi.symbolicName}</Bundle-SymbolicName>
-            <Export-Package>${osgi.export}</Export-Package>
-            <Private-Package>${osgi.private}</Private-Package>
-            <Import-Package>${osgi.import}</Import-Package>
-            <DynamicImport-Package>${osgi.dynamicImport}</DynamicImport-Package>
-            <Bundle-DocURL>${project.url}</Bundle-DocURL>
-            <Fragment-Host>org.apache.logging.log4j-api;bundle-version=${project.version.osgi}</Fragment-Host>
+            <Bundle-SymbolicName>org.apache.logging.log4j.core</Bundle-SymbolicName>
+            <Export-Package>org.apache.logging.log4j.core.*</Export-Package>
+            <Bundle-Activator>org.apache.logging.log4j.core.config.plugins.osgi.Activator</Bundle-Activator>
           </instructions>
         </configuration>
-        <executions>
-          <execution>
-            <phase>generate-sources</phase>
-            <goals>
-              <goal>cleanVersions</goal>
-            </goals>
-            <configuration>
-              <versions>
-                <project.version.osgi>${project.version}</project.version.osgi>
-              </versions>
-            </configuration>
-          </execution>
-          <execution>
-            <id>bundle-manifest</id>
-            <phase>process-classes</phase>
-            <goals>
-              <goal>manifest</goal>
-            </goals>
-          </execution>
-        </executions>
       </plugin>
     </plugins>
   </build>
@@ -349,6 +311,7 @@
           <linksource>true</linksource>
           <links>
             <link>http://docs.oracle.com/javaee/6/api/</link>
+            <link>http://www.osgi.org/javadoc/r4v43/core/</link>
           </links>
           <tags>
             <tag>

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java Sat May  3 03:45:40 2014
@@ -40,10 +40,10 @@ import org.apache.logging.log4j.core.app
 import org.apache.logging.log4j.core.appender.ConsoleAppender;
 import org.apache.logging.log4j.core.async.AsyncLoggerConfig;
 import org.apache.logging.log4j.core.async.AsyncLoggerContextSelector;
-import org.apache.logging.log4j.core.config.plugins.PluginBuilder;
+import org.apache.logging.log4j.core.config.plugins.util.PluginBuilder;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.config.plugins.PluginManager;
-import org.apache.logging.log4j.core.config.plugins.PluginType;
+import org.apache.logging.log4j.core.config.plugins.util.PluginManager;
+import org.apache.logging.log4j.core.config.plugins.util.PluginType;
 import org.apache.logging.log4j.core.filter.AbstractFilterable;
 import org.apache.logging.log4j.core.helpers.Constants;
 import org.apache.logging.log4j.core.helpers.Loader;

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java Sat May  3 03:45:40 2014
@@ -32,10 +32,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.TreeSet;
 
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.config.plugins.PluginManager;
-import org.apache.logging.log4j.core.config.plugins.PluginType;
+import org.apache.logging.log4j.core.config.plugins.util.PluginManager;
+import org.apache.logging.log4j.core.config.plugins.util.PluginType;
 import org.apache.logging.log4j.core.helpers.FileUtils;
 import org.apache.logging.log4j.core.helpers.Loader;
 import org.apache.logging.log4j.core.lookup.Interpolator;
@@ -109,6 +111,8 @@ public abstract class ConfigurationFacto
 
     protected final StrSubstitutor substitutor = new StrSubstitutor(new Interpolator());
 
+    private static final Lock LOCK = new ReentrantLock();
+
     /**
      * Returns the ConfigurationFactory.
      * @return the ConfigurationFactory.
@@ -117,8 +121,8 @@ public abstract class ConfigurationFacto
         // volatile works in Java 1.6+, so double-checked locking also works properly
         //noinspection DoubleCheckedLocking
         if (factories == null) {
-            // TODO: synchronize on a real lock
-            synchronized(TEST_PREFIX) {
+            LOCK.lock();
+            try {
                 if (factories == null) {
                     final List<ConfigurationFactory> list = new ArrayList<ConfigurationFactory>();
                     final String factoryClass = PropertiesUtil.getProperties().getStringProperty(CONFIGURATION_FACTORY_PROPERTY);
@@ -147,6 +151,8 @@ public abstract class ConfigurationFacto
                     }
                     factories = Collections.unmodifiableList(list);
                 }
+            } finally {
+                LOCK.unlock();
             }
         }
 

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java Sat May  3 03:45:40 2014
@@ -41,6 +41,10 @@ public class DefaultConfiguration extend
      * The System Property used to specify the logging level.
      */
     public static final String DEFAULT_LEVEL = "org.apache.logging.log4j.level";
+    /**
+     * The default Pattern used for the default Layout.
+     */
+    public static final String DEFAULT_PATTERN = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n";
 
     /**
      * Constructor to create the default configuration.
@@ -49,7 +53,7 @@ public class DefaultConfiguration extend
 
         setName(DEFAULT_NAME);
         final Layout<? extends Serializable> layout =
-                PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n", null, null, null,
+                PatternLayout.createLayout(DEFAULT_PATTERN, null, null, null,
                     null, null, null, null);
         final Appender appender =
                 ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false", "true");

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java Sat May  3 03:45:40 2014
@@ -18,6 +18,9 @@ package org.apache.logging.log4j.core.co
 
 import java.io.File;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 
 /**
  * Configuration monitor that periodically checks the timestamp of the configuration file and calls the
@@ -41,7 +44,9 @@ public class FileConfigurationMonitor im
 
     private long nextCheck;
 
-    private volatile int counter = 0;
+    private final AtomicInteger counter = new AtomicInteger(0);
+
+    private static final Lock LOCK = new ReentrantLock();
 
     private final Reconfigurable reconfigurable;
 
@@ -68,18 +73,19 @@ public class FileConfigurationMonitor im
      */
     @Override
     public void checkConfiguration() {
-        if ((++counter & MASK) == 0) {
-            synchronized (this) {
-                final long current = System.currentTimeMillis();
-                if (current >= nextCheck) {
-                    nextCheck = current + interval;
-                    if (file.lastModified() > lastModified) {
-                        lastModified = file.lastModified();
-                        for (final ConfigurationListener listener : listeners) {
-                            listener.onChange(reconfigurable);
-                        }
+        final long current = System.currentTimeMillis();
+        if (((counter.incrementAndGet() & MASK) == 0) && (current >= nextCheck)) {
+            LOCK.lock();
+            try {
+                nextCheck = current + interval;
+                if (file.lastModified() > lastModified) {
+                    lastModified = file.lastModified();
+                    for (final ConfigurationListener listener : listeners) {
+                        listener.onChange(reconfigurable);
                     }
                 }
+            } finally {
+                LOCK.unlock();
             }
         }
     }

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java Sat May  3 03:45:40 2014
@@ -16,6 +16,21 @@
  */
 package org.apache.logging.log4j.core.config;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -42,17 +57,6 @@ import org.apache.logging.log4j.message.
 import org.apache.logging.log4j.status.StatusLogger;
 import org.apache.logging.log4j.util.PropertiesUtil;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
 /**
  * Logger object that is created via configuration.
  */
@@ -61,7 +65,6 @@ public class LoggerConfig extends Abstra
 
     protected static final Logger LOGGER = StatusLogger.getLogger();
     private static final int MAX_RETRIES = 3;
-    private static final long WAIT_TIME = 1000;
     private static LogEventFactory LOG_EVENT_FACTORY = null;
 
     private List<AppenderRef> appenderRefs = new ArrayList<AppenderRef>();
@@ -73,9 +76,11 @@ public class LoggerConfig extends Abstra
     private boolean includeLocation = true;
     private LoggerConfig parent;
     private final AtomicInteger counter = new AtomicInteger();
-    private boolean shutdown = false;
+    private final AtomicBoolean shutdown = new AtomicBoolean(false);
     private final Map<Property, Boolean> properties;
     private final Configuration config;
+    private final Lock shutdownLock = new ReentrantLock();
+    private final Condition noLogEvents = shutdownLock.newCondition(); // should only be used when shutdown == true
 
     static {
         final String factory = PropertiesUtil.getProperties().getStringProperty(Constants.LOG4J_LOG_EVENT_FACTORY);
@@ -86,7 +91,7 @@ public class LoggerConfig extends Abstra
                     LOG_EVENT_FACTORY = (LogEventFactory) clazz.newInstance();
                 }
             } catch (final Exception ex) {
-                LOGGER.error("Unable to create LogEventFactory " + factory, ex);
+                LOGGER.error("Unable to create LogEventFactory {}", factory, ex);
             }
         }
         if (LOG_EVENT_FACTORY == null) {
@@ -369,18 +374,20 @@ public class LoggerConfig extends Abstra
      * Waits for all log events to complete before shutting down this
      * loggerConfig.
      */
-    private synchronized void waitForCompletion() {
-        if (shutdown) {
-            return;
-        }
-        shutdown = true;
-        int retries = 0;
-        while (counter.get() > 0) {
-            try {
-                wait(WAIT_TIME * (retries + 1));
-            } catch (final InterruptedException ie) {
-                if (++retries > MAX_RETRIES) {
-                    break;
+    private void waitForCompletion() {
+        if (shutdown.compareAndSet(false, true)) {
+            int retries = 0;
+            // if this were Java 1.7, we could use a java.util.concurrent.Phaser instead
+            while (counter.get() > 0) {
+                shutdownLock.lock();
+                try {
+                    noLogEvents.await(retries + 1, TimeUnit.SECONDS);
+                } catch (final InterruptedException ie) {
+                    if (++retries > MAX_RETRIES) {
+                        break;
+                    }
+                } finally {
+                    shutdownLock.unlock();
                 }
             }
         }
@@ -408,12 +415,14 @@ public class LoggerConfig extends Abstra
             }
         } finally {
             if (counter.decrementAndGet() == 0) {
-                synchronized (this) {
-                    if (shutdown) {
-                        notifyAll();
+                shutdownLock.lock();
+                try {
+                    if (shutdown.get()) {
+                        noLogEvents.signalAll();
                     }
+                } finally {
+                    shutdownLock.unlock();
                 }
-
             }
         }
     }

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Node.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Node.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Node.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Node.java Sat May  3 03:45:40 2014
@@ -21,7 +21,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.logging.log4j.core.config.plugins.PluginType;
+import org.apache.logging.log4j.core.config.plugins.util.PluginType;
 
 /**
  * A Configuration node.

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java Sat May  3 03:45:40 2014
@@ -35,9 +35,9 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.FileConfigurationMonitor;
 import org.apache.logging.log4j.core.config.Node;
 import org.apache.logging.log4j.core.config.Reconfigurable;
-import org.apache.logging.log4j.core.config.plugins.PluginManager;
-import org.apache.logging.log4j.core.config.plugins.PluginType;
-import org.apache.logging.log4j.core.config.plugins.ResolverUtil;
+import org.apache.logging.log4j.core.config.plugins.util.PluginManager;
+import org.apache.logging.log4j.core.config.plugins.util.PluginType;
+import org.apache.logging.log4j.core.config.plugins.util.ResolverUtil;
 import org.apache.logging.log4j.core.config.status.StatusConfiguration;
 import org.apache.logging.log4j.core.helpers.Patterns;
 

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/Plugin.java Sat May  3 03:45:40 2014
@@ -2,7 +2,7 @@
  * 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 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
  *
@@ -11,8 +11,8 @@
  * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 package org.apache.logging.log4j.core.config.plugins;
 
@@ -23,7 +23,6 @@ import java.lang.annotation.Target;
 
 /**
  * Annotation that identifies a Class as a Plugin.
- * @see PluginType
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.TYPE)

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/SensitivePluginAttribute.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/SensitivePluginAttribute.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/SensitivePluginAttribute.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/SensitivePluginAttribute.java Sat May  3 03:45:40 2014
@@ -1,12 +1,12 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * 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
+ * the License. You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      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,
@@ -27,7 +27,7 @@ import java.lang.annotation.Target;
  * and instead should be hashed.
  *
  * @see org.apache.logging.log4j.core.helpers.NameUtil#md5(String) MD5
- * @see PluginAttribute
+ * @see org.apache.logging.log4j.core.config.plugins.PluginAttribute
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.PARAMETER)

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfiguration.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfiguration.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfiguration.java Sat May  3 03:45:40 2014
@@ -41,9 +41,9 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.FileConfigurationMonitor;
 import org.apache.logging.log4j.core.config.Node;
 import org.apache.logging.log4j.core.config.Reconfigurable;
-import org.apache.logging.log4j.core.config.plugins.PluginManager;
-import org.apache.logging.log4j.core.config.plugins.PluginType;
-import org.apache.logging.log4j.core.config.plugins.ResolverUtil;
+import org.apache.logging.log4j.core.config.plugins.util.PluginManager;
+import org.apache.logging.log4j.core.config.plugins.util.PluginType;
+import org.apache.logging.log4j.core.config.plugins.util.ResolverUtil;
 import org.apache.logging.log4j.core.config.status.StatusConfiguration;
 import org.apache.logging.log4j.core.helpers.Loader;
 import org.apache.logging.log4j.core.helpers.Patterns;

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfigurationFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfigurationFactory.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfigurationFactory.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfigurationFactory.java Sat May  3 03:45:40 2014
@@ -16,8 +16,6 @@
  */
 package org.apache.logging.log4j.core.config.yaml;
 
-import java.io.File;
-
 import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
 import org.apache.logging.log4j.core.config.Order;

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/CachedClock.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/CachedClock.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/CachedClock.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/CachedClock.java Sat May  3 03:45:40 2014
@@ -31,20 +31,20 @@ public final class CachedClock implement
     private static CachedClock instance = new CachedClock();
     private volatile long millis = System.currentTimeMillis();
     private volatile short count = 0;
-    private final Thread updater = new Thread("Clock Updater Thread") {
-        @Override
-        public void run() {
-            while (true) {
-                final long time = System.currentTimeMillis();
-                millis = time;
-
-                // avoid explicit dependency on sun.misc.Util
-                LockSupport.parkNanos(1000 * 1000);
-            }
-        }
-    };
 
     private CachedClock() {
+        final Thread updater = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                while (true) {
+                    final long time = System.currentTimeMillis();
+                    millis = time;
+
+                    // avoid explicit dependency on sun.misc.Util
+                    LockSupport.parkNanos(1000 * 1000);
+                }
+            }
+        }, "Clock Updater Thread");
         updater.setDaemon(true);
         updater.start();
     }

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/ClockFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/ClockFactory.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/ClockFactory.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/ClockFactory.java Sat May  3 03:45:40 2014
@@ -25,7 +25,7 @@ public final class ClockFactory {
 
     /**
      * Name of the system property that can be used to specify a {@code Clock}
-     * implementation class.
+     * implementation class. The value of this property is {@value}.
      */
     public static final String PROPERTY_NAME = "log4j.Clock";
     private static final StatusLogger LOGGER = StatusLogger.getLogger();
@@ -37,11 +37,11 @@ public final class ClockFactory {
 
     /**
      * Returns a {@code Clock} instance depending on the value of system
-     * property {@code "AsyncLogger.Clock"}.
+     * property {@link #PROPERTY_NAME}.
      * <p>
-     * If system property {@code AsyncLogger.Clock=CachedClock} is specified,
+     * If system property {@code log4j.Clock=CachedClock} is specified,
      * this method returns an instance of {@link CachedClock}. If system
-     * property {@code AsyncLogger.Clock=CoarseCachedClock} is specified, this
+     * property {@code log4j.Clock=CoarseCachedClock} is specified, this
      * method returns an instance of {@link CoarseCachedClock}.
      * <p>
      * If another value is specified, this value is taken as the fully qualified

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Loader.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Loader.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Loader.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Loader.java Sat May  3 03:45:40 2014
@@ -16,12 +16,11 @@
  */
 package org.apache.logging.log4j.core.helpers;
 
+
 import java.io.InputStream;
-import java.lang.ClassCastException;
 import java.lang.reflect.InvocationTargetException;
 import java.net.URL;
 
-import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.apache.logging.log4j.util.PropertiesUtil;
@@ -232,12 +231,14 @@ public final class Loader {
     }
 
     /**
-     * Load a Class by name.
+     * Load a Class by name. Note that unlike {@link ClassLoader#loadClass(String) ClassLoader.loadClass}, this method
+     * will initialize the class as well if it hasn't been already. This is equivalent to the calling the
+     * {@link ClassLoader#loadClass(String, boolean) protected version} with the second parameter equal to {@code true}.
+     *
      * @param className The class name.
      * @return The Class.
      * @throws ClassNotFoundException if the Class could not be found.
      */
-    // FIXME: should we do lazy class loading or eager class loading by default?
     public static Class<?> loadClass(final String className) throws ClassNotFoundException {
         // Just call Class.forName(className) if we are instructed to ignore the TCL.
         if (ignoreTCL) {
@@ -249,8 +250,7 @@ public final class Loader {
             // using the TCCL should work the same as the default ClassLoader (i.e., init or not)
             return Class.forName(className, true, getTCL());
         } catch (final Throwable e) {
-            LOGGER.catching(Level.DEBUG, e);
-            LOGGER.trace("TCCL didn't work. Trying Class.forName({}).", className);
+            LOGGER.trace("TCCL didn't work. Trying Class.forName({}).", className, e);
             return loadClassWithDefaultClassLoader(className);
         }
     }
@@ -284,8 +284,7 @@ public final class Loader {
         try {
             return Class.forName(className, true, ClassLoader.getSystemClassLoader());
         } catch (final Throwable t) {
-            LOGGER.catching(Level.DEBUG, t);
-            LOGGER.trace("Couldn't use SystemClassLoader. Trying Class.forName({}).", className);
+            LOGGER.trace("Couldn't use SystemClassLoader. Trying Class.forName({}).", className, t);
             return Class.forName(className);
         }
     }
@@ -311,6 +310,7 @@ public final class Loader {
         try {
             return clazz.getConstructor().newInstance();
         } catch (final NoSuchMethodException e) {
+            // try the default-default constructor
             //noinspection ClassNewInstance
             return clazz.newInstance();
         }
@@ -349,7 +349,10 @@ public final class Loader {
         try {
             final Class<?> clazz = loadClass(className);
             return clazz != null;
-        } catch (final Throwable ignored) {
+        } catch (final ClassNotFoundException e) {
+            return false;
+        } catch (final Throwable e) {
+            LOGGER.trace("Unknown error checking for existence of class [{}].", className, e);
             return false;
         }
     }

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Throwables.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Throwables.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Throwables.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/Throwables.java Sat May  3 03:45:40 2014
@@ -28,11 +28,14 @@ import java.util.List;
 /**
  * Helps with Throwable objects.
  */
-public class Throwables {
+public final class Throwables {
+
+    private Throwables() {
+    }
 
     /**
-     * Converts a Throwable into a List of Strings
-     * 
+     * Converts a Throwable stack trace into a List of Strings
+     *
      * @param throwable
      *            the Throwable
      * @return a List of Strings
@@ -46,8 +49,8 @@ public class Throwables {
             // Ignore any exceptions.
         }
         pw.flush();
+        final List<String> lines = new ArrayList<String>();
         final LineNumberReader reader = new LineNumberReader(new StringReader(sw.toString()));
-        final ArrayList<String> lines = new ArrayList<String>();
         try {
             String line = reader.readLine();
             while (line != null) {
@@ -59,6 +62,8 @@ public class Throwables {
                 Thread.currentThread().interrupt();
             }
             lines.add(ex.toString());
+        } finally {
+            Closer.closeSilent(reader);
         }
         return lines;
     }

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ReflectiveCallerClassUtility.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ReflectiveCallerClassUtility.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ReflectiveCallerClassUtility.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ReflectiveCallerClassUtility.java Sat May  3 03:45:40 2014
@@ -26,33 +26,37 @@ import org.apache.logging.log4j.status.S
 
 /**
  * Utility class that handles the instability of the Sun/OpenJDK {@code sun.reflect.Reflection.getCallerClass(int)}
- * method.<br>
- * <br>
+ * method.
+ * <p>
  * <strong>Background:</strong> This method, available only in the Oracle/Sun/OpenJDK implementations of the Java
  * Virtual Machine, is a much more efficient mechanism for determining the {@link Class} of the caller of a particular
  * method. When it is not available, a {@link SecurityManager} is the second-best option. When this is also not
  * possible, the {@code StackTraceElement[]} returned by {@link Thread#getStackTrace()} must be used, and its
- * {@code String} class name converted to a {@code Class} using the slow {@link Class#forName}.<br>
- * <br>
+ * {@code String} class name converted to a {@code Class} using the slow {@link Class#forName}.
+ * </p>
+ * <p>
  * As of Java 8, the {@code getCallerClass(int)} method has been removed from Oracle/OpenJDK and is no longer usable. A
  * back-port of the feature that resulted in this change was made in Java 7u25, but the {@code getCallerClass(int)} was
  * left around for that version and deprecated, with the intention of being removed in 7u40. By coincidence, the change
  * actually broke {@code getCallerClass(int)} (the return value was inadvertently offset by 1 stack frame). This was
  * actually a good thing, because it made the hundreds of libraries and frameworks relying on this method aware of what
- * the JDK developers were up to.<br>
- * <br>
+ * the JDK developers were up to.
+ * </p>
+ * <p>
  * After much community backlash, the JDK team agreed to restore {@code getCallerClass(int)} and keep its existing
- * behavior for the rest of Java 7. However, the method will still not be available in Java 8, and so backup options
- * must be used. This class:<br>
+ * behavior for the rest of Java 7. However, the method is deprecated in Java 8, supposedly won't be in Java 9 (unless
+ * no public API is exposed which may force them to keep it), and so backup options must be used. This class:
+ * </p>
  * <ul>
  *     <li>Uses {@code getCallerClass(int)} the traditional way when possible.</li>
  *     <li>Uses {@code getCallerClass(int)} with an adjusted offset in Oracle/OpenJDK 7u25.</li>
  *     <li>Returns null otherwise. (Currently, it is the caller's responsibility to use the backup mechanisms.)</li>
  * </ul>
- * <br>
+ * <p>
  * <strong>IMPORTANT NOTE:</strong> This class should not be relied upon. It is considered an internal class and could
  * change at any time, breaking your code if you use it. Specifically, as a possible public API replacement for
- * {@code getCallerClass(int)} develops in Java 8, this class is very likely to change or even go away.
+ * {@code getCallerClass(int)} develops in Java 9, this class is very likely to change or even go away.
+ * </p>
  */
 public final class ReflectiveCallerClassUtility {
 

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java Sat May  3 03:45:40 2014
@@ -46,7 +46,7 @@ public class ThrowableProxy implements S
 
     private final ThrowableProxy proxyCause;
 
-    private final Throwable throwable;
+    private final transient Throwable throwable;
 
     private final String name;
 

Modified: logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java?rev=1592142&r1=1592141&r2=1592142&view=diff
==============================================================================
--- logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java (original)
+++ logging/log4j/log4j2/branches/experimental/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java Sat May  3 03:45:40 2014
@@ -21,8 +21,8 @@ import java.util.Map;
 
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.config.plugins.PluginManager;
-import org.apache.logging.log4j.core.config.plugins.PluginType;
+import org.apache.logging.log4j.core.config.plugins.util.PluginManager;
+import org.apache.logging.log4j.core.config.plugins.util.PluginType;
 import org.apache.logging.log4j.core.helpers.Loader;
 import org.apache.logging.log4j.status.StatusLogger;
 



Mime
View raw message