Class LogStdStreams

All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class LogStdStreams extends PrintStream

Title:

Description:

Copyright: Copyright (c) 2003

Company:

Version:
1.0
Author:
not attributable
  • Field Details

    • logFileName

      private static String logFileName
      The name of the output log file.
    • logStream

      public static LogStdStreams logStream
      The only instance of this class.
    • stdSystemErr

      private static final PrintStream stdSystemErr
      DOCUMENT ME!
    • stdSystemOut

      private static final PrintStream stdSystemOut
      DOCUMENT ME!
    • redirectSystemOut

      private static boolean redirectSystemOut
      True if System.Out is being redirected.
  • Constructor Details

    • LogStdStreams

      private LogStdStreams(FileOutputStream logFile, boolean logStdOut)
      Private constructor to create PrintStream an redirect standard streams.
      Parameters:
      logFile - the file output stream to use
      logStdOut - true if the System.out to be redirected also
  • Method Details

    • getLogFileName

      public static String 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

      public static PrintStream 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

      public static void initializeErrorLogging(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(String fileName, String initialStr)
      The static initialization method which writes heading
      Also redirects System.out, rewrites output file.
      Parameters:
      fileName - the name of the log file
      initialStr - the heading string to write to the log file when opened
    • initializeErrorLogging

      public static void initializeErrorLogging(String fileName, String initialStr, boolean logStdOut)
      The static initialization method which writes heading
      Rewrites output file.
      Parameters:
      fileName - the name of the log file
      initialStr - the heading string to write to the log file when opened
      logStdOut - 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 file
      initialStr - the heading string to write to the log file when opened
      logStdOut - true if System.Out to redirected to log file also
      append - 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!