01: /*
02: * Copyright 1999-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:
17: package org.apache.tomcat.util.log;
18:
19: import java.io.ByteArrayOutputStream;
20: import java.io.PrintStream;
21:
22: /**
23: * Per Thread System.err and System.out log capture data.
24: *
25: * @author Glenn L. Nielsen
26: */
27:
28: class CaptureLog {
29:
30: protected CaptureLog() {
31: baos = new ByteArrayOutputStream();
32: ps = new PrintStream(baos);
33: }
34:
35: private ByteArrayOutputStream baos;
36: private PrintStream ps;
37:
38: protected PrintStream getStream() {
39: return ps;
40: }
41:
42: protected void reset() {
43: baos.reset();
44: }
45:
46: protected String getCapture() {
47: return baos.toString();
48: }
49: }
|