You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2012/09/18 07:34:01 UTC
svn commit: r1386992 - in /logging/log4j/log4j2/trunk:
api/src/main/java/org/apache/logging/log4j/
api/src/main/java/org/apache/logging/log4j/message/
core/src/main/java/org/apache/logging/log4j/core/
core/src/main/java/org/apache/logging/log4j/core/ap...
Author: rgoers
Date: Tue Sep 18 05:34:00 2012
New Revision: 1386992
URL: http://svn.apache.org/viewvc?rev=1386992&view=rev
Log:
Fix checkstyle bugs
Modified:
logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Marker.java
logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/message/StringFormattedMessage.java
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AsynchAppender.java
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Reconfigurable.java
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/ResolverUtil.java
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/BasicConfigurator.java
logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java
Modified: logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Marker.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Marker.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Marker.java (original)
+++ logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/Marker.java Tue Sep 18 05:34:00 2012
@@ -48,7 +48,7 @@ public interface Marker extends Serializ
/**
* Checks whether this Marker is an instance of the specified Marker.
- * @param m The Marker name to check.
+ * @param name The name of the Marker.
* @return true of this Marker or one of its ancestors matches the specified name, false otherwise.
*/
boolean isInstanceOf(String name);
Modified: logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/message/StringFormattedMessage.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/message/StringFormattedMessage.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/message/StringFormattedMessage.java (original)
+++ logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/message/StringFormattedMessage.java Tue Sep 18 05:34:00 2012
@@ -27,7 +27,7 @@ import java.util.Arrays;
import java.util.IllegalFormatException;
/**
- * Handles messages that consist of a format string conforming to java.util.Formatter
+ * Handles messages that consist of a format string conforming to java.util.Formatter.
*/
public class StringFormattedMessage implements Message, Serializable {
@@ -152,7 +152,7 @@ public class StringFormattedMessage impl
out.writeInt(argArray.length);
stringArgs = new String[argArray.length];
int i = 0;
- for (Object obj: argArray) {
+ for (Object obj : argArray) {
stringArgs[i] = obj.toString();
++i;
}
@@ -164,7 +164,7 @@ public class StringFormattedMessage impl
messagePattern = in.readUTF();
int length = in.readInt();
stringArgs = new String[length];
- for (int i=0; i < length; ++i) {
+ for (int i = 0; i < length; ++i) {
stringArgs[i] = in.readUTF();
}
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java Tue Sep 18 05:34:00 2012
@@ -54,11 +54,19 @@ public class LoggerContext implements or
private final URI configLocation;
+ /**
+ * Status of the LoggerContext.
+ */
public enum Status {
+ /** Initialized but not yet started. */
INITIALIZED,
+ /** In the process of starting. */
STARTING,
+ /** Is active. */
STARTED,
+ /** Shutdown is in progress. */
STOPPING,
+ /** Has shutdown. */
STOPPED
}
@@ -276,6 +284,7 @@ public class LoggerContext implements or
/**
* Cause a reconfiguration to take place when the underlying configuration file changes.
+ * @param reconfigurable The Configuration that can be reconfigured.
*/
public synchronized void onChange(Reconfigurable reconfigurable) {
logger.debug("Reconfiguration started for context " + contextName);
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java Tue Sep 18 05:34:00 2012
@@ -40,16 +40,18 @@ public abstract class AbstractManager {
private static Lock lock = new ReentrantLock();
- private String name;
-
+ /**
+ * Number of Appenders using this manager.
+ */
protected int count;
+ private String name;
+
protected AbstractManager(String name) {
this.name = name;
LOGGER.debug("Starting {} {}", this.getClass().getSimpleName(), name);
}
-
/**
* Retrieves a Manager if it has been previously created or creates a new Manager.
* @param name The name of the Manager to retrieve.
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AsynchAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AsynchAppender.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AsynchAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AsynchAppender.java Tue Sep 18 05:34:00 2012
@@ -45,6 +45,9 @@ import java.util.concurrent.BlockingQueu
@Plugin(name = "Asynch", type = "Core", elementType = "appender", printObject = true)
public final class AsynchAppender extends AppenderBase {
+ private static final int DEFAULT_QUEUE_SIZE = 128;
+ private static final String SHUTDOWN = "Shutdown";
+
private final BlockingQueue<Serializable> queue;
private final boolean blocking;
private final Configuration config;
@@ -53,9 +56,6 @@ public final class AsynchAppender extend
private AppenderControl errorAppender = null;
private AsynchThread thread = null;
- private static final int DEFAULT_QUEUE_SIZE = 128;
- private static final String SHUTDOWN = "Shutdown";
-
private AsynchAppender(String name, Filter filter, AppenderRef[] appenderRefs, String errorRef,
int queueSize, boolean blocking,
boolean handleExceptions, Configuration config) {
@@ -85,7 +85,7 @@ public final class AsynchAppender extend
LOGGER.error("Unable to set up error Appender. No appender named {} was configured", errorRef);
}
}
- if (appenders.size() > 0 ) {
+ if (appenders.size() > 0) {
thread = new AsynchThread(appenders, queue);
} else if (errorRef == null) {
throw new ConfigurationException("No appenders are available for AsynchAppender " + getName());
@@ -168,9 +168,13 @@ public final class AsynchAppender extend
boolean handleExceptions = suppress == null ? true : Boolean.valueOf(suppress);
- return new AsynchAppender(name, filter, appenderRefs, errorRef, queueSize, isBlocking, handleExceptions, config);
+ return new AsynchAppender(name, filter, appenderRefs, errorRef, queueSize, isBlocking, handleExceptions,
+ config);
}
+ /**
+ * Thread that calls the Appenders.
+ */
private class AsynchThread extends Thread {
private volatile boolean shutdown = false;
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java Tue Sep 18 05:34:00 2012
@@ -221,7 +221,7 @@ public abstract class ConfigurationFacto
LOGGER.error("Invalid URL " + configLocation.toString(), ex);
} catch (IOException ex) {
LOGGER.error("Unable to access " + configLocation.toString(), ex);
- } catch (Exception ex){
+ } catch (Exception ex) {
LOGGER.error("Unable to access " + configLocation.toString(), ex);
}
return null;
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java Tue Sep 18 05:34:00 2012
@@ -47,6 +47,7 @@ public class FileConfigurationMonitor im
/**
* 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 30 seconds.
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Reconfigurable.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Reconfigurable.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Reconfigurable.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Reconfigurable.java Tue Sep 18 05:34:00 2012
@@ -1,3 +1,19 @@
+/*
+ * 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;
/**
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/ResolverUtil.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/ResolverUtil.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/ResolverUtil.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/ResolverUtil.java Tue Sep 18 05:34:00 2012
@@ -74,14 +74,14 @@ public class ResolverUtil<T> {
/** An instance of Log to use for logging in this class. */
private static final Logger LOG = StatusLogger.getLogger();
+ private static final String VFSZIP = "vfszip";
+
/** The set of matches being accumulated. */
private Set<Class<? extends T>> classMatches = new HashSet<Class<?extends T>>();
/** The set of matches being accumulated. */
private Set<URI> resourceMatches = new HashSet<URI>();
- private static final String VFSZIP = "vfszip";
-
/**
* The ClassLoader to use when looking for classes. If null then the ClassLoader returned
* by Thread.currentThread().getContextClassLoader() will be used.
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/filter/MarkerFilter.java Tue Sep 18 05:34:00 2012
@@ -18,7 +18,6 @@ package org.apache.logging.log4j.core.fi
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.MarkerManager;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.config.plugins.Plugin;
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java Tue Sep 18 05:34:00 2012
@@ -25,7 +25,6 @@ import org.apache.logging.log4j.core.con
import org.apache.logging.log4j.core.config.plugins.PluginFactory;
import org.apache.logging.log4j.core.helpers.OptionConverter;
import org.apache.logging.log4j.core.pattern.LogEventPatternConverter;
-import org.apache.logging.log4j.core.pattern.PatternConverter;
import org.apache.logging.log4j.core.pattern.PatternFormatter;
import org.apache.logging.log4j.core.pattern.PatternParser;
import org.apache.logging.log4j.core.pattern.RegexReplacement;
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java Tue Sep 18 05:34:00 2012
@@ -56,7 +56,7 @@ public class Interpolator implements Str
}
public Interpolator() {
- this.defaultLookup= new MapLookup(new HashMap<String, String>());
+ this.defaultLookup = new MapLookup(new HashMap<String, String>());
lookups.put("sys", new SystemPropertiesLookup());
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java Tue Sep 18 05:34:00 2012
@@ -17,7 +17,6 @@
package org.apache.logging.log4j.core.pattern;
import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.plugins.PluginManager;
import org.apache.logging.log4j.core.config.plugins.PluginType;
Modified: logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/BasicConfigurator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/BasicConfigurator.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/BasicConfigurator.java (original)
+++ logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/BasicConfigurator.java Tue Sep 18 05:34:00 2012
@@ -17,7 +17,7 @@
package org.apache.log4j;
/**
- * Provided for compatibility with Log4j 1.x
+ * Provided for compatibility with Log4j 1.x.
*/
public class BasicConfigurator {
Modified: logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java?rev=1386992&r1=1386991&r2=1386992&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java (original)
+++ logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java Tue Sep 18 05:34:00 2012
@@ -34,10 +34,20 @@ public class Log4jContextListener implem
*/
public static final String LOG4J_CONTEXT_ATTRIBUTE = "Log4JContext";
+ /**
+ * The location of the configuration.
+ */
public static final String LOG4J_CONFIG = "log4jConfiguration";
+ /**
+ * The name of the LoggerContext.
+ */
public static final String LOG4J_CONTEXT_NAME = "log4jContextName";
+ /**
+ * Initialize Logging for the web application.
+ * @param event The ServletContextEvent.
+ */
public void contextInitialized(ServletContextEvent event) {
ServletContext context = event.getServletContext();
String locn = context.getInitParameter(LOG4J_CONFIG);
@@ -52,6 +62,10 @@ public class Log4jContextListener implem
context.setAttribute(LOG4J_CONTEXT_ATTRIBUTE, Configurator.initialize(name, getClassLoader(context), locn));
}
+ /**
+ * Shutdown logging for the web application.
+ * @param event The ServletContextEvent.
+ */
public void contextDestroyed(ServletContextEvent event) {
LoggerContext ctx = (LoggerContext) event.getServletContext().getAttribute(LOG4J_CONTEXT_ATTRIBUTE);
Configurator.shutdown(ctx);