geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aba...@apache.org
Subject [35/50] [abbrv] incubator-geode git commit: GEODE-401: upgrade log4j from 2.1 to 2.5. Remove our own configuration watcher since log4j now has an almost the same implementation.
Date Mon, 08 Feb 2016 17:03:50 GMT
GEODE-401: upgrade log4j from 2.1 to 2.5. Remove our own configuration watcher since log4j
now has an almost the same implementation.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/a097fcf3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/a097fcf3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/a097fcf3

Branch: refs/heads/master
Commit: a097fcf32cb20f2258637b1e1f6829c632a89e46
Parents: 08262a8
Author: Jinmei Liao <jiliao@pivotal.io>
Authored: Wed Jan 6 09:02:44 2016 -0800
Committer: Kirk Lund <klund@pivotal.io>
Committed: Thu Jan 7 09:46:21 2016 -0800

----------------------------------------------------------------------
 .../gemfire/internal/logging/LogService.java    |  48 ---
 .../internal/logging/log4j/LogWriterLogger.java |   7 -
 .../config/GemFireFileConfigurationMonitor.java | 145 --------
 .../config/xml/GemFireXmlConfiguration.java     | 344 -------------------
 .../xml/GemFireXmlConfigurationFactory.java     |  59 ----
 .../CompressionCacheConfigDUnitTest.java        |   1 +
 .../logging/log4j/Log4J2PerformanceTest.java    |  11 -
 .../log4j/LogWriterLoggerPerformanceTest.java   |  11 -
 .../java/dunit/standalone/DUnitLauncher.java    |   2 +-
 gradle/dependency-versions.properties           |   2 +-
 10 files changed, 3 insertions(+), 627 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a097fcf3/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/LogService.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/LogService.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/LogService.java
index 8159966..7eeb26c 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/LogService.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/LogService.java
@@ -18,71 +18,23 @@ package com.gemstone.gemfire.internal.logging;
 
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-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.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.Filter.Result;
 import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.config.AppenderRef;
 import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.ConfigurationFactory;
-import org.apache.logging.log4j.core.config.ConfigurationSource;
-import org.apache.logging.log4j.core.config.FileConfigurationMonitor;
 import org.apache.logging.log4j.core.config.LoggerConfig;
-import org.apache.logging.log4j.core.config.Node;
-import org.apache.logging.log4j.core.config.status.StatusConfiguration;
-import org.apache.logging.log4j.core.config.xml.XmlConfiguration;
-import org.apache.logging.log4j.core.filter.AbstractFilterable;
-import org.apache.logging.log4j.core.lookup.Interpolator;
 import org.apache.logging.log4j.core.lookup.StrLookup;
 import org.apache.logging.log4j.core.lookup.StrSubstitutor;
-import org.apache.logging.log4j.core.util.Closer;
-import org.apache.logging.log4j.core.util.Loader;
-import org.apache.logging.log4j.core.util.Patterns;
 import org.apache.logging.log4j.status.StatusLogger;
-import org.apache.logging.log4j.util.PropertiesUtil;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import com.gemstone.gemfire.InternalGemFireError;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.internal.logging.log4j.AppenderContext;
 import com.gemstone.gemfire.internal.logging.log4j.ConfigLocator;
 import com.gemstone.gemfire.internal.logging.log4j.Configurator;
 import com.gemstone.gemfire.internal.logging.log4j.FastLogger;
-import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
 import com.gemstone.gemfire.internal.logging.log4j.LogWriterLogger;
-import com.gemstone.gemfire.internal.util.IOUtils;
-import com.gemstone.org.apache.logging.log4j.core.config.xml.GemFireXmlConfiguration;
-import com.gemstone.org.apache.logging.log4j.core.config.xml.GemFireXmlConfigurationFactory;
 import com.gemstone.org.apache.logging.log4j.message.GemFireParameterizedMessageFactory;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a097fcf3/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLogger.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLogger.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLogger.java
index c85b3f7..1fb907d 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLogger.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLogger.java
@@ -22,10 +22,6 @@ import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.Marker;
-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.LoggerConfig;
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.spi.AbstractLogger;
 import org.apache.logging.log4j.spi.ExtendedLoggerWrapper;
