You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2004/11/15 18:33:37 UTC
cvs commit: logging-log4j/src/java/org/apache/log4j/varia ListAppender.java
ceki 2004/11/15 09:33:37
Modified: src/java/org/apache/log4j/varia ListAppender.java
Log:
- Removed the no longer used requiresLayout method.
- Jalopu indentation.
Revision Changes Path
1.2 +63 -71 logging-log4j/src/java/org/apache/log4j/varia/ListAppender.java
Index: ListAppender.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/varia/ListAppender.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ListAppender.java 18 Oct 2004 22:16:35 -0000 1.1
+++ ListAppender.java 15 Nov 2004 17:33:37 -0000 1.2
@@ -1,92 +1,84 @@
/*
* Copyright 1999,2004 The Apache Software Foundation.
- *
- * Licensed 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
- *
+ *
+ * Licensed 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.
+ * 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.log4j.varia;
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.spi.LoggingEvent;
+
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.AppenderSkeleton;
-import org.apache.log4j.spi.LoggingEvent;
/**
* A very basic appender that takes the events and stores them in to a
* java.util.List for late retrieval.
- *
+ *
* Note: This implemenation intentionally does not allow direct modification
* of the internal List model to reduce the synchronization complexity that this would
- * require.
- *
+ * require.
+ *
* @see org.apache.log4j.varia.ListModelAppender
- *
+ *
* @author Paul Smith <ps...@apache.org>
- *
+ *
*/
public final class ListAppender extends AppenderSkeleton {
- private final List model = new ArrayList();
+ private final List model = new ArrayList();
- /**
- * Returns a writeable, BUT cloned List of all the LoggingEvents that are contained
- * in the internal model. You are free to modify this list without
- * worry of synchronization, but note that any modifications to the returned list
- * that you do will have NO impact on the internal model of this Appender.
- *
- * @return Modifiable List
- */
- public final List getModel() {
- synchronized(model) {
- return new ArrayList(model);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.log4j.AppenderSkeleton#append(org.apache.log4j.spi.LoggingEvent)
- */
- protected void append(LoggingEvent event) {
- synchronized(model) {
- model.add(event);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.log4j.Appender#close()
- */
- public void close() {
- clearModel();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.log4j.Appender#requiresLayout()
- */
- public boolean requiresLayout() {
- return false;
- }
-
- /**
- * Removes all the Events from the model
- */
- public void clearModel() {
- synchronized (model) {
- model.clear();
- }
- }
+ /**
+ * Returns a writeable, BUT cloned List of all the LoggingEvents that are contained
+ * in the internal model. You are free to modify this list without
+ * worry of synchronization, but note that any modifications to the returned list
+ * that you do will have NO impact on the internal model of this Appender.
+ *
+ * @return Modifiable List
+ */
+ public final List getList() {
+ synchronized (model) {
+ return new ArrayList(model);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.log4j.AppenderSkeleton#append(org.apache.log4j.spi.LoggingEvent)
+ */
+ protected void append(LoggingEvent event) {
+ synchronized (model) {
+ model.add(event);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.log4j.Appender#close()
+ */
+ public void close() {
+ clearModel();
+ }
+
+ /**
+ * Removes all the Events from the model
+ */
+ public void clearModel() {
+ synchronized (model) {
+ model.clear();
+ }
+ }
}
-
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org