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 package org.apache.commons.logging.jdk14;
17
18
19 import java.util.ArrayList;
20 import java.util.Iterator;
21 import java.util.List;
22 import java.util.logging.Handler;
23 import java.util.logging.LogRecord;
24
25
26 /***
27 * <p>Test implementation of <code>java.util.logging.Handler</code>.</p>
28 *
29 * @author Craig R. McClanahan
30 * @version $Revision: 155426 $ $Date: 2005-02-26 13:10:49 +0000 (Sat, 26 Feb 2005) $
31 */
32
33 public class TestHandler extends Handler {
34
35
36
37 // ----------------------------------------------------- Instance Variables
38
39
40 // The set of logged records for this handler
41 private List records = new ArrayList();
42
43
44 // --------------------------------------------------------- Public Methods
45
46
47 public Iterator records() {
48 return (records.iterator());
49 }
50
51
52 // -------------------------------------------------------- Handler Methods
53
54
55 public void close() {
56 }
57
58
59 public void flush() {
60 records.clear();
61 }
62
63
64 public void publish(LogRecord record) {
65 records.add(record);
66 }
67
68
69 }