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) Constructs aStatusConsoleListenerinstance writing toSystem.outusing the supplied level.StatusConsoleListener(Level level, PrintStream stream) Constructs aStatusConsoleListenerinstance using the supplied level and stream.StatusConsoleListener(Level level, PrintStream stream, SimpleLoggerFactory loggerFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()private booleanfiltered(StatusData data) Return the Log Level for which the Listener should receive events.voidlog(StatusData data) Writes status messages to the console.voidsetFilters(String... filters) Adds package name filters to exclude.voidSets the level to a new value.
-
Field Details
-
level
-
filters
-
stream
-
logger
-
-
Constructor Details
-
StatusConsoleListener
Constructs aStatusConsoleListenerinstance writing toSystem.outusing the supplied level.- Parameters:
level- the level of status messages that should appear on the console- Throws:
NullPointerException- on nulllevel
-
StatusConsoleListener
Constructs aStatusConsoleListenerinstance 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!
- Parameters:
level- the level of status messages that should appear on the consolestream- the stream to write to- Throws:
NullPointerException- on nulllevelorstream
-
StatusConsoleListener
StatusConsoleListener(Level level, PrintStream stream, SimpleLoggerFactory loggerFactory)
-
-
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:
getStatusLevelin interfaceStatusListener- Returns:
- the Log Level.
-
log
Writes status messages to the console.- Specified by:
login 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-