Class Overview
A handler that writes log messages to the standard output stream
System.err
.
This handler reads the following properties from the log manager to
initialize itself:
- java.util.logging.ConsoleHandler.level specifies the logging level,
defaults to
Level.INFO
if this property is not found or has an
invalid value.
- java.util.logging.ConsoleHandler.filter specifies the name of the filter
class to be associated with this handler, defaults to
null
if this
property is not found or has an invalid value.
- java.util.logging.ConsoleHandler.formatter specifies the name of the
formatter class to be associated with this handler, defaults to
java.util.logging.SimpleFormatter
if this property is not found or
has an invalid value.
- java.util.logging.ConsoleHandler.encoding specifies the encoding this
handler will use to encode log messages, defaults to
null
if this
property is not found or has an invalid value.
This class is not thread-safe.
Summary
Public Constructors |
|
ConsoleHandler()
Constructs a ConsoleHandler object.
|
Public Methods |
void
|
close()
Closes this handler.
|
void
|
publish(LogRecord record)
Logs a record if necessary.
|
[Expand]
Inherited Methods |
From class
java.util.logging.StreamHandler
|
From class
java.util.logging.Handler
abstract
void
|
close()
Closes this handler.
|
abstract
void
|
flush()
Flushes any buffered output.
|
String
|
getEncoding()
Gets the character encoding used by this handler, null for
default encoding.
|
ErrorManager
|
getErrorManager()
Gets the error manager used by this handler to report errors during
logging.
|
Filter
|
getFilter()
Gets the filter used by this handler.
|
Formatter
|
getFormatter()
Gets the formatter used by this handler to format the logging messages.
|
Level
|
getLevel()
Gets the logging level of this handler, records with levels lower than
this value will be dropped.
|
boolean
|
isLoggable(LogRecord record)
Determines whether the supplied log record needs to be logged.
|
abstract
void
|
publish(LogRecord record)
Accepts a logging request and sends it to the the target.
|
void
|
reportError(String msg, Exception ex, int code)
Reports an error to the error manager associated with this handler,
ErrorManager is used for that purpose.
|
void
|
setEncoding(String charsetName)
Sets the character encoding used by this handler, null indicates
a default encoding.
|
void
|
setErrorManager(ErrorManager newErrorManager)
Sets the error manager for this handler.
|
void
|
setFilter(Filter newFilter)
Sets the filter to be used by this handler.
|
void
|
setFormatter(Formatter newFormatter)
Sets the formatter to be used by this handler.
|
void
|
setLevel(Level newLevel)
Sets the logging level of the messages logged by this handler, levels
lower than this value will be dropped.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
Public Constructors
public
ConsoleHandler
()
Constructs a ConsoleHandler
object.
Public Methods
public
void
close
()
Closes this handler. The System.err
is flushed but not closed.
public
void
publish
(LogRecord record)
Logs a record if necessary. A flush operation will be done.
Parameters
record
| the log record to be logged.
|