logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sicker <boa...@gmail.com>
Subject Re: svn commit: r1580734 - in /logging/log4j/log4j2/trunk: log4j-1.2-api/src/test/java/org/apache/log4j/ log4j-api/src/main/java/org/apache/logging/log4j/status/ log4j-core/src/main/java/org/apache/logging/log4j/core/config/ log4j-core/src/main/java/org/ap...
Date Mon, 24 Mar 2014 19:29:48 GMT
Sorry, I'm used to a git workflow and using Stash (or GitHub) to review
pull requests which makes it a bit easier to review. Unless there's a way
to use git.apache.org combined with git-svn, then that would work a lot
better for me.

Anyway, I'll make sure to submit it as a patch for this config thing. I
still need to spend some time thinking up exactly how I might want to
approach that; then I'll make a post here describing my idea so we can
discuss.

I agree on the commits part. I'm just bad at using svn :/

And on the imports thing, I set mine up to use java, then javax, then
everything else because that seemed to be the Eclipse default. I'll make
sure to disable that, though. Thanks for pointing it out; it annoys me, too.

The subdirectories thing was basically the sort of idea I had for
generating OSGi bundles. When classes with optional dependencies are in
their own packages, it makes it that much easier to split off the generated
bundles. I'll remember to make a post here about reorganization in the
future, though!


On 24 March 2014 10:49, Ralph Goers <ralph.goers@dslextreme.com> wrote:

