Class AbstractLogger

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.lang.Runnable
    Direct Known Subclasses:
    ObjectRecorder, SequenceGrapher

    public abstract class AbstractLogger
    extends java.lang.Thread
    implements java.lang.AutoCloseable
    This is a common super class for all classes which do a kind of logging. It provides an OutputStream and guarantees that this stream is closed at least at shutdown.
    1.3.1 (07.09.2013)
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

    • Constructor Summary

      Modifier Constructor Description
      protected AbstractLogger​( ostream)
      Instantiates a new abstract logger.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the stream with the logged objects.
      protected static createTempLogFile​(java.lang.String prefix, java.lang.String suffix)
      Creates a file in the temp directory.
      protected getLogStream()
      Gets the log stream.
      void run()
      This method is called at shutdown to close the open stream.
      java.lang.String toString()
      To string.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractLogger

        protected AbstractLogger​( ostream)
        Instantiates a new abstract logger.
        ostream - the ostream
    • Method Detail

      • createTempLogFile

        protected static createTempLogFile​(java.lang.String prefix,
                                                        java.lang.String suffix)
        Creates a file in the temp directory. If this was not successful a file prefix + suffix is returned as result.
        prefix - the prefix
        suffix - the suffix
        the file
      • getLogStream

        protected final getLogStream()
        Gets the log stream.
        the logStream
      • run

        public void run()
        This method is called at shutdown to close the open stream. Otherwise the closing "</object-stream>" tag in the generated file would be missing (it is generated by the used XStream library).
        Specified by:
        run in interface java.lang.Runnable
        run in class java.lang.Thread
        See Also:
      • close

        public void close()
        Closes the stream with the logged objects.
        Specified by:
        close in interface java.lang.AutoCloseable
      • toString

        public java.lang.String toString()
        To string.
        toString in class java.lang.Thread
        the string
        See Also: