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:
java.io.Closeable
,java.io.Flushable
,java.lang.Appendable
,java.lang.AutoCloseable
public class LogStdStreams extends java.io.PrintStream
Title:
Description:
Copyright: Copyright (c) 2003
Company:
- Version:
- 1.0
- Author:
- not attributable
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
logFileName
The name of the output log file.static LogStdStreams
logStream
The only instance of this class.private static boolean
redirectSystemOut
True if System.Out is being redirected.private static java.io.PrintStream
stdSystemErr
DOCUMENT ME!private static java.io.PrintStream
stdSystemOut
DOCUMENT ME!
-
Constructor Summary
Constructors Modifier Constructor Description private
LogStdStreams(java.io.FileOutputStream logFile, boolean logStdOut)
Private constructor to create PrintStream an redirect standard streams.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getLogFileName()
Get the name of the logfile.static java.io.PrintStream
getLogStream()
Get the PrintStream being used for this logfile.static void
initializeErrorLogging(java.lang.String fileName)
The static initialization method
Also redirects System.out, rewrites output file.static void
initializeErrorLogging(java.lang.String fileName, java.lang.String initialStr)
The static initialization method which writes heading
Also redirects System.out, rewrites output file.static void
initializeErrorLogging(java.lang.String fileName, java.lang.String initialStr, boolean logStdOut)
The static initialization method which writes heading
Rewrites output file.static void
initializeErrorLogging(java.lang.String fileName, java.lang.String initialStr, boolean logStdOut, boolean append)
The static initialization method.static boolean
isSystemOutRedirected()
Is the System.Out being redirected to this logfile.static void
turnOffLogging()
DOCUMENT ME!-
Methods inherited from class java.io.PrintStream
append, append, append, 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
-
-
-
-
Field Detail
-
logFileName
private static java.lang.String logFileName
The name of the output log file.
-
logStream
public static LogStdStreams logStream
The only instance of this class.
-
stdSystemErr
private static final java.io.PrintStream stdSystemErr
DOCUMENT ME!
-
stdSystemOut
private static final java.io.PrintStream stdSystemOut
DOCUMENT ME!
-
redirectSystemOut
private static boolean redirectSystemOut
True if System.Out is being redirected.
-
-
Method Detail
-
getLogFileName
public static java.lang.String getLogFileName()
Get the name of the logfile.- Returns:
- true if System.Out is being redirected
- Throws:
java.lang.RuntimeException
- if initializeErrorLogging() has not been called yet
-
getLogStream
public static java.io.PrintStream getLogStream()
Get the PrintStream being used for this logfile.- Returns:
- the PrintStream System.err is being redirected to
- Throws:
java.lang.RuntimeException
- if initializeErrorLogging() has not been called yet
-
initializeErrorLogging
public static void initializeErrorLogging(java.lang.String fileName)
The static initialization method
Also redirects System.out, rewrites output file.- Parameters:
fileName
- the name of the log file
-
initializeErrorLogging
public static void initializeErrorLogging(java.lang.String fileName, java.lang.String initialStr)
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
public static void initializeErrorLogging(java.lang.String fileName, java.lang.String initialStr, boolean logStdOut)
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(java.lang.String fileName, java.lang.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:
java.lang.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:
java.lang.RuntimeException
- if initializeErrorLogging() has not been called yet
-
turnOffLogging
public static void turnOffLogging()
DOCUMENT ME!
-
-