Package org.apache.logging.log4j.status
Class StatusConsoleListener
java.lang.Object
org.apache.logging.log4j.status.StatusConsoleListener
- All Implemented Interfaces:
Closeable
,AutoCloseable
,EventListener
,StatusListener
StatusListener that writes to the Console.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStatusConsoleListener
(Level level) Creates the StatusConsoleListener using the supplied Level.StatusConsoleListener
(Level level, PrintStream stream) Creates the StatusConsoleListener using the supplied Level. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
private boolean
filtered
(StatusData data) 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
Sets the level to a new value.
-
Field Details
-
level
-
filters
-
stream
-
-
Constructor Details
-
StatusConsoleListener
Creates the StatusConsoleListener using the supplied Level.- Parameters:
level
- The Level of status messages that should appear on the console.
-
StatusConsoleListener
Creates the StatusConsoleListener using the supplied Level. Make sure not to use a logger stream of some sort to avoid creating an infinite loop of indirection!- Parameters:
level
- The Level of status messages that should appear on the console.stream
- The PrintStream to write to.- Throws:
IllegalArgumentException
- if the PrintStream argument isnull
.
-
-
Method Details
-
setLevel
Sets the level to a new value.- Parameters:
level
- The new Level.
-
getStatusLevel
Return the Log Level for which the Listener should receive events.- Specified by:
getStatusLevel
in interfaceStatusListener
- Returns:
- the Log Level.
-
log
Writes status messages to the console.- Specified by:
log
in interfaceStatusListener
- Parameters:
data
- The StatusData.
-
setFilters
Adds package name filters to exclude.- Parameters:
filters
- An array of package names to exclude.
-
filtered
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-