Class StatusConfiguration
- java.lang.Object
-
- org.apache.logging.log4j.core.config.status.StatusConfiguration
-
public class StatusConfiguration extends java.lang.ObjectConfiguration for setting upStatusConsoleListenerinstances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStatusConfiguration.VerbositySpecifies how verbose the StatusLogger should be.
-
Field Summary
Fields Modifier and Type Field Description private static LevelDEFAULT_STATUSprivate static java.io.PrintStreamDEFAULT_STREAMprivate static StatusConfiguration.VerbosityDEFAULT_VERBOSITYprivate java.io.PrintStreamdestinationprivate java.util.Collection<java.lang.String>errorMessagesprivate booleaninitializedprivate StatusLoggerloggerprivate Levelstatusprivate java.lang.String[]verboseClassesprivate StatusConfiguration.Verbosityverbosity
-
Constructor Summary
Constructors Constructor Description StatusConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanconfigureExistingStatusConsoleListener()voiderror(java.lang.String message)Logs an error message to the StatusLogger.voidinitialize()Configures and initializes the StatusLogger using the configured options in this instance.private voidmigrateSavedLogMessages()private java.io.PrintStreamparseStreamName(java.lang.String name)private voidregisterNewStatusConsoleListener()StatusConfigurationwithDestination(java.lang.String destination)Specifies the destination for StatusLogger events.StatusConfigurationwithStatus(java.lang.String status)Specifies the logging level by name to use for filtering StatusLogger messages.StatusConfigurationwithStatus(Level status)Specifies the logging level to use for filtering StatusLogger messages.StatusConfigurationwithVerboseClasses(java.lang.String... verboseClasses)Specifies which class names to filter if the configured verbosity level is QUIET.StatusConfigurationwithVerbosity(java.lang.String verbosity)Specifies the verbosity level to log at.
-
-
-
Field Detail
-
DEFAULT_STREAM
private static final java.io.PrintStream DEFAULT_STREAM
-
DEFAULT_STATUS
private static final Level DEFAULT_STATUS
-
DEFAULT_VERBOSITY
private static final StatusConfiguration.Verbosity DEFAULT_VERBOSITY
-
errorMessages
private final java.util.Collection<java.lang.String> errorMessages
-
logger
private final StatusLogger logger
-
initialized
private volatile boolean initialized
-
destination
private java.io.PrintStream destination
-
status
private Level status
-
verbosity
private StatusConfiguration.Verbosity verbosity
-
verboseClasses
private java.lang.String[] verboseClasses
-
-
Method Detail
-
error
public void error(java.lang.String message)
Logs an error message to the StatusLogger. If the StatusLogger hasn't been set up yet, queues the message to be logged after initialization.- Parameters:
message- error message to log.
-
withDestination
public StatusConfiguration withDestination(java.lang.String destination)
Specifies the destination for StatusLogger events. This can beout(default) for usingstandard out,errfor usingstandard error, or a file URI to which log events will be written. If the provided URI is invalid, then the default destination of standard out will be used.- Parameters:
destination- where status log messages should be output.- Returns:
this
-
parseStreamName
private java.io.PrintStream parseStreamName(java.lang.String name) throws java.net.URISyntaxException, java.io.FileNotFoundException- Throws:
java.net.URISyntaxExceptionjava.io.FileNotFoundException
-
withStatus
public StatusConfiguration withStatus(java.lang.String status)
Specifies the logging level by name to use for filtering StatusLogger messages.- Parameters:
status- name of logger level to filter below.- Returns:
this- See Also:
Level
-
withStatus
public StatusConfiguration withStatus(Level status)
Specifies the logging level to use for filtering StatusLogger messages.- Parameters:
status- logger level to filter below.- Returns:
this
-
withVerbosity
public StatusConfiguration withVerbosity(java.lang.String verbosity)
Specifies the verbosity level to log at. This only applies to classes configured byverboseClasses.- Parameters:
verbosity- basic filter for status logger messages.- Returns:
this
-
withVerboseClasses
public StatusConfiguration withVerboseClasses(java.lang.String... verboseClasses)
Specifies which class names to filter if the configured verbosity level is QUIET.- Parameters:
verboseClasses- names of classes to filter if not using VERBOSE.- Returns:
this
-
initialize
public void initialize()
Configures and initializes the StatusLogger using the configured options in this instance.
-
configureExistingStatusConsoleListener
private boolean configureExistingStatusConsoleListener()
-
registerNewStatusConsoleListener
private void registerNewStatusConsoleListener()
-
migrateSavedLogMessages
private void migrateSavedLogMessages()
-
-