public class StatusConsoleListener extends Object implements StatusListener
StatusListener
that writes to the console.Constructor and Description |
---|
StatusConsoleListener(Level level)
Constructs a
StatusConsoleListener instance writing to System.out using the supplied level. |
StatusConsoleListener(Level level,
PrintStream stream)
Constructs a
StatusConsoleListener instance using the supplied level and stream. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
Level |
getStatusLevel()
Return the Log Level for which the Listener should receive events.
|
void |
log(StatusData data)
Writes status messages to the console.
|
void |
setFilters(String... filters)
Adds package name filters to exclude.
|
void |
setLevel(Level level)
Sets the level to a new value.
|
public StatusConsoleListener(Level level)
StatusConsoleListener
instance writing to System.out
using the supplied level.level
- the level of status messages that should appear on the consoleNullPointerException
- on null level
public StatusConsoleListener(Level level, PrintStream stream)
StatusConsoleListener
instance using the supplied level and stream.
Make sure not to use a logger stream of some sort to avoid creating an infinite loop of indirection!
level
- the level of status messages that should appear on the consolestream
- the stream to write toNullPointerException
- on null level
or stream
public void setLevel(Level level)
level
- The new Level.public Level getStatusLevel()
getStatusLevel
in interface StatusListener
public void log(StatusData data)
log
in interface StatusListener
data
- The StatusData.public void setFilters(String... filters)
filters
- An array of package names to exclude.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.