Last change
on this file since 31568 was 31568, checked in by ak19, 7 years ago |
Clarifying the name of an old class
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.2 KB
|
Line | |
---|
1 | package org.greenstone.util;
|
---|
2 |
|
---|
3 | import java.io.BufferedReader;
|
---|
4 | import java.io.IOException;
|
---|
5 | import java.io.InputStream;
|
---|
6 | import java.io.InputStreamReader;
|
---|
7 |
|
---|
8 | import org.apache.log4j.*;
|
---|
9 |
|
---|
10 | // The LogStreamGobbler class, despite the name, is not connected to Input- and OutputStreamGobbler
|
---|
11 | // classes. This class has to do with logging and not with thread based input/output streams.
|
---|
12 | class LogStreamGobbler{
|
---|
13 | static Logger logger = Logger.getLogger(org.greenstone.util.LogStreamGobbler.class.getName());
|
---|
14 |
|
---|
15 | public static void logError(InputStream in)
|
---|
16 | {
|
---|
17 | try {
|
---|
18 | BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
---|
19 | String line = null;
|
---|
20 | //using null as a guard doesn't work on windows
|
---|
21 | while ((line = br.readLine()) != null){
|
---|
22 | logger.error(line);
|
---|
23 | }
|
---|
24 | } catch (IOException ioe) {
|
---|
25 | logger.error(ioe);
|
---|
26 | }
|
---|
27 | }
|
---|
28 |
|
---|
29 |
|
---|
30 | public void logInfo(InputStream in){
|
---|
31 | try {
|
---|
32 | BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
---|
33 | String line = null;
|
---|
34 | while ((line = br.readLine()) != null){
|
---|
35 | logger.info(line);
|
---|
36 | }
|
---|
37 | } catch (IOException ioe) {
|
---|
38 | logger.error(ioe);
|
---|
39 | }
|
---|
40 | }
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.