public final class SecureFileHandler
extends java.util.logging.FileHandler
FileHandler
subclass which overrides security-sensitive
methods with safe implementations for secure file logging.Constructor and Description |
---|
SecureFileHandler(java.lang.String pattern,
int limit,
int count,
boolean append,
java.util.logging.Level level,
java.util.logging.Formatter formatter)
Constructor which uses the superclass' constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Override the superclass' implementation to do nothing.
|
(package private) void |
doClose()
Flush and close all files by invoking the superclass'
close() method. |
java.util.logging.ErrorManager |
getErrorManager()
Override the superclass' implementation to return
null . |
java.util.logging.Filter |
getFilter()
Override the superclass' implementation to return
null . |
void |
setEncoding(java.lang.String encoding)
Override the superclass' implementation to do nothing.
|
void |
setErrorManager(java.util.logging.ErrorManager em)
Override the superclass' implementation to do nothing.
|
void |
setFilter(java.util.logging.Filter newFilter)
Override the superclass' implementation to do nothing.
|
void |
setFormatter(java.util.logging.Formatter newFormatter)
Override the superclass' implementation to do nothing.
|
void |
setLevel(java.util.logging.Level newLevel)
Override the superclass' implementation to do nothing.
|
public SecureFileHandler(java.lang.String pattern, int limit, int count, boolean append, java.util.logging.Level level, java.util.logging.Formatter formatter) throws java.io.IOException, java.lang.SecurityException
pattern
- The pattern for naming the output file.limit
- The maximum number of bytes to write to any one file.count
- The maximum number of files to create.append
- true
to append to a file, else false
.level
- The permanent log level of this handler.formatter
- The formatter to be used to format log messages. Since
Handler.getFormatter()
cannot be overridden with a
do-nothing implementation here, this formatter must be
immutable to prevent a security risk.java.io.IOException
- if there is any I/O problem opening the file.java.lang.SecurityException
- if a security manager exists and if the caller does not have
LoggingPermission("control")
.public void setLevel(java.util.logging.Level newLevel) throws java.lang.SecurityException
setLevel
in class java.util.logging.Handler
newLevel
- The new logging level.java.lang.SecurityException
public void setFormatter(java.util.logging.Formatter newFormatter) throws java.lang.SecurityException
setFormatter
in class java.util.logging.Handler
newFormatter
- The Formatter
to use (may not be null).java.lang.SecurityException
public java.util.logging.Filter getFilter()
null
.getFilter
in class java.util.logging.Handler
null
.public void setFilter(java.util.logging.Filter newFilter) throws java.lang.SecurityException
setFilter
in class java.util.logging.Handler
newFilter
- Not used.java.lang.SecurityException
public java.util.logging.ErrorManager getErrorManager()
null
.getErrorManager
in class java.util.logging.Handler
null
.public void setErrorManager(java.util.logging.ErrorManager em)
setErrorManager
in class java.util.logging.Handler
em
- Not used.public void setEncoding(java.lang.String encoding) throws java.lang.SecurityException, java.io.UnsupportedEncodingException
setEncoding
in class java.util.logging.StreamHandler
encoding
- Not used.java.lang.SecurityException
java.io.UnsupportedEncodingException
public void close()
close
in class java.util.logging.FileHandler
doClose()
void doClose()
close()
method. This method is package private to ensure
only authorized callers can close the file handler.