Package org.yamcs.logging
Class WatchedFileHandler
java.lang.Object
java.util.logging.Handler
org.yamcs.logging.WatchedFileHandler
File handler that watches the file it is logging to. If the file changes, it gets closed and reopened with the same
filename.
This handler is useful for when log rotation is to be handled outside of the standard Java Logging system, for example with a program like logrotate. Without the watch-functionality it would keep writing to the old (rotated) file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()getLevel()booleanisLoggable(LogRecord record) voidvoidsetEncoding(String encoding) voidvoidvoidsetFormatter(Formatter newFormatter) voidMethods inherited from class java.util.logging.Handler
reportError
-
Constructor Details
-
WatchedFileHandler
- Throws:
IOException
-
-
Method Details
-
publish
-
flush
public void flush() -
close
- Specified by:
closein classHandler- Throws:
SecurityException
-
setEncoding
- Overrides:
setEncodingin classHandler- Throws:
SecurityExceptionUnsupportedEncodingException
-
setFormatter
- Overrides:
setFormatterin classHandler- Throws:
SecurityException
-
setErrorManager
- Overrides:
setErrorManagerin classHandler
-
setFilter
- Overrides:
setFilterin classHandler- Throws:
SecurityException
-
setLevel
- Overrides:
setLevelin classHandler- Throws:
SecurityException
-
isLoggable
- Overrides:
isLoggablein classHandler
-
getEncoding
- Overrides:
getEncodingin classHandler
-
getErrorManager
- Overrides:
getErrorManagerin classHandler
-
getFilter
-
getLevel
-
getFormatter
- Overrides:
getFormatterin classHandler
-