> I have a couple of comments.
>
> 1. Is your IDE reordering imports? If so can you disable that?  It is
> annoying when every developer checks stuff out and the imports move around
> even though just a line or two was actually changed.
> 2. I dislike surprises.  I don’t recall discussing moving the
> configuration classes into their own subdirectories or the refactoring you
> did.  Not that I am against any of it. It is just nice to have a bit of
> advance warning.
>
> Although we use CTR here (commit-then-review) any significant changes
> should be discussed.  For the most part you have been pretty good at that.
> But the configuration, startup and shutdown stuff is pretty sensitive stuff
> so if you are planning on making changes for LOG4J2-577 please let us know
> what you are doing - either through discussion or a patch to the Jira if
> needed.
>
> If it was me, I would have done the renaming of BaseConfiguration to
> AbstractConfiguration in one commit, breakout of the StatusConfiguration in
> another commit, etc.
>
> Remember, we do review code changes and when you have so many different
> changes it makes it hard to do that.
>
>
>
> Ralph
>
>
> On Mar 23, 2014, at 9:17 PM, mattsicker@apache.org wrote:
>
> > Author: mattsicker
> > Date: Mon Mar 24 04:17:35 2014
> > New Revision: 1580734
> >
> > URL: http://svn.apache.org/r1580734
> > Log:
> > Config Refactor.
> >
> >  - Modified StatusLogger.getListeners() to return an Iterable
> >    instead of an Iterator for convenience.
> >  - Renamed BasicConfiguration to AbstractConfiguration.
> >  - Pulled up the toByteArray method from XML/JSONConfiguration.
> >  - Moved the three XML/YAML/JSONConfigurations to their own packages.
> >  - Created a StatusConfiguration builder for setting up StatusLogger
> >    and reducing redundant code.
> >  - Simplified constructors for configuration classes (still needs
> >    work; there's a lot of commonality between the two main ones still).
> >  - Migrated some status logging to use parameters.
> >  - Fixed some potential bugs in a couple places:
> >    * Saw a configuration element name being interpolated.
> >    * Modified the status dest attribute to be interpolated.
> >    * Prevented an NPE if the given file URI for the status logger
> >      doesn't exist.
> >
> > Added:
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
> >      - copied, changed from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java
> >      - copied, changed from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfigurationFactory.java
> >      - copied, changed from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/JSONConfigurationFactory.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/status/
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/status/StatusConfiguration.java
>   (with props)
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfiguration.java
> >      - copied, changed from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfiguration.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfigurationFactory.java
> >      - copied, changed from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfigurationFactory.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfiguration.java
> >      - copied, changed from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/YAMLConfiguration.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfigurationFactory.java
> >      - copied, changed from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/YAMLConfigurationFactory.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/AbstractConfigurationTest.java
> >      - copied, changed from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/XMLConfigurationPropsTest.java
> >      - copied, changed from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationPropsTest.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/XMLLoggerPropsTest.java
> >      - copied, changed from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XMLLoggerPropsTest.java
> > Removed:
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/JSONConfigurationFactory.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfiguration.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfigurationFactory.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/YAMLConfiguration.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/YAMLConfigurationFactory.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationPropsTest.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XMLLoggerPropsTest.java
> > Modified:
> >
>  logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/BasicConfigurationFactory.java
> >
>  logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/NullConfiguration.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SocketServer.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/BasicConfigurationFactory.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/LateConfigTest.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
> >
>  logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/FileOutputTest.java
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/BasicConfigurationFactory.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/BasicConfigurationFactory.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/BasicConfigurationFactory.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-1.2-api/src/test/java/org/apache/log4j/BasicConfigurationFactory.java
> Mon Mar 24 04:17:35 2014
> > @@ -16,14 +16,14 @@
> >  */
> > package org.apache.log4j;
> >
> > +import java.net.URI;
> > +
> > import org.apache.logging.log4j.Level;
> > -import org.apache.logging.log4j.core.config.BaseConfiguration;
> > +import org.apache.logging.log4j.core.config.AbstractConfiguration;
> > import org.apache.logging.log4j.core.config.Configuration;
> > import org.apache.logging.log4j.core.config.ConfigurationFactory;
> > import org.apache.logging.log4j.core.config.LoggerConfig;
> >
> > -import java.net.URI;
> > -
> > /**
> >  *
> >  */
> > @@ -44,7 +44,7 @@ public class BasicConfigurationFactory e
> >         return new BasicConfiguration();
> >     }
> >
> > -    public class BasicConfiguration extends BaseConfiguration {
> > +    public class BasicConfiguration extends AbstractConfiguration {
> >
> >         private static final String DEFAULT_LEVEL =
> "org.apache.logging.log4j.level";
> >
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
> Mon Mar 24 04:17:35 2014
> > @@ -17,11 +17,13 @@
> > package org.apache.logging.log4j.status;
> >
> > import java.util.ArrayList;
> > -import java.util.Iterator;
> > +import java.util.Collection;
> > import java.util.List;
> > import java.util.Queue;
> > import java.util.concurrent.ConcurrentLinkedQueue;
> > import java.util.concurrent.CopyOnWriteArrayList;
> > +import java.util.concurrent.locks.Lock;
> > +import java.util.concurrent.locks.ReadWriteLock;
> > import java.util.concurrent.locks.ReentrantLock;
> > import java.util.concurrent.locks.ReentrantReadWriteLock;
> >
> > @@ -37,7 +39,7 @@ import org.apache.logging.log4j.util.Pro
> >  */
> > public final class StatusLogger extends AbstractLogger {
> >
> > -    private static final long serialVersionUID = 1L;
> > +    private static final long serialVersionUID = 2L;
> >
> >     /**
> >      * System property that can be configured with the number of entries
> in the queue. Once the limit
> > @@ -57,11 +59,11 @@ public final class StatusLogger extends
> >
> >     private final SimpleLogger logger;
> >
> > -    private final CopyOnWriteArrayList<StatusListener> listeners = new
> CopyOnWriteArrayList<StatusListener>();
> > -    private final ReentrantReadWriteLock listenersLock = new
> ReentrantReadWriteLock();
> > +    private final Collection<StatusListener> listeners = new
> CopyOnWriteArrayList<StatusListener>();
> > +    private final ReadWriteLock listenersLock = new
> ReentrantReadWriteLock();
> >
> >     private final Queue<StatusData> messages = new
> BoundedQueue<StatusData>(MAX_ENTRIES);
> > -    private final ReentrantLock msgLock = new ReentrantLock();
> > +    private final Lock msgLock = new ReentrantLock();
> >
> >     private int listenersLevel;
> >
> > @@ -126,11 +128,11 @@ public final class StatusLogger extends
> >     }
> >
> >     /**
> > -     * Returns a thread safe Iterator for the StatusListener.
> > -     * @return An Iterator for the list of StatusListeners.
> > +     * Returns a thread safe Iterable for the StatusListener.
> > +     * @return An Iterable for the list of StatusListeners.
> >      */
> > -    public Iterator<StatusListener> getListeners() {
> > -        return listeners.iterator();
> > +    public Iterable<StatusListener> getListeners() {
> > +        return listeners;
> >     }
> >
> >     /**
> >
> > Copied:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
> (from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java)
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java&r1=1580711&r2=1580734&rev=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
> Mon Mar 24 04:17:35 2014
> > @@ -16,6 +16,9 @@
> >  */
> > package org.apache.logging.log4j.core.config;
> >
> > +import java.io.ByteArrayOutputStream;
> > +import java.io.IOException;
> > +import java.io.InputStream;
> > import java.io.Serializable;
> > import java.lang.annotation.Annotation;
> > import java.lang.reflect.Array;
> > @@ -67,14 +70,15 @@ import org.apache.logging.log4j.status.S
> > import org.apache.logging.log4j.util.PropertiesUtil;
> >
> > /**
> > - * The Base Configuration. Many configuration implementations will
> extend this class.
> > + * The base Configuration. Many configuration implementations will
> extend this class.
> >  */
> > -public abstract class BaseConfiguration extends AbstractFilterable
> implements Configuration {
> > +public abstract class AbstractConfiguration extends AbstractFilterable
> implements Configuration {
> >
> >     /**
> >      * Allow subclasses access to the status logger without creating
> another instance.
> >      */
> >     protected static final Logger LOGGER = StatusLogger.getLogger();
> > +    private static final int BUF_SIZE = 16384;
> >
> >     /**
> >      * The root node of the configuration.
> > @@ -84,8 +88,7 @@ public abstract class BaseConfiguration
> >     /**
> >      * Listeners for configuration changes.
> >      */
> > -    protected final List<ConfigurationListener> listeners =
> > -        new CopyOnWriteArrayList<ConfigurationListener>();
> > +    protected final List<ConfigurationListener> listeners = new
> CopyOnWriteArrayList<ConfigurationListener>();
> >
> >     /**
> >      * The ConfigurationMonitor that checks for configuration changes.
> > @@ -131,14 +134,13 @@ public abstract class BaseConfiguration
> >     /**
> >      * Constructor.
> >      */
> > -    protected BaseConfiguration() {
> > +    protected AbstractConfiguration() {
> >         componentMap.put(Configuration.CONTEXT_PROPERTIES, properties);
> >         pluginManager = new PluginManager("Core");
> >         rootNode = new Node();
> >     }
> >
> >     @Override
> > -    @SuppressWarnings("unchecked")
> >     public Map<String, String> getProperties() {
> >         return properties;
> >     }
> > @@ -966,4 +968,17 @@ public abstract class BaseConfiguration
> >             }
> >         }
> >     }
> > +
> > +    protected byte[] toByteArray(final InputStream is) throws
> IOException {
> > +        final ByteArrayOutputStream buffer = new
> ByteArrayOutputStream();
> > +
> > +        int nRead;
> > +        final byte[] data = new byte[BUF_SIZE];
> > +
> > +        while ((nRead = is.read(data, 0, data.length)) != -1) {
> > +            buffer.write(data, 0, nRead);
> > +        }
> > +
> > +        return buffer.toByteArray();
> > +    }
> > }
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
> Mon Mar 24 04:17:35 2014
> > @@ -56,7 +56,7 @@ import org.apache.logging.log4j.util.Pro
> >  * A ConfigurationFactory implementation can be added to the classpath
> and
> >  * configured as a plugin. The Order annotation should be used to
> configure the
> >  * factory to be the first one inspected. See
> > - * {@linkplain XMLConfigurationFactory} for an example.</li>
> > + * {@linkplain
> org.apache.logging.log4j.core.config.xml.XMLConfigurationFactory} for an
> example.</li>
> >  * </ol>
> >  *
> >  * If the ConfigurationFactory that was added returns null on a call to
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
> Mon Mar 24 04:17:35 2014
> > @@ -31,7 +31,7 @@ import org.apache.logging.log4j.util.Pro
> >  * specify the property, Log4j uses the ERROR Level. Log Events will be
> printed using the basic formatting provided
> >  * by each Message.
> >  */
> > -public class DefaultConfiguration extends BaseConfiguration {
> > +public class DefaultConfiguration extends AbstractConfiguration {
> >
> >     /**
> >      * The name of the default configuration.
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/NullConfiguration.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/NullConfiguration.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/NullConfiguration.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/NullConfiguration.java
> Mon Mar 24 04:17:35 2014
> > @@ -21,7 +21,7 @@ import org.apache.logging.log4j.Level;
> > /**
> >  * This configuration defaults to no logging.
> >  */
> > -public class NullConfiguration extends BaseConfiguration {
> > +public class NullConfiguration extends AbstractConfiguration {
> >
> >     public static final String NULL_NAME = "Null";
> >
> > @@ -31,4 +31,5 @@ public class NullConfiguration extends B
> >         final LoggerConfig root = getRootLogger();
> >         root.setLevel(Level.OFF);
> >     }
> > +
> > }
> >
> > Copied:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java
> (from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java)
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java&r1=1580711&r2=1580734&rev=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java
> Mon Mar 24 04:17:35 2014
> > @@ -14,46 +14,39 @@
> >  * See the license for the specific language governing permissions and
> >  * limitations under the license.
> >  */
> > -package org.apache.logging.log4j.core.config;
> > +package org.apache.logging.log4j.core.config.json;
> >
> > import java.io.ByteArrayInputStream;
> > -import java.io.ByteArrayOutputStream;
> > import java.io.File;
> > import java.io.FileInputStream;
> > import java.io.FileNotFoundException;
> > -import java.io.FileOutputStream;
> > -import java.io.IOException;
> > import java.io.InputStream;
> > -import java.io.PrintStream;
> > -import java.net.URISyntaxException;
> > -import java.nio.charset.Charset;
> > import java.util.ArrayList;
> > import java.util.Iterator;
> > import java.util.List;
> > import java.util.Map;
> >
> > -import org.apache.logging.log4j.Level;
> > +import com.fasterxml.jackson.core.JsonParser;
> > +import com.fasterxml.jackson.databind.JsonNode;
> > +import com.fasterxml.jackson.databind.ObjectMapper;
> > +import org.apache.logging.log4j.core.config.AbstractConfiguration;
> > +import org.apache.logging.log4j.core.config.Configuration;
> > +import org.apache.logging.log4j.core.config.ConfigurationFactory;
> > +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.helpers.FileUtils;
> > +import org.apache.logging.log4j.core.config.status.StatusConfiguration;
> > import org.apache.logging.log4j.core.helpers.Patterns;
> > -import org.apache.logging.log4j.status.StatusConsoleListener;
> > -import org.apache.logging.log4j.status.StatusListener;
> > -import org.apache.logging.log4j.status.StatusLogger;
> > -
> > -import com.fasterxml.jackson.core.JsonParser;
> > -import com.fasterxml.jackson.databind.JsonNode;
> > -import com.fasterxml.jackson.databind.ObjectMapper;
> >
> > /**
> >  * Creates a Node hierarchy from a JSON file.
> >  */
> > -public class JSONConfiguration extends BaseConfiguration implements
> Reconfigurable {
> > -
> > -    private static final String[] VERBOSE_CLASSES = new String[]
> {ResolverUtil.class.getName()};
> > +public class JSONConfiguration extends AbstractConfiguration implements
> Reconfigurable {
> >
> > -    private static final int BUF_SIZE = 16384;
> > +    private static final String[] VERBOSE_CLASSES = new
> String[]{ResolverUtil.class.getName()};
> >
> >     private final List<Status> status = new ArrayList<Status>();
> >
> > @@ -62,99 +55,55 @@ public class JSONConfiguration extends B
> >     private final File configFile;
> >
> >     public JSONConfiguration(final
> ConfigurationFactory.ConfigurationSource configSource) {
> > -        final List<String> messages = new ArrayList<String>();
> > -
> >         this.configFile = configSource.getFile();
> > -        byte[] buffer;
> > -
> >         try {
> >             final InputStream configStream =
> configSource.getInputStream();
> > -            buffer = toByteArray(configStream);
> > +            byte[] buffer = toByteArray(configStream);
> >             configStream.close();
> >             final InputStream is = new ByteArrayInputStream(buffer);
> > -            final ObjectMapper mapper = getObjectMapper();
> > -            root = mapper.readTree(is);
> > +            root = getObjectMapper().readTree(is);
> >             if (root.size() == 1) {
> > -                final Iterator<JsonNode> i = root.elements();
> > -                root = i.next();
> > +                for (final JsonNode node : root) {
> > +                    root = node;
> > +                }
> >             }
> >             processAttributes(rootNode, root);
> > -            Level status = getDefaultStatus();
> > -            boolean verbose = false;
> > -            PrintStream stream = System.out;
> > +            final StatusConfiguration statusConfig = new
> StatusConfiguration()
> > +                    .withVerboseClasses(VERBOSE_CLASSES)
> > +                    .withStatus(getDefaultStatus());
> >             for (final Map.Entry<String, String> entry :
> rootNode.getAttributes().entrySet()) {
> > -                if ("status".equalsIgnoreCase(entry.getKey())) {
> > -                    status =
> Level.toLevel(getStrSubstitutor().replace(entry.getValue()), null);
> > -                    if (status == null) {
> > -                        status = Level.ERROR;
> > -                        messages.add("Invalid status specified: " +
> entry.getValue() + ". Defaulting to ERROR");
> > -                    }
> > -                } else if ("dest".equalsIgnoreCase(entry.getKey())) {
> > -                    final String dest = entry.getValue();
> > -                    if (dest != null) {
> > -                        if (dest.equalsIgnoreCase("err")) {
> > -                            stream = System.err;
> > -                        } else {
> > -                            try {
> > -                                final File destFile =
> FileUtils.fileFromURI(FileUtils.getCorrectedFilePathUri(dest));
> > -                                final String enc =
> Charset.defaultCharset().name();
> > -                                stream = new PrintStream(new
> FileOutputStream(destFile), true, enc);
> > -                            } catch (final URISyntaxException use) {
> > -                                System.err.println("Unable to write to
> " + dest + ". Writing to stdout");
> > -                            }
> > -                        }
> > -                    }
> > -                } else if
> ("shutdownHook".equalsIgnoreCase(entry.getKey())) {
> > -                    String hook =
> getStrSubstitutor().replace(entry.getValue());
> > -                    isShutdownHookEnabled =
> !hook.equalsIgnoreCase("disable");
> > +                final String key = entry.getKey();
> > +                final String value =
> getStrSubstitutor().replace(entry.getValue());
> > +                if ("status".equalsIgnoreCase(key)) {
> > +                    statusConfig.withStatus(value);
> > +                } else if ("dest".equalsIgnoreCase(key)) {
> > +                    statusConfig.withDestination(value);
> > +                } else if ("shutdownHook".equalsIgnoreCase(key)) {
> > +                    isShutdownHookEnabled =
> !"disable".equalsIgnoreCase(value);
> >                 } else if ("verbose".equalsIgnoreCase(entry.getKey())) {
> > -                    verbose =
> Boolean.parseBoolean(getStrSubstitutor().replace(entry.getValue()));
> > -                } else if ("packages".equalsIgnoreCase(entry.getKey()))
> {
> > -                    final String[] packages =
> getStrSubstitutor().replace(entry.getValue()).split(Patterns.COMMA_SEPARATOR);
> > +                    statusConfig.withVerbosity(value);
> > +                } else if ("packages".equalsIgnoreCase(key)) {
> > +                    final String[] packages =
> value.split(Patterns.COMMA_SEPARATOR);
> >                     for (final String p : packages) {
> >                         PluginManager.addPackage(p);
> >                     }
> > -                } else if ("name".equalsIgnoreCase(entry.getKey())) {
> > -
>  setName(getStrSubstitutor().replace(entry.getValue()));
> > -                } else if
> ("monitorInterval".equalsIgnoreCase(entry.getKey())) {
> > -                    final int interval =
> Integer.parseInt(getStrSubstitutor().replace(entry.getValue()));
> > +                } else if ("name".equalsIgnoreCase(key)) {
> > +                    setName(value);
> > +                } else if ("monitorInterval".equalsIgnoreCase(key)) {
> > +                    final int interval = Integer.parseInt(value);
> >                     if (interval > 0 && configFile != null) {
> >                         monitor = new FileConfigurationMonitor(this,
> configFile, listeners, interval);
> >                     }
> > -                } else if
> ("advertiser".equalsIgnoreCase(entry.getKey())) {
> > -
>  createAdvertiser(getStrSubstitutor().replace(entry.getValue()),
> configSource, buffer,
> > -                        "application/json");
> > -                }
> > -            }
> > -
> > -            final Iterator<StatusListener> statusIter = ((StatusLogger)
> LOGGER).getListeners();
> > -            boolean found = false;
> > -            while (statusIter.hasNext()) {
> > -                final StatusListener listener = statusIter.next();
> > -                if (listener instanceof StatusConsoleListener) {
> > -                    found = true;
> > -                    ((StatusConsoleListener) listener).setLevel(status);
> > -                    if (!verbose) {
> > -                        ((StatusConsoleListener)
> listener).setFilters(VERBOSE_CLASSES);
> > -                    }
> > -                }
> > -            }
> > -            if (!found && status != Level.OFF) {
> > -                final StatusConsoleListener listener = new
> StatusConsoleListener(status, stream);
> > -                if (!verbose) {
> > -                    listener.setFilters(VERBOSE_CLASSES);
> > -                }
> > -                ((StatusLogger) LOGGER).registerListener(listener);
> > -                for (final String msg : messages) {
> > -                    LOGGER.error(msg);
> > +                } else if ("advertiser".equalsIgnoreCase(key)) {
> > +                    createAdvertiser(value, configSource, buffer,
> "application/json");
> >                 }
> >             }
> > +            statusConfig.initialize();
> >             if (getName() == null) {
> >                 setName(configSource.getLocation());
> >             }
> >         } catch (final Exception ex) {
> > -            LOGGER.error("Error parsing " + configSource.getLocation(),
> ex);
> > -            ex.printStackTrace();
> > +            LOGGER.error("Error parsing {}",
> configSource.getLocation(), ex);
> >         }
> >     }
> >
> > @@ -175,7 +124,7 @@ public class JSONConfiguration extends B
> >             final Map.Entry<String, JsonNode> entry = iter.next();
> >             final JsonNode n = entry.getValue();
> >             if (n.isObject()) {
> > -                LOGGER.debug("Processing node for object " +
> entry.getKey());
> > +                LOGGER.debug("Processing node for object {}",
> entry.getKey());
> >                 children.add(constructNode(entry.getKey(), rootNode, n));
> >             } else if (n.isArray()) {
> >                 LOGGER.error("Arrays are not supported at the root
> configuration.");
> > @@ -197,7 +146,7 @@ public class JSONConfiguration extends B
> >                     new ConfigurationFactory.ConfigurationSource(new
> FileInputStream(configFile), configFile);
> >                 return new JSONConfiguration(source);
> >             } catch (final FileNotFoundException ex) {
> > -                LOGGER.error("Cannot locate file " + configFile, ex);
> > +                LOGGER.error("Cannot locate file {}", configFile, ex);
> >             }
> >         }
> >         return null;
> > @@ -217,28 +166,28 @@ public class JSONConfiguration extends B
> >                     status.add(new Status(name, n,
> ErrorType.CLASS_NOT_FOUND));
> >                 }
> >                 if (n.isArray()) {
> > -                    LOGGER.debug("Processing node for array " +
> entry.getKey());
> > +                    LOGGER.debug("Processing node for array {}",
> entry.getKey());
> >                     for (int i = 0; i < n.size(); ++i) {
> >                         final String pluginType = getType(n.get(i),
> entry.getKey());
> >                         final PluginType<?> entryType =
> pluginManager.getPluginType(pluginType);
> >                         final Node item = new Node(node, entry.getKey(),
> entryType);
> >                         processAttributes(item, n.get(i));
> >                         if (pluginType.equals(entry.getKey())) {
> > -                            LOGGER.debug("Processing " + entry.getKey()
> + "[" + i + "]");
> > +                            LOGGER.debug("Processing {}[{}]",
> entry.getKey(), i);
> >                         } else {
> > -                            LOGGER.debug("Processing " + pluginType + "
> " + entry.getKey() + "[" + i + "]");
> > +                            LOGGER.debug("Processing {} {}[{}]",
> pluginType, entry.getKey(), i);
> >                         }
> >                         final Iterator<Map.Entry<String, JsonNode>>
> itemIter = n.get(i).fields();
> >                         final List<Node> itemChildren =
> item.getChildren();
> >                         while (itemIter.hasNext()) {
> >                             final Map.Entry<String, JsonNode> itemEntry
> = itemIter.next();
> >                             if (itemEntry.getValue().isObject()) {
> > -                                LOGGER.debug("Processing node for
> object " + itemEntry.getKey());
> > +                                LOGGER.debug("Processing node for
> object {}", itemEntry.getKey());
> >
> itemChildren.add(constructNode(itemEntry.getKey(), item,
> itemEntry.getValue()));
> >                             } else if (itemEntry.getValue().isArray()) {
> >                                 JsonNode array = itemEntry.getValue();
> >                                 String entryName = itemEntry.getKey();
> > -                                LOGGER.debug("Processing array for
> object " + entryName);
> > +                                LOGGER.debug("Processing array for
> object {}", entryName);
> >                                 for (int j = 0; j < array.size(); ++j) {
> >
> itemChildren.add(constructNode(entryName, item, array.get(j)));
> >                                 }
> > @@ -248,7 +197,7 @@ public class JSONConfiguration extends B
> >                         children.add(item);
> >                     }
> >                 } else {
> > -                    LOGGER.debug("Processing node for object " +
> entry.getKey());
> > +                    LOGGER.debug("Processing node for object {}",
> entry.getKey());
> >                     children.add(constructNode(entry.getKey(), node, n));
> >                 }
> >             } else {
> > @@ -260,12 +209,12 @@ public class JSONConfiguration extends B
> >         if (type == null) {
> >             t = "null";
> >         } else {
> > -            t = type.getElementName() + ":" + type.getPluginClass();
> > +            t = type.getElementName() + ':' + type.getPluginClass();
> >         }
> >
> >         final String p = node.getParent() == null ? "null" :
> node.getParent().getName() == null ?
> > -            "root" : node.getParent().getName();
> > -        LOGGER.debug("Returning " + node.getName() + " with parent " +
> p + " of type " +  t);
> > +                "root" : node.getParent().getName();
> > +        LOGGER.debug("Returning {} with parent {} of type {}",
> node.getName(), p, t);
> >         return node;
> >     }
> >
> > @@ -297,19 +246,6 @@ public class JSONConfiguration extends B
> >         }
> >     }
> >
> > -    protected byte[] toByteArray(final InputStream is) throws
> IOException {
> > -        final ByteArrayOutputStream buffer = new
> ByteArrayOutputStream();
> > -
> > -        int nRead;
> > -        final byte[] data = new byte[BUF_SIZE];
> > -
> > -        while ((nRead = is.read(data, 0, data.length)) != -1) {
> > -            buffer.write(data, 0, nRead);
> > -        }
> > -
> > -        return buffer.toByteArray();
> > -    }
> > -
> >     /**
> >      * The error that occurred.
> >      */
> > @@ -320,7 +256,7 @@ public class JSONConfiguration extends B
> >     /**
> >      * Status for recording errors.
> >      */
> > -    private class Status {
> > +    private static class Status {
> >         private final JsonNode node;
> >         private final String name;
> >         private final ErrorType errorType;
> >
> > Copied:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfigurationFactory.java
> (from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/JSONConfigurationFactory.java)
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfigurationFactory.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfigurationFactory.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/JSONConfigurationFactory.java&r1=1580711&r2=1580734&rev=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/JSONConfigurationFactory.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfigurationFactory.java
> Mon Mar 24 04:17:35 2014
> > @@ -14,8 +14,11 @@
> >  * See the license for the specific language governing permissions and
> >  * limitations under the license.
> >  */
> > -package org.apache.logging.log4j.core.config;
> > +package org.apache.logging.log4j.core.config.json;
> >
> > +import org.apache.logging.log4j.core.config.Configuration;
> > +import org.apache.logging.log4j.core.config.ConfigurationFactory;
> > +import org.apache.logging.log4j.core.config.Order;
> > import org.apache.logging.log4j.core.config.plugins.Plugin;
> >
> > /**
> >
> > Added:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/status/StatusConfiguration.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/status/StatusConfiguration.java?rev=1580734&view=auto
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/status/StatusConfiguration.java
> (added)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/status/StatusConfiguration.java
> Mon Mar 24 04:17:35 2014
> > @@ -0,0 +1,224 @@
> > +/*
> > + * 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 "License"); you may not use this file except in compliance with
> > + * the License. You may obtain a copy of the License at
> > + *
> > + *      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,
> > + * 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.
> > + */
> > +
> > +package org.apache.logging.log4j.core.config.status;
> > +
> > +import java.io.File;
> > +import java.io.FileNotFoundException;
> > +import java.io.FileOutputStream;
> > +import java.io.PrintStream;
> > +import java.net.URI;
> > +import java.net.URISyntaxException;
> > +import java.util.Collection;
> > +import java.util.Collections;
> > +import java.util.LinkedList;
> > +
> > +import org.apache.logging.log4j.Level;
> > +import org.apache.logging.log4j.core.helpers.FileUtils;
> > +import org.apache.logging.log4j.status.StatusConsoleListener;
> > +import org.apache.logging.log4j.status.StatusListener;
> > +import org.apache.logging.log4j.status.StatusLogger;
> > +
> > +/**
> > + * Configuration for setting up {@link StatusConsoleListener} instances.
> > + */
> > +public class StatusConfiguration {
> > +
> > +    @SuppressWarnings("UseOfSystemOutOrSystemErr")
> > +    private static final PrintStream DEFAULT_STREAM = System.out;
> > +    private static final Level DEFAULT_STATUS = Level.ERROR;
> > +    private static final Verbosity DEFAULT_VERBOSITY = Verbosity.QUIET;
> > +
> > +    private final Collection<String> errorMessages =
> Collections.synchronizedCollection(new LinkedList<String>());
> > +    private final StatusLogger logger = StatusLogger.getLogger();
> > +
> > +    private volatile boolean initialized = false;
> > +
> > +    private PrintStream destination = DEFAULT_STREAM;
> > +    private Level status = DEFAULT_STATUS;
> > +    private Verbosity verbosity = DEFAULT_VERBOSITY;
> > +    private String[] verboseClasses;
> > +
> > +    /**
> > +     * Specifies how verbose the StatusLogger should be.
> > +     */
> > +    public static enum Verbosity {
> > +        QUIET, VERBOSE;
> > +
> > +        /**
> > +         * Parses the verbosity property into an enum.
> > +         *
> > +         * @param value property value to parse.
> > +         * @return enum corresponding to value, or QUIET by default.
> > +         */
> > +        public static Verbosity toVerbosity(final String value) {
> > +            return Boolean.parseBoolean(value) ? VERBOSE : QUIET;
> > +        }
> > +    }
> > +
> > +    /**
> > +     * Logs an error message to the StatusLogger. If the StatusLogger
> hasn't been set up yet, queues the message to be
> > +     * logged after initialization.
> > +     *
> > +     * @param message error message to log.
> > +     */
> > +    public void error(final String message) {
> > +        if (!this.initialized) {
> > +            this.errorMessages.add(message);
> > +        } else {
> > +            this.logger.error(message);
> > +        }
> > +    }
> > +
> > +    /**
> > +     * Specifies the destination for StatusLogger events. This can be
> {@code out} (default) for using
> > +     * {@link System#out standard out}, {@code err} for using {@link
> System#err standard error}, or a file URI to
> > +     * which log events will be written. If the provided URI is
> invalid, then the default destination of standard
> > +     * out will be used.
> > +     *
> > +     * @param destination where status log messages should be output.
> > +     * @return {@code this}
> > +     */
> > +    public StatusConfiguration withDestination(final String
> destination) {
> > +        try {
> > +            this.destination = parseStreamName(destination);
> > +        } catch (final URISyntaxException e) {
> > +            this.error("Could not parse URI [" + destination + "].
> Falling back to default of stdout.");
> > +            this.destination = DEFAULT_STREAM;
> > +        } catch (final FileNotFoundException e) {
> > +            this.error("File could not be found at [" + destination +
> "]. Falling back to default of stdout.");
> > +            this.destination = DEFAULT_STREAM;
> > +        }
> > +        return this;
> > +    }
> > +
> > +    private PrintStream parseStreamName(final String name) throws
> URISyntaxException, FileNotFoundException {
> > +        if (name == null || name.equalsIgnoreCase("out")) {
> > +            return DEFAULT_STREAM;
> > +        }
> > +        if (name.equalsIgnoreCase("err")) {
> > +            return System.err;
> > +        }
> > +        final URI destination = FileUtils.getCorrectedFilePathUri(name);
> > +        final File output = FileUtils.fileFromURI(destination);
> > +        if (output == null) {
> > +            // don't want any NPEs, no sir
> > +            return DEFAULT_STREAM;
> > +        }
> > +        final FileOutputStream fos = new FileOutputStream(output);
> > +        return new PrintStream(fos, true);
> > +    }
> > +
> > +    /**
> > +     * Specifies the logging level by name to use for filtering
> StatusLogger messages.
> > +     *
> > +     * @param status name of logger level to filter below.
> > +     * @return {@code this}
> > +     * @see Level
> > +     */
> > +    public StatusConfiguration withStatus(final String status) {
> > +        this.status = Level.toLevel(status, null);
> > +        if (this.status == null) {
> > +            this.error("Invalid status level specified: " + status + ".
> Defaulting to ERROR.");
> > +            this.status = Level.ERROR;
> > +        }
> > +        return this;
> > +    }
> > +
> > +    /**
> > +     * Specifies the logging level to use for filtering StatusLogger
> messages.
> > +     *
> > +     * @param status logger level to filter below.
> > +     * @return {@code this}
> > +     */
> > +    public StatusConfiguration withStatus(final Level status) {
> > +        this.status = status;
> > +        return this;
> > +    }
> > +
> > +    /**
> > +     * Specifies the verbosity level to log at. This only applies to
> classes configured by
> > +     * {@link #withVerboseClasses(String...) verboseClasses}.
> > +     *
> > +     * @param verbosity basic filter for status logger messages.
> > +     * @return {@code this}
> > +     */
> > +    public StatusConfiguration withVerbosity(final String verbosity) {
> > +        this.verbosity = Verbosity.toVerbosity(verbosity);
> > +        return this;
> > +    }
> > +
> > +    /**
> > +     * Specifies which class names to filter if the configured
> verbosity level is QUIET.
> > +     *
> > +     * @param verboseClasses names of classes to filter if not using
> VERBOSE.
> > +     * @return {@code this}
> > +     */
> > +    public StatusConfiguration withVerboseClasses(final String...
> verboseClasses) {
> > +        this.verboseClasses = verboseClasses;
> > +        return this;
> > +    }
> > +
> > +    /**
> > +     * Configures and initializes the StatusLogger using the configured
> options in this instance.
> > +     */
> > +    public void initialize() {
> > +        if (!this.initialized) {
> > +            if (this.status == Level.OFF) {
> > +                this.initialized = true;
> > +            } else {
> > +                final boolean configured =
> configureExistingStatusConsoleListener();
> > +                if (!configured) {
> > +                    registerNewStatusConsoleListener();
> > +                }
> > +                migrateSavedLogMessages();
> > +            }
> > +        }
> > +    }
> > +
> > +    private boolean configureExistingStatusConsoleListener() {
> > +        boolean configured = false;
> > +        for (final StatusListener statusListener :
> this.logger.getListeners()) {
> > +            if (statusListener instanceof StatusConsoleListener) {
> > +                final StatusConsoleListener listener =
> (StatusConsoleListener) statusListener;
> > +                listener.setLevel(this.status);
> > +                if (this.verbosity == Verbosity.QUIET) {
> > +                    listener.setFilters(this.verboseClasses);
> > +                }
> > +                configured = true;
> > +            }
> > +        }
> > +        return configured;
> > +    }
> > +
> > +
> > +    private void registerNewStatusConsoleListener() {
> > +        final StatusConsoleListener listener = new
> StatusConsoleListener(this.status, this.destination);
> > +        if (this.verbosity == Verbosity.QUIET) {
> > +            listener.setFilters(this.verboseClasses);
> > +        }
> > +        this.logger.registerListener(listener);
> > +    }
> > +
> > +    private void migrateSavedLogMessages() {
> > +        for (final String message : this.errorMessages) {
> > +            this.logger.error(message);
> > +        }
> > +        this.initialized = true;
> > +        this.errorMessages.clear();
> > +    }
> > +}
> > \ No newline at end of file
> >
> > Propchange:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/status/StatusConfiguration.java
> >
> ------------------------------------------------------------------------------
> >    svn:eol-style = native
> >
> > Copied:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfiguration.java
> (from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfiguration.java)
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfiguration.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfiguration.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfiguration.java&r1=1580711&r2=1580734&rev=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfiguration.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfiguration.java
> Mon Mar 24 04:17:35 2014
> > @@ -14,24 +14,17 @@
> >  * See the license for the specific language governing permissions and
> >  * limitations under the license.
> >  */
> > -package org.apache.logging.log4j.core.config;
> > +package org.apache.logging.log4j.core.config.xml;
> >
> > import java.io.ByteArrayInputStream;
> > -import java.io.ByteArrayOutputStream;
> > import java.io.File;
> > import java.io.FileInputStream;
> > import java.io.FileNotFoundException;
> > -import java.io.FileOutputStream;
> > import java.io.IOException;
> > import java.io.InputStream;
> > -import java.io.PrintStream;
> > -import java.net.URISyntaxException;
> > -import java.nio.charset.Charset;
> > import java.util.ArrayList;
> > -import java.util.Iterator;
> > import java.util.List;
> > import java.util.Map;
> > -
> > import javax.xml.XMLConstants;
> > import javax.xml.parsers.DocumentBuilder;
> > import javax.xml.parsers.DocumentBuilderFactory;
> > @@ -42,15 +35,18 @@ import javax.xml.validation.Schema;
> > import javax.xml.validation.SchemaFactory;
> > import javax.xml.validation.Validator;
> >
> > -import org.apache.logging.log4j.Level;
> > +import org.apache.logging.log4j.core.config.AbstractConfiguration;
> > +import org.apache.logging.log4j.core.config.Configuration;
> > +import org.apache.logging.log4j.core.config.ConfigurationFactory;
> > +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.helpers.FileUtils;
> > +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;
> > -import org.apache.logging.log4j.status.StatusConsoleListener;
> > -import org.apache.logging.log4j.status.StatusListener;
> > -import org.apache.logging.log4j.status.StatusLogger;
> > import org.w3c.dom.Attr;
> > import org.w3c.dom.Document;
> > import org.w3c.dom.Element;
> > @@ -63,7 +59,7 @@ import org.xml.sax.SAXException;
> > /**
> >  * Creates a Node hierarchy from an XML file.
> >  */
> > -public class XMLConfiguration extends BaseConfiguration implements
> Reconfigurable {
> > +public class XMLConfiguration extends AbstractConfiguration implements
> Reconfigurable {
> >
> >     private static final String XINCLUDE_FIXUP_LANGUAGE = "
> http://apache.org/xml/features/xinclude/fixup-language";
> >
> > @@ -73,8 +69,6 @@ public class XMLConfiguration extends Ba
> >
> >     private static final String LOG4J_XSD = "Log4j-config.xsd";
> >
> > -    private static final int BUF_SIZE = 16384;
> > -
> >     private final List<Status> status = new ArrayList<Status>();
> >
> >     private Element rootElement;
> > @@ -108,28 +102,28 @@ public class XMLConfiguration extends Ba
> >             // Alternative: We set if a system property on the command
> line is set, for example:
> >             // -DLog4j.XInclude=true
> >             factory.setXIncludeAware(true);
> > -        } catch (UnsupportedOperationException e) {
> > -            LOGGER.warn("The DocumentBuilderFactory does not support
> XInclude: " + factory, e);
> > -        } catch (AbstractMethodError err) {
> > -            LOGGER.warn("The DocumentBuilderFactory is out of date and
> does not support XInclude: " + factory);
> > +        } catch (final UnsupportedOperationException e) {
> > +            LOGGER.warn("The DocumentBuilderFactory does not support
> XInclude: {}", factory, e);
> > +        } catch (@SuppressWarnings("ErrorNotRethrown") final
> AbstractMethodError err) {
> > +            LOGGER.warn("The DocumentBuilderFactory is out of date and
> does not support XInclude: {}", factory, err);
> >         }
> >         try {
> >             // Alternative: We could specify all features and values
> with system properties like:
> >             // -DLog4j.DocumentBuilderFactory.Feature="
> http://apache.org/xml/features/xinclude/fixup-base-uris true"
> >             factory.setFeature(XINCLUDE_FIXUP_BASE_URIS, true);
> >         } catch (ParserConfigurationException e) {
> > -            LOGGER.warn("The DocumentBuilderFactory [" + factory + "]
> does not support the feature ["
> > -                    + XINCLUDE_FIXUP_BASE_URIS + "]", e);
> > -        } catch (AbstractMethodError err) {
> > -            LOGGER.warn("The DocumentBuilderFactory is out of date and
> does not support setFeature: " + factory);
> > +            LOGGER.warn("The DocumentBuilderFactory [{}] does not
> support the feature [{}].", factory,
> > +                    XINCLUDE_FIXUP_BASE_URIS, e);
> > +        } catch (@SuppressWarnings("ErrorNotRethrown") final
> AbstractMethodError err) {
> > +            LOGGER.warn("The DocumentBuilderFactory is out of date and
> does not support setFeature: {}", factory);
> >         }
> >         try {
> >             factory.setFeature(XINCLUDE_FIXUP_LANGUAGE, true);
> >         } catch (ParserConfigurationException e) {
> > -            LOGGER.warn("The DocumentBuilderFactory [" + factory + "]
> does not support the feature ["
> > -                    + XINCLUDE_FIXUP_LANGUAGE + "]", e);
> > -        } catch (AbstractMethodError err) {
> > -            LOGGER.warn("The DocumentBuilderFactory is out of date and
> does not support setFeature: " + factory);
> > +            LOGGER.warn("The DocumentBuilderFactory [{}] does not
> support the feature [{}].", factory,
> > +                    XINCLUDE_FIXUP_LANGUAGE, e);
> > +        } catch (@SuppressWarnings("ErrorNotRethrown") final
> AbstractMethodError err) {
> > +            LOGGER.warn("The DocumentBuilderFactory is out of date and
> does not support setFeature: {}", factory);
> >         }
> >     }
> >
> > @@ -138,7 +132,6 @@ public class XMLConfiguration extends Ba
> >         byte[] buffer = null;
> >
> >         try {
> > -            final List<String> messages = new ArrayList<String>();
> >             final InputStream configStream =
> configSource.getInputStream();
> >             buffer = toByteArray(configStream);
> >             configStream.close();
> > @@ -146,81 +139,41 @@ public class XMLConfiguration extends Ba
> >             final Document document = newDocumentBuilder().parse(source);
> >             rootElement = document.getDocumentElement();
> >             final Map<String, String> attrs =
> processAttributes(rootNode, rootElement);
> > -            Level status = getDefaultStatus();
> > -            boolean verbose = false;
> > -            PrintStream stream = System.out;
> > -
> > +            final StatusConfiguration statusConfig = new
> StatusConfiguration()
> > +                    .withVerboseClasses(VERBOSE_CLASSES)
> > +                    .withStatus(getDefaultStatus());
> >             for (final Map.Entry<String, String> entry :
> attrs.entrySet()) {
> > -                if ("status".equalsIgnoreCase(entry.getKey())) {
> > -                    final Level stat =
> Level.toLevel(getStrSubstitutor().replace(entry.getValue()), null);
> > -                    if (stat != null) {
> > -                        status = stat;
> > -                    } else {
> > -                        messages.add("Invalid status specified: " +
> entry.getValue() + ". Defaulting to " + status);
> > -                    }
> > -                } else if ("dest".equalsIgnoreCase(entry.getKey())) {
> > -                    final String dest =
> getStrSubstitutor().replace(entry.getValue());
> > -                    if (dest != null) {
> > -                        if (dest.equalsIgnoreCase("err")) {
> > -                            stream = System.err;
> > -                        } else {
> > -                            try {
> > -                                final File destFile =
> FileUtils.fileFromURI(FileUtils.getCorrectedFilePathUri(dest));
> > -                                final String enc =
> Charset.defaultCharset().name();
> > -                                stream = new PrintStream(new
> FileOutputStream(destFile), true, enc);
> > -                            } catch (final URISyntaxException use) {
> > -                                System.err.println("Unable to write to
> " + dest + ". Writing to stdout");
> > -                            }
> > -                        }
> > -                    }
> > -                } else if
> ("shutdownHook".equalsIgnoreCase(entry.getKey())) {
> > -                    String hook =
> getStrSubstitutor().replace(entry.getValue());
> > -                    isShutdownHookEnabled =
> !hook.equalsIgnoreCase("disable");
> > -                } else if ("verbose".equalsIgnoreCase(entry.getKey())) {
> > -                    verbose =
> Boolean.parseBoolean(getStrSubstitutor().replace(entry.getValue()));
> > -                } else if
> ("packages".equalsIgnoreCase(getStrSubstitutor().replace(entry.getKey()))) {
> > -                    final String[] packages =
> entry.getValue().split(Patterns.COMMA_SEPARATOR);
> > +                final String key = entry.getKey();
> > +                final String value =
> getStrSubstitutor().replace(entry.getValue());
> > +                if ("status".equalsIgnoreCase(key)) {
> > +                    statusConfig.withStatus(value);
> > +                } else if ("dest".equalsIgnoreCase(key)) {
> > +                    statusConfig.withDestination(value);
> > +                } else if ("shutdownHook".equalsIgnoreCase(key)) {
> > +                    isShutdownHookEnabled =
> !"disable".equalsIgnoreCase(value);
> > +                } else if ("verbose".equalsIgnoreCase(key)) {
> > +                    statusConfig.withVerbosity(value);
> > +                } else if ("packages".equalsIgnoreCase(key)) {
> > +                    final String[] packages =
> value.split(Patterns.COMMA_SEPARATOR);
> >                     for (final String p : packages) {
> >                         PluginManager.addPackage(p);
> >                     }
> > -                } else if ("name".equalsIgnoreCase(entry.getKey())) {
> > -
>  setName(getStrSubstitutor().replace(entry.getValue()));
> > -                } else if ("strict".equalsIgnoreCase(entry.getKey())) {
> > -                    strict =
> Boolean.parseBoolean(getStrSubstitutor().replace(entry.getValue()));
> > -                } else if ("schema".equalsIgnoreCase(entry.getKey())) {
> > -                    schema =
> getStrSubstitutor().replace(entry.getValue());
> > -                } else if
> ("monitorInterval".equalsIgnoreCase(entry.getKey())) {
> > -                    final int interval =
> Integer.parseInt(getStrSubstitutor().replace(entry.getValue()));
> > +                } else if ("name".equalsIgnoreCase(key)) {
> > +                    setName(value);
> > +                } else if ("strict".equalsIgnoreCase(key)) {
> > +                    strict = Boolean.parseBoolean(value);
> > +                } else if ("schema".equalsIgnoreCase(key)) {
> > +                    schema = value;
> > +                } else if ("monitorInterval".equalsIgnoreCase(key)) {
> > +                    final int interval = Integer.parseInt(value);
> >                     if (interval > 0 && configFile != null) {
> >                         monitor = new FileConfigurationMonitor(this,
> configFile, listeners, interval);
> >                     }
> > -                } else if
> ("advertiser".equalsIgnoreCase(entry.getKey())) {
> > -
>  createAdvertiser(getStrSubstitutor().replace(entry.getValue()),
> configSource, buffer, "text/xml");
> > +                } else if ("advertiser".equalsIgnoreCase(key)) {
> > +                    createAdvertiser(value, configSource, buffer,
> "text/xml");
> >                 }
> >             }
> > -            final Iterator<StatusListener> iter = ((StatusLogger)
> LOGGER).getListeners();
> > -            boolean found = false;
> > -            while (iter.hasNext()) {
> > -                final StatusListener listener = iter.next();
> > -                if (listener instanceof StatusConsoleListener) {
> > -                    found = true;
> > -                    ((StatusConsoleListener) listener).setLevel(status);
> > -                    if (!verbose) {
> > -                        ((StatusConsoleListener)
> listener).setFilters(VERBOSE_CLASSES);
> > -                    }
> > -                }
> > -            }
> > -            if (!found && status != Level.OFF) {
> > -                final StatusConsoleListener listener = new
> StatusConsoleListener(status, stream);
> > -                if (!verbose) {
> > -                    listener.setFilters(VERBOSE_CLASSES);
> > -                }
> > -                ((StatusLogger) LOGGER).registerListener(listener);
> > -                for (final String msg : messages) {
> > -                    LOGGER.error(msg);
> > -                }
> > -            }
> > -
> > +            statusConfig.initialize();
> >         } catch (final SAXException domEx) {
> >             LOGGER.error("Error parsing " + configSource.getLocation(),
> domEx);
> >         } catch (final IOException ioe) {
> > @@ -231,9 +184,9 @@ public class XMLConfiguration extends Ba
> >         if (strict && schema != null && buffer != null) {
> >             InputStream is = null;
> >             try {
> > -                is =
> getClass().getClassLoader().getResourceAsStream(schema);
> > +                is = Loader.getResourceAsStream(schema,
> XMLConfiguration.class.getClassLoader());
> >             } catch (final Exception ex) {
> > -                LOGGER.error("Unable to access schema " + schema);
> > +                LOGGER.error("Unable to access schema {}", this.schema);
> >             }
> >             if (is != null) {
> >                 final Source src = new StreamSource(is, LOG4J_XSD);
> > @@ -345,19 +298,6 @@ public class XMLConfiguration extends Ba
> >         return element.getTagName();
> >     }
> >
> > -    private byte[] toByteArray(final InputStream is) throws IOException
> {
> > -        final ByteArrayOutputStream buffer = new
> ByteArrayOutputStream();
> > -
> > -        int nRead;
> > -        final byte[] data = new byte[BUF_SIZE];
> > -
> > -        while ((nRead = is.read(data, 0, data.length)) != -1) {
> > -            buffer.write(data, 0, nRead);
> > -        }
> > -
> > -        return buffer.toByteArray();
> > -    }
> > -
> >     private Map<String, String> processAttributes(final Node node, final
> Element element) {
> >         final NamedNodeMap attrs = element.getAttributes();
> >         final Map<String, String> attributes = node.getAttributes();
> > @@ -385,7 +325,7 @@ public class XMLConfiguration extends Ba
> >     /**
> >      * Status for recording errors.
> >      */
> > -    private class Status {
> > +    private static class Status {
> >         private final Element element;
> >         private final String name;
> >         private final ErrorType errorType;
> >
> > Copied:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfigurationFactory.java
> (from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfigurationFactory.java)
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfigurationFactory.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfigurationFactory.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfigurationFactory.java&r1=1580711&r2=1580734&rev=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfigurationFactory.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XMLConfigurationFactory.java
> Mon Mar 24 04:17:35 2014
> > @@ -14,8 +14,11 @@
> >  * See the license for the specific language governing permissions and
> >  * limitations under the license.
> >  */
> > -package org.apache.logging.log4j.core.config;
> > +package org.apache.logging.log4j.core.config.xml;
> >
> > +import org.apache.logging.log4j.core.config.Configuration;
> > +import org.apache.logging.log4j.core.config.ConfigurationFactory;
> > +import org.apache.logging.log4j.core.config.Order;
> > import org.apache.logging.log4j.core.config.plugins.Plugin;
> >
> > /**
> >
> > Copied:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfiguration.java
> (from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/YAMLConfiguration.java)
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfiguration.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfiguration.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/YAMLConfiguration.java&r1=1580711&r2=1580734&rev=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/YAMLConfiguration.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfiguration.java
> Mon Mar 24 04:17:35 2014
> > @@ -14,11 +14,13 @@
> >  * See the license for the specific language governing permissions and
> >  * limitations under the license.
> >  */
> > -package org.apache.logging.log4j.core.config;
> > +package org.apache.logging.log4j.core.config.yaml;
> >
> > import com.fasterxml.jackson.core.JsonParser;
> > import com.fasterxml.jackson.databind.ObjectMapper;
> > import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
> > +import org.apache.logging.log4j.core.config.ConfigurationFactory;
> > +import org.apache.logging.log4j.core.config.json.JSONConfiguration;
> >
> > public class YAMLConfiguration extends JSONConfiguration {
> >
> >
> > Copied:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfigurationFactory.java
> (from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/YAMLConfigurationFactory.java)
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfigurationFactory.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfigurationFactory.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/YAMLConfigurationFactory.java&r1=1580711&r2=1580734&rev=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/YAMLConfigurationFactory.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YAMLConfigurationFactory.java
> Mon Mar 24 04:17:35 2014
> > @@ -14,12 +14,15 @@
> >  * See the license for the specific language governing permissions and
> >  * limitations under the license.
> >  */
> > -package org.apache.logging.log4j.core.config;
> > -
> > -import org.apache.logging.log4j.core.config.plugins.Plugin;
> > +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;
> > +import org.apache.logging.log4j.core.config.plugins.Plugin;
> > +
> > @Plugin(name = "YAMLConfigurationFactory", category =
> "ConfigurationFactory")
> > @Order(7)
> > public class YAMLConfigurationFactory extends ConfigurationFactory {
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SocketServer.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SocketServer.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SocketServer.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SocketServer.java
> Mon Mar 24 04:17:35 2014
> > @@ -41,8 +41,8 @@ import org.apache.logging.log4j.core.Log
> > import org.apache.logging.log4j.core.LogEvent;
> > import org.apache.logging.log4j.core.config.Configuration;
> > import org.apache.logging.log4j.core.config.ConfigurationFactory;
> > -import org.apache.logging.log4j.core.config.XMLConfiguration;
> > -import org.apache.logging.log4j.core.config.XMLConfigurationFactory;
> > +import org.apache.logging.log4j.core.config.xml.XMLConfiguration;
> > +import org.apache.logging.log4j.core.config.xml.XMLConfigurationFactory;
> >
> > /**
> >  * Listens for events over a socket connection.
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java
> Mon Mar 24 04:17:35 2014
> > @@ -38,8 +38,8 @@ import org.apache.logging.log4j.core.Log
> > import org.apache.logging.log4j.core.LogEventListener;
> > import org.apache.logging.log4j.core.config.Configuration;
> > import org.apache.logging.log4j.core.config.ConfigurationFactory;
> > -import org.apache.logging.log4j.core.config.XMLConfiguration;
> > -import org.apache.logging.log4j.core.config.XMLConfigurationFactory;
> > +import org.apache.logging.log4j.core.config.xml.XMLConfiguration;
> > +import org.apache.logging.log4j.core.config.xml.XMLConfigurationFactory;
> >
> > /**
> >  * Listens for events over a socket connection.
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/BasicConfigurationFactory.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/BasicConfigurationFactory.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/BasicConfigurationFactory.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/BasicConfigurationFactory.java
> Mon Mar 24 04:17:35 2014
> > @@ -16,14 +16,14 @@
> >  */
> > package org.apache.logging.log4j.core;
> >
> > +import java.net.URI;
> > +
> > import org.apache.logging.log4j.Level;
> > -import org.apache.logging.log4j.core.config.BaseConfiguration;
> > +import org.apache.logging.log4j.core.config.AbstractConfiguration;
> > import org.apache.logging.log4j.core.config.Configuration;
> > import org.apache.logging.log4j.core.config.ConfigurationFactory;
> > import org.apache.logging.log4j.core.config.LoggerConfig;
> >
> > -import java.net.URI;
> > -
> > /**
> >  *
> >  */
> > @@ -44,7 +44,7 @@ public class BasicConfigurationFactory e
> >         return null;
> >     }
> >
> > -    public class BasicConfiguration extends BaseConfiguration {
> > +    public class BasicConfiguration extends AbstractConfiguration {
> >
> >         private static final String DEFAULT_LEVEL =
> "org.apache.logging.log4j.level";
> >
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/LateConfigTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/LateConfigTest.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/LateConfigTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/LateConfigTest.java
> Mon Mar 24 04:17:35 2014
> > @@ -16,15 +16,16 @@
> >  */
> > package org.apache.logging.log4j.core;
> >
> > +import java.io.File;
> > +
> > import org.apache.logging.log4j.LogManager;
> > import org.apache.logging.log4j.core.config.Configuration;
> > import org.apache.logging.log4j.core.config.DefaultConfiguration;
> > -import org.apache.logging.log4j.core.config.XMLConfiguration;
> > +import org.apache.logging.log4j.core.config.xml.XMLConfiguration;
> > import org.apache.logging.log4j.test.appender.ListAppender;
> > import org.junit.BeforeClass;
> > import org.junit.Test;
> >
> > -import java.io.File;
> > import static org.junit.Assert.assertNotNull;
> > import static org.junit.Assert.assertTrue;
> >
> >
> > Copied:
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/AbstractConfigurationTest.java
> (from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java)
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/AbstractConfigurationTest.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/AbstractConfigurationTest.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java&r1=1580711&r2=1580734&rev=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/AbstractConfigurationTest.java
> Mon Mar 24 04:17:35 2014
> > @@ -16,8 +16,6 @@
> >  */
> > package org.apache.logging.log4j.core.config;
> >
> > -import static org.junit.Assert.*;
> > -
> > import java.util.Map;
> >
> > import org.apache.logging.log4j.Level;
> > @@ -28,7 +26,11 @@ import org.apache.logging.log4j.core.Log
> > import org.apache.logging.log4j.core.config.plugins.PluginManager;
> > import org.junit.Test;
> >
> > -public class BaseConfigurationTest {
> > +import static org.junit.Assert.assertEquals;
> > +import static org.junit.Assert.assertNotNull;
> > +import static org.junit.Assert.assertTrue;
> > +
> > +public class AbstractConfigurationTest {
> >
> >
> >     @Test
> > @@ -59,7 +61,7 @@ public class BaseConfigurationTest {
> >         // sample only has List appender, not Console!
> >         assertTrue("sample has appender List",
> sampleAppenders.containsKey("List"));
> >
> > -        final BaseConfiguration baseConfig = (BaseConfiguration) config;
> > +        final AbstractConfiguration baseConfig =
> (AbstractConfiguration) config;
> >         final LoggerConfig root = baseConfig.getRootLogger();
> >         final Map<String, Appender> rootAppenders = root.getAppenders();
> >         assertEquals("rootAppenders Size", 1, rootAppenders.size());
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
> Mon Mar 24 04:17:35 2014
> > @@ -16,16 +16,17 @@
> >  */
> > package org.apache.logging.log4j.core.config;
> >
> > +import java.io.File;
> > +import java.util.Map;
> > +
> > import org.apache.logging.log4j.LogManager;
> > import org.apache.logging.log4j.core.LoggerContext;
> > +import org.apache.logging.log4j.core.config.xml.XMLConfiguration;
> > import org.apache.logging.log4j.status.StatusLogger;
> > import org.junit.AfterClass;
> > import org.junit.BeforeClass;
> > import org.junit.Test;
> >
> > -import java.io.File;
> > -import java.util.Map;
> > -
> > import static org.junit.Assert.assertTrue;
> >
> > /**
> > @@ -44,7 +45,7 @@ public class AdvertiserTest {
> >         final LoggerContext ctx = (LoggerContext)
> LogManager.getContext();
> >         final Configuration config = ctx.getConfiguration();
> >         if (config instanceof XMLConfiguration) {
> > -            final String name = ((XMLConfiguration) config).getName();
> > +            final String name = config.getName();
> >             if (name == null || !name.equals("XMLConfigTest")) {
> >                 ctx.reconfigure();
> >             }
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/CustomConfigurationTest.java
> Mon Mar 24 04:17:35 2014
> > @@ -16,21 +16,21 @@
> >  */
> > package org.apache.logging.log4j.core.config;
> >
> > +import java.io.File;
> > +
> > import org.apache.logging.log4j.LogManager;
> > import org.apache.logging.log4j.Logger;
> > import org.apache.logging.log4j.core.Appender;
> > import org.apache.logging.log4j.core.Layout;
> > import org.apache.logging.log4j.core.LoggerContext;
> > import org.apache.logging.log4j.core.appender.FileAppender;
> > -import org.apache.logging.log4j.core.helpers.Constants;
> > +import org.apache.logging.log4j.core.config.xml.XMLConfiguration;
> > import org.apache.logging.log4j.core.layout.PatternLayout;
> > import org.apache.logging.log4j.status.StatusLogger;
> > import org.junit.AfterClass;
> > import org.junit.BeforeClass;
> > import org.junit.Test;
> >
> > -import java.io.File;
> > -
> > import static org.junit.Assert.assertTrue;
> >
> > /**
> >
> > Modified:
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/FileOutputTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/FileOutputTest.java?rev=1580734&r1=1580733&r2=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/FileOutputTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/FileOutputTest.java
> Mon Mar 24 04:17:35 2014
> > @@ -16,16 +16,17 @@
> >  */
> > package org.apache.logging.log4j.core.config;
> >
> > +import java.io.File;
> > +
> > import org.apache.logging.log4j.LogManager;
> > import org.apache.logging.log4j.core.LoggerContext;
> > +import org.apache.logging.log4j.core.config.xml.XMLConfiguration;
> > import org.apache.logging.log4j.status.StatusLogger;
> > import org.junit.AfterClass;
> > import org.junit.BeforeClass;
> > import org.junit.Test;
> >
> > -import java.io.File;
> > -
> > -import static org.junit.Assert.*;
> > +import static org.junit.Assert.assertTrue;
> >
> > /**
> >  *
> > @@ -43,7 +44,7 @@ public class FileOutputTest {
> >         final LoggerContext ctx = (LoggerContext)
> LogManager.getContext();
> >         final Configuration config = ctx.getConfiguration();
> >         if (config instanceof XMLConfiguration) {
> > -            final String name = ((XMLConfiguration) config).getName();
> > +            final String name = config.getName();
> >             if (name == null || !name.equals("XMLConfigTest")) {
> >                 ctx.reconfigure();
> >             }
> >
> > Copied:
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/XMLConfigurationPropsTest.java
> (from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationPropsTest.java)
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/XMLConfigurationPropsTest.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/XMLConfigurationPropsTest.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationPropsTest.java&r1=1580711&r2=1580734&rev=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationPropsTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/XMLConfigurationPropsTest.java
> Mon Mar 24 04:17:35 2014
> > @@ -14,17 +14,19 @@
> >  * See the license for the specific language governing permissions and
> >  * limitations under the license.
> >  */
> > -package org.apache.logging.log4j.core.config;
> > +package org.apache.logging.log4j.core.config.xml;
> >
> > import org.apache.logging.log4j.LogManager;
> > import org.apache.logging.log4j.core.LoggerContext;
> > +import org.apache.logging.log4j.core.config.Configuration;
> > +import org.apache.logging.log4j.core.config.ConfigurationFactory;
> > import org.apache.logging.log4j.core.helpers.Constants;
> > import org.apache.logging.log4j.status.StatusLogger;
> > import org.junit.AfterClass;
> > import org.junit.BeforeClass;
> > import org.junit.Test;
> >
> > -import static org.junit.Assert.*;
> > +import static org.junit.Assert.assertTrue;
> >
> > /**
> >  *
> >
> > Copied:
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/XMLLoggerPropsTest.java
> (from r1580711,
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XMLLoggerPropsTest.java)
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/XMLLoggerPropsTest.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/XMLLoggerPropsTest.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XMLLoggerPropsTest.java&r1=1580711&r2=1580734&rev=1580734&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XMLLoggerPropsTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/xml/XMLLoggerPropsTest.java
> Mon Mar 24 04:17:35 2014
> > @@ -14,21 +14,23 @@
> >  * See the license for the specific language governing permissions and
> >  * limitations under the license.
> >  */
> > -package org.apache.logging.log4j.core.config;
> > +package org.apache.logging.log4j.core.config.xml;
> > +
> > +import java.util.List;
> > +import java.util.Map;
> >
> > import org.apache.logging.log4j.LogManager;
> > import org.apache.logging.log4j.Logger;
> > import org.apache.logging.log4j.core.Appender;
> > import org.apache.logging.log4j.core.LoggerContext;
> > +import org.apache.logging.log4j.core.config.Configuration;
> > +import org.apache.logging.log4j.core.config.ConfigurationFactory;
> > import org.apache.logging.log4j.status.StatusLogger;
> > import org.apache.logging.log4j.test.appender.ListAppender;
> > import org.junit.AfterClass;
> > import org.junit.BeforeClass;
> > import org.junit.Test;
> >
> > -import java.util.List;
> > -import java.util.Map;
> > -
> > import static org.junit.Assert.assertNotNull;
> > import static org.junit.Assert.assertTrue;
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>


-- 
Matt Sicker <boards@gmail.com>

Mime
View raw message