Last change
on this file since 32549 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
|
Rev | Line | |
---|
[22085] | 1 | package org.greenstone.util;
|
---|
[13229] | 2 |
|
---|
| 3 | import java.io.BufferedReader;
|
---|
| 4 | import java.io.IOException;
|
---|
| 5 | import java.io.InputStream;
|
---|
| 6 | import java.io.InputStreamReader;
|
---|
| 7 |
|
---|
[13566] | 8 | import org.apache.log4j.*;
|
---|
| 9 |
|
---|
[31568] | 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.
|
---|
[29946] | 12 | class LogStreamGobbler{
|
---|
| 13 | static Logger logger = Logger.getLogger(org.greenstone.util.LogStreamGobbler.class.getName());
|
---|
[13229] | 14 |
|
---|
[13566] | 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 | }
|
---|
[13229] | 28 |
|
---|
[13566] | 29 |
|
---|
| 30 | public void logInfo(InputStream in){
|
---|
[13229] | 31 | try {
|
---|
[13566] | 32 | BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
---|
[13229] | 33 | String line = null;
|
---|
[13566] | 34 | while ((line = br.readLine()) != null){
|
---|
| 35 | logger.info(line);
|
---|
| 36 | }
|
---|
| 37 | } catch (IOException ioe) {
|
---|
| 38 | logger.error(ioe);
|
---|
| 39 | }
|
---|
[13229] | 40 | }
|
---|
| 41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.