1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */ 
16  
17  package org.apache.commons.logging.log4j;
18  
19  
20  import java.util.ArrayList;
21  import java.util.Iterator;
22  import java.util.List;
23  import org.apache.log4j.AppenderSkeleton;
24  import org.apache.log4j.spi.LoggingEvent;
25  
26  
27  /***
28   * <p>Test implementation of <code>org.apache.log4j.Appender</code>.</p>
29   *
30   * @author Craig R. McClanahan
31   * @version $Revision: 1.4 $ $Date: 2004/02/28 21:46:46 $
32   */
33  
34  public class TestAppender extends AppenderSkeleton {
35  
36  
37  
38      // ----------------------------------------------------- Instance Variables
39  
40  
41      // The set of logged events for this appender
42      private List events = new ArrayList();
43  
44  
45      // --------------------------------------------------------- Public Methods
46  
47  
48      public Iterator events() {
49          return (events.iterator());
50      }
51  
52  
53      public void flush() {
54          events.clear();
55      }
56  
57  
58      // ------------------------------------------------------- Appender Methods
59  
60  
61      protected void append(LoggingEvent event) {
62          events.add(event);
63      }
64  
65  
66      public void close() {
67      }
68  
69  
70      public boolean requiresLayout() {
71          return (false);
72      }
73  
74  
75  }