Package gov.nih.mipav.view
Class LogStdStreams
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.PrintStream
gov.nih.mipav.view.LogStdStreams
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
Title:
Description:
Copyright: Copyright (c) 2003
Company:
- Version:
- 1.0
- Author:
- not attributable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static StringThe name of the output log file.static LogStdStreamsThe only instance of this class.private static booleanTrue if System.Out is being redirected.private static final PrintStreamDOCUMENT ME!private static final PrintStreamDOCUMENT ME!Fields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateLogStdStreams(FileOutputStream logFile, boolean logStdOut) Private constructor to create PrintStream an redirect standard streams. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringGet the name of the logfile.static PrintStreamGet the PrintStream being used for this logfile.static voidinitializeErrorLogging(String fileName) The static initialization method
Also redirects System.out, rewrites output file.static voidinitializeErrorLogging(String fileName, String initialStr) The static initialization method which writes heading
Also redirects System.out, rewrites output file.static voidinitializeErrorLogging(String fileName, String initialStr, boolean logStdOut) The static initialization method which writes heading
Rewrites output file.static voidinitializeErrorLogging(String fileName, String initialStr, boolean logStdOut, boolean append) The static initialization method.static booleanIs the System.Out being redirected to this logfile.static voidDOCUMENT ME!Methods inherited from class java.io.PrintStream
append, append, append, charset, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, writeBytesMethods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
logFileName
The name of the output log file. -
logStream
The only instance of this class. -
stdSystemErr
DOCUMENT ME! -
stdSystemOut
DOCUMENT ME! -
redirectSystemOut
private static boolean redirectSystemOutTrue if System.Out is being redirected.
-
-
Constructor Details
-
LogStdStreams
Private constructor to create PrintStream an redirect standard streams.- Parameters:
logFile- the file output stream to uselogStdOut- true if the System.out to be redirected also
-
-
Method Details
-
getLogFileName
Get the name of the logfile.- Returns:
- true if System.Out is being redirected
- Throws:
RuntimeException- if initializeErrorLogging() has not been called yet
-
getLogStream
Get the PrintStream being used for this logfile.- Returns:
- the PrintStream System.err is being redirected to
- Throws:
RuntimeException- if initializeErrorLogging() has not been called yet
-
initializeErrorLogging
The static initialization method
Also redirects System.out, rewrites output file.- Parameters:
fileName- the name of the log file
-
initializeErrorLogging
The static initialization method which writes heading
Also redirects System.out, rewrites output file.- Parameters:
fileName- the name of the log fileinitialStr- the heading string to write to the log file when opened
-
initializeErrorLogging
The static initialization method which writes heading
Rewrites output file.- Parameters:
fileName- the name of the log fileinitialStr- the heading string to write to the log file when openedlogStdOut- true if System.Out to redirected to log file also
-
initializeErrorLogging
public static void initializeErrorLogging(String fileName, String initialStr, boolean logStdOut, boolean append) The static initialization method.- Parameters:
fileName- the name of the log fileinitialStr- the heading string to write to the log file when openedlogStdOut- true if System.Out to redirected to log file alsoappend- true if to append to existing log, false to rewrite new log.- Throws:
RuntimeException- if initializeErrorLogging() has already been called yet
-
isSystemOutRedirected
public static boolean isSystemOutRedirected()Is the System.Out being redirected to this logfile.- Returns:
- true if System.Out is being redirected
- Throws:
RuntimeException- if initializeErrorLogging() has not been called yet
-
turnOffLogging
public static void turnOffLogging()DOCUMENT ME!
-