@@ -36,9 +32,6 @@ import com.gemstone.gemfire.i18n.StringId;
 import com.gemstone.gemfire.internal.logging.GemFireHandler;
 import com.gemstone.gemfire.internal.logging.InternalLogWriter;
 import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.logging.LogWriterFactory;
-import com.gemstone.gemfire.internal.logging.LogWriterImpl;
-import com.gemstone.org.apache.logging.log4j.core.config.xml.GemFireXmlConfiguration;
 import com.gemstone.org.apache.logging.log4j.message.GemFireParameterizedMessageFactory;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a097fcf3/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/GemFireFileConfigurationMonitor.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/GemFireFileConfigurationMonitor.java
b/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/GemFireFileConfigurationMonitor.java
deleted file mode 100644
index e6b2bb4..0000000
--- a/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/GemFireFileConfigurationMonitor.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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 com.gemstone.org.apache.logging.log4j.core.config;
-
-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;
-
-import org.apache.logging.log4j.core.config.ConfigurationListener;
-import org.apache.logging.log4j.core.config.ConfigurationMonitor;
-import org.apache.logging.log4j.core.config.Reconfigurable;
-
-/**
- * Configuration monitor that periodically checks the timestamp of the configuration file
and calls the
- * ConfigurationListeners when an update occurs.
- */
-public class GemFireFileConfigurationMonitor implements ConfigurationMonitor {
-
-    static {
-        //System.out.println("Using GemFireFileConfigurationMonitor");
-    }
-  
-    private static boolean DISABLED = true;
-    private static boolean OPTIMIZED = true;
-  
-    private static final int MASK = 0x0f;
-
-    private static final int MIN_INTERVAL = 5;
-
-    private static final int MILLIS_PER_SECOND = 1000;
-
-    private final File file;
-
-    private long lastModified;
-
-    private final List<ConfigurationListener> listeners;
-
-    private final int interval;
-
-    private long nextCheck;
-
-    private final AtomicInteger counter = new AtomicInteger(0);
-
-    private static final Lock LOCK = new ReentrantLock();
-
-    private final Reconfigurable reconfigurable;
-
-    /**
-     * Constructor.
-     * @param reconfigurable The Configuration that can be reconfigured.
-     * @param file The File to monitor.
-     * @param listeners The List of ConfigurationListeners to notify upon a change.
-     * @param interval The monitor interval in seconds. The minimum interval is 5 seconds.
-     */
-    public GemFireFileConfigurationMonitor(final Reconfigurable reconfigurable, final File
file,
-                                    final List<ConfigurationListener> listeners,
-                                    final int interval) {
-        this.reconfigurable = reconfigurable;
-        this.file = file;
-        this.lastModified = file.lastModified();
-        this.listeners = listeners;
-        this.interval = (interval < MIN_INTERVAL ? MIN_INTERVAL : interval) * MILLIS_PER_SECOND;
-        this.nextCheck = System.currentTimeMillis() + interval;
-    }
-
-    /**
-     * Called to determine if the configuration has changed.
-     */
-    @Override
-    public void checkConfiguration() {
-        if (DISABLED) {
-          return;
-        } else if (OPTIMIZED) {
-            if (((counter.incrementAndGet() & MASK) == 0)) {
-                final long current = System.currentTimeMillis();
-                if (current >= nextCheck) {
-                    LOCK.lock();
-                    try {
-                        nextCheck = current + interval;
-                        if (file.lastModified() > lastModified) {
-                            lastModified = file.lastModified();
-                            for (final ConfigurationListener listener : listeners) {
-                                final Thread thread = new Thread(new ReconfigurationWorker(listener,
reconfigurable));
-                                thread.setDaemon(true);
-                                thread.start();
-                            }
-                        }
-                    } finally {
-                        LOCK.unlock();
-                    }
-                }
-            }
-        } else {
-            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) {
-                            final Thread thread = new Thread(new ReconfigurationWorker(listener,
reconfigurable));
-                            thread.setDaemon(true);
-                            thread.start();
-                        }
-                    }
-                } finally {
-                    LOCK.unlock();
-                }
-            }
-        }
-    }
-
-    private class ReconfigurationWorker implements Runnable {
-
-        private final ConfigurationListener listener;
-        private final Reconfigurable reconfigurable;
-
-        public ReconfigurationWorker(final ConfigurationListener listener, final Reconfigurable
reconfigurable) {
-            this.listener = listener;
-            this.reconfigurable = reconfigurable;
-        }
-
-        @Override
-        public void run() {
-            listener.onChange(reconfigurable);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a097fcf3/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/xml/GemFireXmlConfiguration.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/xml/GemFireXmlConfiguration.java
b/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/xml/GemFireXmlConfiguration.java
deleted file mode 100644
index e31db04..0000000
--- a/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/xml/GemFireXmlConfiguration.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * 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 com.gemstone.org.apache.logging.log4j.core.config.xml;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-
-import org.apache.logging.log4j.core.config.AbstractConfiguration;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.ConfigurationSource;
-import org.apache.logging.log4j.core.config.Node;
-import org.apache.logging.log4j.core.config.Reconfigurable;
-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.util.Closer;
-import org.apache.logging.log4j.core.util.Loader;
-import org.apache.logging.log4j.core.util.Patterns;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Creates a Node hierarchy from an XML file.
- */
-public class GemFireXmlConfiguration extends AbstractConfiguration implements Reconfigurable
{
-
-    static {
-        //System.out.println("Using GemFireXmlConfiguration");
-    }
-  
-    private static final String XINCLUDE_FIXUP_LANGUAGE = "http://apache.org/xml/features/xinclude/fixup-language";
-    private static final String XINCLUDE_FIXUP_BASE_URIS = "http://apache.org/xml/features/xinclude/fixup-base-uris";
-    private static final String[] VERBOSE_CLASSES = new String[] { ResolverUtil.class.getName()
};
-    private static final String LOG4J_XSD = "Log4j-config.xsd";
-
-    private final List<Status> status = new ArrayList<Status>();
-    private Element rootElement;
-    private boolean strict;
-    private String schema;
-
-    /**
-     * Creates a new DocumentBuilder suitable for parsing a configuration file.
-     *
-     * @return a new DocumentBuilder
-     * @throws ParserConfigurationException
-     */
-    static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
-        final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-        factory.setNamespaceAware(true);
-        enableXInclude(factory);
-        return factory.newDocumentBuilder();
-    }
-
-    /**
-     * Enables XInclude for the given DocumentBuilderFactory
-     *
-     * @param factory a DocumentBuilderFactory
-     */
-    private static void enableXInclude(final DocumentBuilderFactory factory) {
-        try {
-            // Alternative: We set if a system property on the command line is set, for example:
-            // -DLog4j.XInclude=true
-            factory.setXIncludeAware(true);
-        } 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 (final ParserConfigurationException e) {
-            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, err);
-        }
-        try {
-            factory.setFeature(XINCLUDE_FIXUP_LANGUAGE, true);
-        } catch (final ParserConfigurationException e) {
-            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, err);
-        }
-    }
-
-    public GemFireXmlConfiguration(final ConfigurationSource configSource) {
-        super(configSource);
-        final File configFile = configSource.getFile();
-        byte[] buffer = null;
-
-        try {
-            final InputStream configStream = configSource.getInputStream();
-            try {
-                buffer = toByteArray(configStream);
-            } finally {
-                Closer.closeSilently(configStream);
-            }
-            final InputSource source = new InputSource(new ByteArrayInputStream(buffer));
-            source.setSystemId(configSource.getLocation());
-            final Document document = newDocumentBuilder().parse(source);
-            rootElement = document.getDocumentElement();
-            final Map<String, String> attrs = processAttributes(rootNode, rootElement);
-            final StatusConfiguration statusConfig = new StatusConfiguration().withVerboseClasses(VERBOSE_CLASSES)
-                    .withStatus(getDefaultStatus());
-            for (final Map.Entry<String, String> entry : attrs.entrySet()) {
-                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)) {
-                    PluginManager.addPackages(Arrays.asList(value.split(Patterns.COMMA_SEPARATOR)));
-                } 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) {
-                        // GEMFIRE: this is where we can inject our own asynchronous background
thread for monitor config file changes
-                        monitor = new com.gemstone.org.apache.logging.log4j.core.config.GemFireFileConfigurationMonitor(this,
configFile, listeners, interval);
-                    }
-                } else if ("advertiser".equalsIgnoreCase(key)) {
-                    createAdvertiser(value, configSource, buffer, "text/xml");
-                }
-            }
-            statusConfig.initialize();
-        } catch (final SAXException domEx) {
-            LOGGER.error("Error parsing {}", configSource.getLocation(), domEx);
-        } catch (final IOException ioe) {
-            LOGGER.error("Error parsing {}", configSource.getLocation(), ioe);
-        } catch (final ParserConfigurationException pex) {
-            LOGGER.error("Error parsing {}", configSource.getLocation(), pex);
-        }
-        if (strict && schema != null && buffer != null) {
-            InputStream is = null;
-            try {
-                is = Loader.getResourceAsStream(schema, GemFireXmlConfiguration.class.getClassLoader());
-            } catch (final Exception ex) {
-                LOGGER.error("Unable to access schema {}", this.schema, ex);
-            }
-            if (is != null) {
-                final Source src = new StreamSource(is, LOG4J_XSD);
-                final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-                Schema schema = null;
-                try {
-                    schema = factory.newSchema(src);
-                } catch (final SAXException ex) {
-                    LOGGER.error("Error parsing Log4j schema", ex);
-                }
-                if (schema != null) {
-                    final Validator validator = schema.newValidator();
-                    try {
-                        validator.validate(new StreamSource(new ByteArrayInputStream(buffer)));
-                    } catch (final IOException ioe) {
-                        LOGGER.error("Error reading configuration for validation", ioe);
-                    } catch (final SAXException ex) {
-                        LOGGER.error("Error validating configuration", ex);
-                    }
-                }
-            }
-        }
-
-        if (getName() == null) {
-            setName(configSource.getLocation());
-        }
-    }
-
-    @Override
-    public void setup() {
-        if (rootElement == null) {
-            LOGGER.error("No logging configuration");
-            return;
-        }
-        constructHierarchy(rootNode, rootElement);
-        if (status.size() > 0) {
-            for (final Status s : status) {
-                LOGGER.error("Error processing element {}: {}", s.name, s.errorType);
-            }
-            return;
-        }
-        rootElement = null;
-    }
-
-    @Override
-    public Configuration reconfigure() {
-        try {
-            final ConfigurationSource source = getConfigurationSource().resetInputStream();
-            if (source == null) {
-                return null;
-            }
-            final GemFireXmlConfiguration config = new GemFireXmlConfiguration(source);
-            return (config.rootElement == null) ? null : config;
-        } catch (final IOException ex) {
-            LOGGER.error("Cannot locate file {}", getConfigurationSource(), ex);
-        }
-        return null;
-    }
-
-    private void constructHierarchy(final Node node, final Element element) {
-        processAttributes(node, element);
-        final StringBuilder buffer = new StringBuilder();
-        final NodeList list = element.getChildNodes();
-        final List<Node> children = node.getChildren();
-        for (int i = 0; i < list.getLength(); i++) {
-            final org.w3c.dom.Node w3cNode = list.item(i);
-            if (w3cNode instanceof Element) {
-                final Element child = (Element) w3cNode;
-                final String name = getType(child);
-                final PluginType<?> type = pluginManager.getPluginType(name);
-                final Node childNode = new Node(node, name, type);
-                constructHierarchy(childNode, child);
-                if (type == null) {
-                    final String value = childNode.getValue();
-                    if (!childNode.hasChildren() && value != null) {
-                        node.getAttributes().put(name, value);
-                    } else {
-                        status.add(new Status(name, element, ErrorType.CLASS_NOT_FOUND));
-                    }
-                } else {
-                    children.add(childNode);
-                }
-            } else if (w3cNode instanceof Text) {
-                final Text data = (Text) w3cNode;
-                buffer.append(data.getData());
-            }
-        }
-
-        final String text = buffer.toString().trim();
-        if (text.length() > 0 || (!node.hasChildren() && !node.isRoot())) {
-            node.setValue(text);
-        }
-    }
-
-    private String getType(final Element element) {
-        if (strict) {
-            final NamedNodeMap attrs = element.getAttributes();
-            for (int i = 0; i < attrs.getLength(); ++i) {
-                final org.w3c.dom.Node w3cNode = attrs.item(i);
-                if (w3cNode instanceof Attr) {
-                    final Attr attr = (Attr) w3cNode;
-                    if (attr.getName().equalsIgnoreCase("type")) {
-                        final String type = attr.getValue();
-                        attrs.removeNamedItem(attr.getName());
-                        return type;
-                    }
-                }
-            }
-        }
-        return element.getTagName();
-    }
-
-    private Map<String, String> processAttributes(final Node node, final Element element)
{
-        final NamedNodeMap attrs = element.getAttributes();
-        final Map<String, String> attributes = node.getAttributes();
-
-        for (int i = 0; i < attrs.getLength(); ++i) {
-            final org.w3c.dom.Node w3cNode = attrs.item(i);
-            if (w3cNode instanceof Attr) {
-                final Attr attr = (Attr) w3cNode;
-                if (attr.getName().equals("xml:base")) {
-                    continue;
-                }
-                attributes.put(attr.getName(), attr.getValue());
-            }
-        }
-        return attributes;
-    }
-
-    @Override
-    public String toString() {
-        return getClass().getSimpleName() + "[location=" + getConfigurationSource() + "]";
-    }
-
-    /**
-     * The error that occurred.
-     */
-    private enum ErrorType {
-        CLASS_NOT_FOUND
-    }
-
-    /**
-     * Status for recording errors.
-     */
-    private static class Status {
-        private final Element element;
-        private final String name;
-        private final ErrorType errorType;
-
-        public Status(final String name, final Element element, final ErrorType errorType)
{
-            this.name = name;
-            this.element = element;
-            this.errorType = errorType;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a097fcf3/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/xml/GemFireXmlConfigurationFactory.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/xml/GemFireXmlConfigurationFactory.java
b/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/xml/GemFireXmlConfigurationFactory.java
deleted file mode 100644
index 4e9d7af..0000000
--- a/gemfire-core/src/main/java/com/gemstone/org/apache/logging/log4j/core/config/xml/GemFireXmlConfigurationFactory.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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 com.gemstone.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.ConfigurationSource;
-import org.apache.logging.log4j.core.config.Order;
-import org.apache.logging.log4j.core.config.plugins.Plugin;
-
-/**
- * Factory to construct an XmlConfiguration.
- */
-@Plugin(name = "GemFireXmlConfigurationFactory", category = "ConfigurationFactory")
-@Order(1)
-public class GemFireXmlConfigurationFactory extends ConfigurationFactory {
-
-    static {
-        //System.out.println("KIRK: loading GemFireXmlConfigurationFactory");
-    }
-  
-    /**
-     * Valid file extensions for XML files.
-     */
-    public static final String[] SUFFIXES = new String[] {".xml", "*"};
-
-    /**
-     * Returns the Configuration.
-     * @param source The InputSource.
-     * @return The Configuration.
-     */
-    @Override
-    public Configuration getConfiguration(final ConfigurationSource source) {
-        return new com.gemstone.org.apache.logging.log4j.core.config.xml.GemFireXmlConfiguration(source);
-    }
-
-    /**
-     * Returns the file suffixes for XML files.
-     * @return An array of File extensions.
-     */
-    @Override
-    public String[] getSupportedTypes() {
-        return SUFFIXES;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a097fcf3/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
index 9eb51c5..b7167bc 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
@@ -93,6 +93,7 @@ public class CompressionCacheConfigDUnitTest extends CacheTestCase {
    * @throws Exception
    */
   public void testCreateCacheWithBadCompressor() throws Exception {
+    addExpectedException("Unable to load class BAD_COMPRESSOR");
     File cacheXml = createCacheXml(BAD_COMPRESSOR);
     ExpectedException expectedException = DistributedTestCase.addExpectedException("While
reading Cache XML file");
     try {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a097fcf3/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java
index a002389..6d75f80 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java
@@ -28,12 +28,10 @@ import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
-import org.apache.logging.log4j.util.PropertiesUtil;
 
 import com.gemstone.gemfire.internal.FileUtil;
 import com.gemstone.gemfire.internal.logging.LoggingPerformanceTestCase;
 import com.gemstone.gemfire.internal.util.IOUtils;
-import com.gemstone.org.apache.logging.log4j.core.config.xml.GemFireXmlConfigurationFactory;
 
 public class Log4J2PerformanceTest extends LoggingPerformanceTestCase {
 
@@ -44,15 +42,6 @@ public class Log4J2PerformanceTest extends LoggingPerformanceTestCase {
   protected static final String SYS_LOG_FILE_SIZE_LIMIT = "gemfire-log-file-size-limit";
   protected static final String SYS_LOG_FILE_COUNT_LIMIT = "gemfire-log-file-count-limit";
   
-  static {
-    // set log4j.configurationFactory to be our optimized version
-    final String factory = GemFireXmlConfigurationFactory.class.getName();
-    System.setProperty(ConfigurationFactory.CONFIGURATION_FACTORY_PROPERTY, factory);
-    System.out.println("Set "+ConfigurationFactory.CONFIGURATION_FACTORY_PROPERTY+" to "+factory);
-    final String factoryClass = PropertiesUtil.getProperties().getStringProperty(ConfigurationFactory.CONFIGURATION_FACTORY_PROPERTY);
-    System.out.println("KIRK: factoryClass is " + factoryClass);
-  }
-  
   private File config = null;
   
   public Log4J2PerformanceTest(String name) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a097fcf3/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java
index 61b5131..506e487 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java
@@ -27,12 +27,10 @@ import org.apache.commons.io.FileUtils;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
-import org.apache.logging.log4j.util.PropertiesUtil;
 
 import com.gemstone.gemfire.internal.FileUtil;
 import com.gemstone.gemfire.internal.logging.LoggingPerformanceTestCase;
 import com.gemstone.gemfire.internal.util.IOUtils;
-import com.gemstone.org.apache.logging.log4j.core.config.xml.GemFireXmlConfigurationFactory;
 
 public class LogWriterLoggerPerformanceTest extends LoggingPerformanceTestCase {
 
@@ -43,15 +41,6 @@ public class LogWriterLoggerPerformanceTest extends LoggingPerformanceTestCase
{
   protected static final String SYS_LOG_FILE_SIZE_LIMIT = "gemfire-log-file-size-limit";
   protected static final String SYS_LOG_FILE_COUNT_LIMIT = "gemfire-log-file-count-limit";
   
-  static {
-    // set log4j.configurationFactory to be our optimized version
-    final String factory = GemFireXmlConfigurationFactory.class.getName();
-    System.setProperty(ConfigurationFactory.CONFIGURATION_FACTORY_PROPERTY, factory);
-    System.out.println("Set "+ConfigurationFactory.CONFIGURATION_FACTORY_PROPERTY+" to "+factory);
-    final String factoryClass = PropertiesUtil.getProperties().getStringProperty(ConfigurationFactory.CONFIGURATION_FACTORY_PROPERTY);
-    System.out.println("KIRK: factoryClass is " + factoryClass);
-  }
-  
   private File config = null;
   
   public LogWriterLoggerPerformanceTest(String name) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a097fcf3/gemfire-core/src/test/java/dunit/standalone/DUnitLauncher.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/dunit/standalone/DUnitLauncher.java b/gemfire-core/src/test/java/dunit/standalone/DUnitLauncher.java
index 72c33d6..6433389 100644
--- a/gemfire-core/src/test/java/dunit/standalone/DUnitLauncher.java
+++ b/gemfire-core/src/test/java/dunit/standalone/DUnitLauncher.java
@@ -242,7 +242,7 @@ public class DUnitLauncher {
         LogManager.getLogger(LogService.BASE_LOGGER_NAME)).getContext();
 
     final PatternLayout layout = PatternLayout.createLayout(
-        "[%level{lowerCase=true} %date{yyyy/MM/dd HH:mm:ss.SSS z} <%thread> tid=%tid]
%message%n%throwable%n", null, null,
+        "[%level{lowerCase=true} %date{yyyy/MM/dd HH:mm:ss.SSS z} <%thread> tid=%tid]
%message%n%throwable%n", null, null,null,
         Charset.defaultCharset(), true, false, "", "");
     
     final FileAppender fileAppender = FileAppender.createAppender(suspectFilename, "true",
"false",

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a097fcf3/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index 30a7fd8..0bbbccd 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -57,7 +57,7 @@ jna.version = 4.0.0
 json4s.version = 3.2.4
 junit.version = 4.12
 JUnitParams.version = 1.0.4
-log4j.version = 2.1
+log4j.version = 2.5
 lucene.version = 5.3.0
 mockito-core.version = 1.10.19
 multithreadedtc.version = 1.01



Mime
View raw message