Methods Summary |
---|
void | checkAccess()
if (sealed) {
manager.checkAccess();
}
|
public abstract void | close()Close the Handler and free all associated resources.
The close method will perform a flush and then close the
Handler. After close has been called this Handler
should no longer be used. Method calls may either be silently
ignored or may throw runtime exceptions.
|
public abstract void | flush()Flush any buffered output.
|
public java.lang.String | getEncoding()Return the character encoding for this Handler.
return encoding;
|
public java.util.logging.ErrorManager | getErrorManager()Retrieves the ErrorManager for this Handler.
checkAccess();
return errorManager;
|
public java.util.logging.Filter | getFilter()Get the current Filter for this Handler.
return filter;
|
public java.util.logging.Formatter | getFormatter()Return the Formatter for this Handler.
return formatter;
|
public synchronized java.util.logging.Level | getLevel()Get the log level specifying which messages will be
logged by this Handler. Message levels lower
than this level will be discarded.
return logLevel;
|
public boolean | isLoggable(java.util.logging.LogRecord record)Check if this Handler would actually log a given LogRecord.
This method checks if the LogRecord has an appropriate
Level and whether it satisfies any Filter. It also
may make other Handler specific checks that might prevent a
handler from logging the LogRecord. It will return false if
the LogRecord is Null.
int levelValue = getLevel().intValue();
if (record.getLevel().intValue() < levelValue || levelValue == offValue) {
return false;
}
Filter filter = getFilter();
if (filter == null) {
return true;
}
return filter.isLoggable(record);
|
public abstract void | publish(java.util.logging.LogRecord record)Publish a LogRecord.
The logging request was made initially to a Logger object,
which initialized the LogRecord and forwarded it here.
The Handler is responsible for formatting the message, when and
if necessary. The formatting should include localization.
|
protected void | reportError(java.lang.String msg, java.lang.Exception ex, int code)Protected convenience method to report an error to this Handler's
ErrorManager. Note that this method retrieves and uses the ErrorManager
without doing a security check. It can therefore be used in
environments where the caller may be non-privileged.
try {
errorManager.error(msg, ex, code);
} catch (Exception ex2) {
System.err.println("Handler.reportError caught:");
ex2.printStackTrace();
}
|
public void | setEncoding(java.lang.String encoding)Set the character encoding used by this Handler.
The encoding should be set before any LogRecords are written
to the Handler.
checkAccess();
if (encoding != null) {
try {
if(!java.nio.charset.Charset.isSupported(encoding)) {
throw new UnsupportedEncodingException(encoding);
}
} catch (java.nio.charset.IllegalCharsetNameException e) {
throw new UnsupportedEncodingException(encoding);
}
}
this.encoding = encoding;
|
public void | setErrorManager(java.util.logging.ErrorManager em)Define an ErrorManager for this Handler.
The ErrorManager's "error" method will be invoked if any
errors occur while using this Handler.
checkAccess();
if (em == null) {
throw new NullPointerException();
}
errorManager = em;
|
public void | setFilter(java.util.logging.Filter newFilter)Set a Filter to control output on this Handler.
For each call of publish the Handler will call
this Filter (if it is non-null) to check if the
LogRecord should be published or discarded.
checkAccess();
filter = newFilter;
|
public void | setFormatter(java.util.logging.Formatter newFormatter)Set a Formatter. This Formatter will be used
to format LogRecords for this Handler.
Some Handlers may not use Formatters, in
which case the Formatter will be remembered, but not used.
checkAccess();
// Check for a null pointer:
newFormatter.getClass();
formatter = newFormatter;
|
public synchronized void | setLevel(java.util.logging.Level newLevel)Set the log level specifying which message levels will be
logged by this Handler. Message levels lower than this
value will be discarded.
The intention is to allow developers to turn on voluminous
logging, but to limit the messages that are sent to certain
Handlers.
if (newLevel == null) {
throw new NullPointerException();
}
checkAccess();
logLevel = newLevel;
|