Package wsh.util
Class CleanHandler
- java.lang.Object
-
- java.util.logging.Handler
-
- wsh.util.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 codestatic 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
-
-
-
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 classjava.util.logging.Handler
-
close
public void close()
- Specified by:
close
in classjava.util.logging.Handler
-
flush
public void flush()
- Specified by:
flush
in classjava.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.
-
-