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 TypeMethodDescriptionvoid
close()
void
flush()
getLevel()
boolean
isLoggable
(LogRecord record) void
void
setEncoding
(String encoding) void
void
void
setFormatter
(Formatter newFormatter) void
Methods inherited from class java.util.logging.Handler
reportError
-
Constructor Details
-
WatchedFileHandler
- Throws:
IOException
-
-
Method Details
-
publish
-
flush
public void flush() -
close
- Specified by:
close
in classHandler
- Throws:
SecurityException
-
setEncoding
- Overrides:
setEncoding
in classHandler
- Throws:
SecurityException
UnsupportedEncodingException
-
setFormatter
- Overrides:
setFormatter
in classHandler
- Throws:
SecurityException
-
setErrorManager
- Overrides:
setErrorManager
in classHandler
-
setFilter
- Overrides:
setFilter
in classHandler
- Throws:
SecurityException
-
setLevel
- Overrides:
setLevel
in classHandler
- Throws:
SecurityException
-
isLoggable
- Overrides:
isLoggable
in classHandler
-
getEncoding
- Overrides:
getEncoding
in classHandler
-
getErrorManager
- Overrides:
getErrorManager
in classHandler
-
getFilter
-
getLevel
-
getFormatter
- Overrides:
getFormatter
in classHandler
-