Package wsh.util

Class CleanHandler


  • public class CleanHandler
    extends java.util.logging.Handler
    An alternative to ConsoleHandler. Uses CleanFormatter and System.out instead of SimpleFormatter and System.err
    • Constructor Summary

      Constructors 
      Constructor Description
      CleanHandler()
      Construct a new CleanHandler.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void addGlobalLogFile​(java.lang.String fileName)
      All CleanHandlers will also log to this file.
      void close()  
      void flush()  
      static void main​(java.lang.String[] args)
      Test code
      static void overrideExistingHandlers​(java.util.logging.Level level)
      Override any previously specified Handlers with the CleanHandler, and set Level.
      void publish​(java.util.logging.LogRecord record)  
      static void setDefaultHandler()
      If the user has not specified a java property for the global Handler, then set the default global handler to this CleanHandler at an INFO level.
      static void testLogger()
      Call this from your code to test each type of log message
      • Methods inherited from class java.util.logging.Handler

        getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
      • Methods inherited from class java.lang.Object

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

      • CleanHandler

        public CleanHandler()
        Construct a new CleanHandler.
    • Method Detail

      • addGlobalLogFile

        public static void addGlobalLogFile​(java.lang.String fileName)
                                     throws java.io.FileNotFoundException
        All CleanHandlers will also log to this file.
        Parameters:
        fileName - Name of file to log to.
        Throws:
        java.io.FileNotFoundException - if file not found
      • publish

        public void publish​(java.util.logging.LogRecord record)
        Specified by:
        publish in class java.util.logging.Handler
      • close

        public void close()
        Specified by:
        close in class java.util.logging.Handler
      • flush

        public void flush()
        Specified by:
        flush in class java.util.logging.Handler
      • testLogger

        public static void testLogger()
        Call this from your code to test each type of log message
      • main

        public static void main​(java.lang.String[] args)
        Test code
        Parameters:
        args - command line
      • setDefaultHandler

        public static void setDefaultHandler()
        If the user has not specified a java property for the global Handler, then set the default global handler to this CleanHandler at an INFO level.
      • overrideExistingHandlers

        public static void overrideExistingHandlers​(java.util.logging.Level level)
        Override any previously specified Handlers with the CleanHandler, and set Level.
        Parameters:
        level - Logging level for CleanHandler.