Package org.apache.logging.log4j.status
Class StatusConsoleListener
java.lang.Object
org.apache.logging.log4j.status.StatusConsoleListener
- All Implemented Interfaces:
Closeable,AutoCloseable,EventListener,StatusListener
A
StatusListener that writes to the console.-
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. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Resets the level and output stream to its initial values, and closes the output stream, if it is a non-system one.Returns the level for which the listener should receive events.voidlog(StatusData data) Writes status messages to the console.voidsetFilters(String... filters) Deprecated.since 2.23.0, this method is ineffective and only kept for binary backward compatibility.voidSets the level to a new value.voidsetStream(PrintStream stream) Sets the output stream to a new value.
-
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
-
-
Method Details
-
setLevel
Sets the level to a new value.- Parameters:
level- the new level- Throws:
NullPointerException- on nulllevel
-
setStream
Sets the output stream to a new value.- Parameters:
stream- the new output stream- Throws:
NullPointerException- on nullstream- Since:
- 2.23.0
-
getStatusLevel
Returns the 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- a status data- Throws:
NullPointerException- on nulldata
-
setFilters
Deprecated.since 2.23.0, this method is ineffective and only kept for binary backward compatibility.Adds package name filters to exclude.- Parameters:
filters- An array of package names to exclude.
-
close
public void close()Resets the level and output stream to its initial values, and closes the output stream, if it is a non-system one.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-