logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1175689 - in /logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core: ./ appender/ appender/flume/
Date Mon, 26 Sep 2011 06:36:34 GMT
Author: rgoers
Date: Mon Sep 26 06:36:33 2011
New Revision: 1175689

URL: http://svn.apache.org/viewvc?rev=1175689&view=rev
Log:
Fix javadoc and checkstyle errors

Modified:
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Layout.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/LoggingException.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderBase.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroManager.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/UUIDUtil.java

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Layout.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Layout.java?rev=1175689&r1=1175688&r2=1175689&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Layout.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/Layout.java
Mon Sep 26 06:36:33 2011
@@ -23,7 +23,7 @@ import java.io.Serializable;
  *  Would introduce an EventEncoder, EventRenderer or something similar for the logging event
to byte encoding.
  * (RG) A layout can be configured with a Charset and then Strings can be converted to byte
arrays. OTOH, it isn't
  * possible to write byte arrays as character streams.
- * @param T The Object type that will be returned on the formatAs call.
+ * @param <T> The Object type that will be returned on the formatAs call.
  */
 public interface Layout<T extends Serializable> {
     /**

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java?rev=1175689&r1=1175688&r2=1175689&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
Mon Sep 26 06:36:33 2011
@@ -35,6 +35,12 @@ import java.util.concurrent.ConcurrentMa
  */
 public class LoggerContext implements org.apache.logging.log4j.spi.LoggerContext, ConfigurationListener
{
 
+    private static StatusLogger logger = StatusLogger.getLogger();
+
+    private static final LoggerFactory<LoggerContext> FACTORY = new Factory();
+
+    private static final long JVM_START_TIME = System.currentTimeMillis();
+
     private final ConcurrentMap<String, Logger> loggers = new ConcurrentHashMap<String,
Logger>();
 
     /**
@@ -43,28 +49,35 @@ public class LoggerContext implements or
      */
     private volatile Configuration config;
 
-    private static StatusLogger logger = StatusLogger.getLogger();
-
-    private static final LoggerFactory<LoggerContext> FACTORY = new Factory();
-
     private Object externalContext = null;
 
-    private static final long JVM_START_TIME = System.currentTimeMillis();
-
     private final String contextName;
 
     private final URI configLocation;
 
-
+    /**
+     * Constructor taking only a name.
+     * @param name The context name.
+     */
     public LoggerContext(String name) {
         this(name, null, (URI) null);
     }
 
-
+    /**
+     * Constructor taking a name and a reference to an external context.
+     * @param name The context name.
+     * @param externalContext The external context.
+     */
     public LoggerContext(String name, Object externalContext) {
         this(name, externalContext, (URI) null);
     }
 
+    /**
+     * Constructor taking a name, external context and a configuration URI.
+     * @param name The context name.
+     * @param externalContext The external context.
+     * @param configLocn The location of the configuration as a URI.
+     */
     public LoggerContext(String name, Object externalContext, URI configLocn) {
         contextName = name;
         this.externalContext = externalContext;
@@ -72,6 +85,13 @@ public class LoggerContext implements or
         reconfigure();
     }
 
+    /**
+     * Constructor taking a name external context and a configuration location String. The
location
+     * must be resolvable to a File.
+     * @param name The configuration location.
+     * @param externalContext The external context.
+     * @param configLocn The configuration location.
+     */
     public LoggerContext(String name, Object externalContext, String configLocn) {
         contextName = name;
         this.externalContext = externalContext;
@@ -89,22 +109,45 @@ public class LoggerContext implements or
         reconfigure();
     }
 
+    /**
+     * The time the LoggerContext class was loaded as a long.
+     * @return The time the LoggerContext was loaded.
+     */
     public static long getStartTime() {
         return JVM_START_TIME;
     }
 
+    /**
+     * Set the external context.
+     * @param context The external context.
+     */
     public void setExternalContext(Object context) {
         this.externalContext = context;
     }
 
+    /**
+     * Return the external context.
+     * @return The external context.
+     */
     public Object getExternalContext() {
         return this.externalContext;
     }
 
+    /**
+     * Obtain a Logger from the Context.
+     * @param name The name of the Logger to return.
+     * @return The Logger.
+     */
     public Logger getLogger(String name) {
         return getLogger(FACTORY, name);
     }
 
+    /**
+     * Obtain a Logger from the Context using the specified LoggerFactory.
+     * @param factory The LoggerFactory.
+     * @param name The name of the Logger.
+     * @return The Logger.
+     */
     public Logger getLogger(LoggerFactory factory, String name) {
 
         Logger logger = loggers.get(name);
@@ -117,22 +160,43 @@ public class LoggerContext implements or
         return prev == null ? logger : prev;
     }
 
+    /**
+     * Determine if the specified Logger exists.
+     * @param name The Logger name to search for.
+     * @return True if the Logger exists, false otherwise.
+     */
     public boolean hasLogger(String name) {
         return loggers.containsKey(name);
     }
 
+    /**
+     * Return the current Configuration. The Configuration will be replaced when a reconfigure
occurs.
+     * @return The Configuration.
+     */
     public Configuration getConfiguration() {
         return config;
     }
 
+    /**
+     * Add a Filter to the Configuration. Filters that are added through the API will be
lost
+     * when a reconfigure occurs.
+     * @param filter The Filter to add.
+     */
     public void addFilter(Filter filter) {
         config.addFilter(filter);
     }
 
+    /**
+     * Removes a Filter from the current Configuration.
+     * @param filter The Filter to remove.
+     */
     public void removeFiler(Filter filter) {
         config.removeFilter(filter);
     }
 
+    /**
+     * Shutdown the logging system.
+     */
     public synchronized void shutdown() {
         updateLoggers(new NullConfiguration());
         config.stop();
@@ -141,6 +205,8 @@ public class LoggerContext implements or
 
     /**
      * Set the Configuration to be used.
+     * @param config The new Configuration.
+     * @return The previous Configuration.
      */
     public synchronized Configuration setConfiguration(Configuration config) {
         if (config == null) {
@@ -174,20 +240,33 @@ public class LoggerContext implements or
         logger.debug("Reconfiguration completed");
     }
 
+    /**
+     * Cause all Loggers to be updated against the current Configuration.
+     */
     public void updateLoggers() {
         updateLoggers(this.config);
     }
 
+    /**
+     * Cause all Logger to be updated against the specified Configuration.
+     * @param config The Configuration.
+     */
     public void updateLoggers(Configuration config) {
         for (Logger logger : loggers.values()) {
             logger.updateConfiguration(config);
         }
     }
 
+    /**
+     * Cause a reconfiguration to take place when the underlying configuration file changes.
+     */
     public void onChange() {
         reconfigure();
     }
 
+    /**
+     * The default LoggerFactory.
+     */
     private static class Factory implements LoggerFactory<LoggerContext> {
 
         public Logger newInstance(LoggerContext ctx, String name) {

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/LoggingException.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/LoggingException.java?rev=1175689&r1=1175688&r2=1175689&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/LoggingException.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/LoggingException.java
Mon Sep 26 06:36:33 2011
@@ -4,14 +4,14 @@
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache license, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
+ * the License. You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the license is distributed on an "AS IS" BASIS,
+ * 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
+ * See the license for the specific language governing permissions and
  * limitations under the license.
  */
 package org.apache.logging.log4j.core;
@@ -25,14 +25,29 @@ package org.apache.logging.log4j.core;
  */
 public class LoggingException extends RuntimeException {
 
+    private static final long serialVersionUID = 6366395965071580537L;
+
+    /**
+     * Constructs a LoggingException with a message.
+     * @param msg The message.
+     */
     public LoggingException(String msg) {
         super(msg);
     }
 
+    /**
+     * Constructs a LoggingException with a message and a chained Exception.
+     * @param msg The message.
+     * @param ex The chained Exception.
+     */
     public LoggingException(String msg, Exception ex) {
         super(msg, ex);
     }
 
+    /**
+     * Constructs a Logging Exception with a chained Exception and no message.
+     * @param ex The chained Exception.
+     */
     public LoggingException(Exception ex) {
         super(ex);
     }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java?rev=1175689&r1=1175688&r2=1175689&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
Mon Sep 26 06:36:33 2011
@@ -38,14 +38,20 @@ public abstract class AbstractManager {
     /**
      * Allow subclasses access to the status logger without creating another instance.
      */
-    protected static final Logger logger = StatusLogger.getLogger();
+    protected static Logger logger = StatusLogger.getLogger();
 
     private String name;
 
     private int count;
 
-    public StringBuilder buffer = new StringBuilder();
-
+    /**
+     * Retrieves a Manager if it has been previously created or creates a new Manager.
+     * @param name The name of the Manager to retrieve.
+     * @param factory The Factory to use to create the Manager.
+     * @param data An Object that should be passed to the factory when creating the Manager.
+     * @param <T> The Type of the Manager to be created.
+     * @return A Manager with the specified name and type.
+     */
     public static <T extends AbstractManager> T getManager(String name, ManagerFactory<T,
Object> factory,
                                                  Object data) {
         lock.lock();
@@ -65,6 +71,11 @@ public abstract class AbstractManager {
         }
     }
 
+    /**
+     * Determines if a Manager with the specified name exists.
+     * @param name The name of the Manager.
+     * @return True if the Manager exists, false otherwise.
+     */
     public static boolean hasManager(String name) {
         lock.lock();
         try {
@@ -78,12 +89,20 @@ public abstract class AbstractManager {
         this.name = name;
     }
 
-    public abstract void releaseSub();
+    /**
+     * May be overriden by Managers to perform processing while the Manager is being released
and the
+     * lock is held.
+     */
+    protected void releaseSub() {
+    }
 
     protected int getCount() {
         return count;
     }
 
+    /**
+     * Called to signify that this Manager is no longer required by an Appender.
+     */
     public void release() {
         lock.lock();
         try {
@@ -97,6 +116,10 @@ public abstract class AbstractManager {
         }
     }
 
+    /**
+     * Return the name of the Manager.
+     * @return The name of the Manager.
+     */
     public String getName() {
         return name;
     }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderBase.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderBase.java?rev=1175689&r1=1175688&r2=1175689&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderBase.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/AppenderBase.java
Mon Sep 26 06:36:33 2011
@@ -27,6 +27,7 @@ import org.apache.logging.log4j.status.S
 import org.apache.logging.log4j.Logger;
 
 /**
+ *
  * @doubt Appender should be refactored as mentioned elsewhere
  */
 public abstract class AppenderBase extends Filterable implements Appender, Lifecycle {

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroManager.java?rev=1175689&r1=1175688&r2=1175689&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroManager.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroManager.java
Mon Sep 26 06:36:33 2011
@@ -161,9 +161,6 @@ public class FlumeAvroManager extends Ab
         throw new AppenderRuntimeException("Unable to connect to any agents");
     }
 
-    public void releaseSub() {
-    }
-
     private FlumeEventAvroServer connect(String hostname, int port) {
         URL url;
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/UUIDUtil.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/UUIDUtil.java?rev=1175689&r1=1175688&r2=1175689&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/UUIDUtil.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/UUIDUtil.java
Mon Sep 26 06:36:33 2011
@@ -28,6 +28,10 @@ import java.util.Random;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicInteger;
 
+/**
+ * Generates a unique id. The generated UUID will be unique for approximately 8,925 years
so long as
+ * less than 4095 ids are generated per millisecond on the same device (as identified by
its MAC adddress).
+ */
 public abstract class UUIDUtil
 {
     private static AtomicInteger count = new AtomicInteger(0);



Mime
View raw message