01: /*
02: * Copyright 2001-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: import java.util.ArrayList;
19: import java.util.Iterator;
20: import java.util.List;
21: import java.util.logging.Handler;
22: import java.util.logging.LogRecord;
23:
24: /**
25: * <p>Test implementation of <code>java.util.logging.Handler</code>.</p>
26: *
27: * @author Craig R. McClanahan
28: * @version $Revision: 155426 $ $Date: 2005-02-26 13:10:49 +0000 (Sat, 26 Feb 2005) $
29: */
30:
31: public class TestHandler extends Handler {
32:
33: // ----------------------------------------------------- Instance Variables
34:
35: // The set of logged records for this handler
36: private List records = new ArrayList();
37:
38: // --------------------------------------------------------- Public Methods
39:
40: public Iterator records() {
41: return (records.iterator());
42: }
43:
44: // -------------------------------------------------------- Handler Methods
45:
46: public void close() {
47: }
48:
49: public void flush() {
50: records.clear();
51: }
52:
53: public void publish(LogRecord record) {
54: records.add(record);
55: }
56:
57: }
|