public final class LogUtil
extends java.lang.Object
java.util.logging-related utility methods.| Modifier and Type | Field and Description |
|---|---|
static java.util.logging.Level |
INFO_PLUS_1
A
Level one higher (towards Level.WARNING) than Level.INFO. |
static java.util.logging.Filter |
LESS_THAN_CONFIG
Regards levels less than
Level.CONFIG (e.g. |
static java.util.logging.Filter |
LESS_THAN_INFO
Regards levels less than
Level.INFO (e.g. |
static java.util.logging.Filter |
LESS_THAN_WARNING
Regards levels less than
Level.WARNING (e.g. |
static java.util.logging.LogManager |
LOG_MANAGER
An alternative to repeated calls to
LogManager.getLogManager(). |
static java.util.logging.Logger |
ROOT_LOGGER
Is
Logger.getLogger(""). |
static java.util.logging.Level |
WARNING_PLUS_1
A
Level one higher (towards Level.SEVERE) than Level.WARNING. |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Boolean |
getLoggingProperty(java.lang.String propertyName,
java.lang.Boolean defaulT) |
static <T> T |
getLoggingProperty(java.lang.String propertyName,
java.lang.Class<T> type)
Evaluates the value of the named property to an object of the given
type and returns it. |
static <T> T |
getLoggingProperty(java.lang.String propertyName,
java.lang.Class<T> type,
T defaulT)
Evaluates the value of the named property to an object of the given
type and returns it, or the
defaulT. |
static java.util.logging.Level |
getLoggingProperty(java.lang.String propertyName,
java.util.logging.Level defaulT) |
static long |
getLoggingProperty(java.lang.String propertyName,
java.lang.Long defaulT) |
static java.lang.String |
getLoggingProperty(java.lang.String propertyName,
java.lang.String defaulT) |
static java.util.logging.Filter |
levelLimitFilter(java.util.logging.Level upperBound) |
static Consumer<java.lang.String> |
logConsumer(java.util.logging.Logger logger,
java.util.logging.Level level,
java.lang.String prefix)
Strings passed to the returned
Consumer are logged to the given logger at the given level. |
static java.io.Writer |
logWriter(java.util.logging.Logger logger,
java.util.logging.Level level,
java.lang.String prefix)
Lines written to the returned
Writer are optionally prepended with the given prefix, and then logged
to the given Logger at the given Level. |
static Expression |
parseLoggingProperty(java.lang.String propertyName,
Predicate<? super java.lang.String> isValidVariableNames)
Parses an expression from the value of the named logging property.
|
static java.lang.String |
requireLoggingProperty(java.lang.String propertyName) |
public static final java.util.logging.LogManager LOG_MANAGER
LogManager.getLogManager().public static final java.util.logging.Logger ROOT_LOGGER
Logger.getLogger("").public static final java.util.logging.Level WARNING_PLUS_1
Level one higher (towards Level.SEVERE) than Level.WARNING.public static final java.util.logging.Level INFO_PLUS_1
Level one higher (towards Level.WARNING) than Level.INFO.public static final java.util.logging.Filter LESS_THAN_WARNING
Level.WARNING (e.g. INFO, CONFIG, FINE, FINER, FINEST) as loggable.public static final java.util.logging.Filter LESS_THAN_INFO
Level.INFO (e.g. CONFIG, FINE, FINER, FINEST) as loggable.public static final java.util.logging.Filter LESS_THAN_CONFIG
Level.CONFIG (e.g. FINE, FINER, FINEST) as loggable.public static Consumer<java.lang.String> logConsumer(java.util.logging.Logger logger, java.util.logging.Level level, @Nullable java.lang.String prefix)
Consumer are logged to the given logger at the given level.prefix - Is prepended to each string before it is loggedpublic static java.io.Writer logWriter(java.util.logging.Logger logger,
java.util.logging.Level level,
@Nullable
java.lang.String prefix)
Writer are optionally prepended with the given prefix, and then logged
to the given Logger at the given Level.public static java.util.logging.Filter levelLimitFilter(java.util.logging.Level upperBound)
Filter that regards levels lower than upperBound as loggablepublic static java.lang.Boolean getLoggingProperty(java.lang.String propertyName,
java.lang.Boolean defaulT)
defaulTpublic static <T> T getLoggingProperty(java.lang.String propertyName,
java.lang.Class<T> type)
throws ParseException,
EvaluationException
type and returns it.java.lang.IllegalArgumentException - The logging property is not definedEvaluationException - The property evaluates to nullEvaluationException - The value of the property is not assignable to TParseException@Nullable public static <T> T getLoggingProperty(java.lang.String propertyName, java.lang.Class<T> type, @Nullable T defaulT) throws ParseException, EvaluationException
type and returns it, or the
defaulT.public static java.util.logging.Level getLoggingProperty(java.lang.String propertyName,
java.util.logging.Level defaulT)
defaulTjava.lang.IllegalArgumentException - The value could not be parsed to a valid levelpublic static long getLoggingProperty(java.lang.String propertyName,
java.lang.Long defaulT)
defaulTjava.lang.IllegalArgumentException - The property text cannot be parsed into a LONG@Nullable public static java.lang.String getLoggingProperty(java.lang.String propertyName, @Nullable java.lang.String defaulT)
defaulTpublic static java.lang.String requireLoggingProperty(java.lang.String propertyName)
java.lang.IllegalArgumentException - The named logging property is not definedpublic static Expression parseLoggingProperty(java.lang.String propertyName, Predicate<? super java.lang.String> isValidVariableNames) throws ParseException
java.lang.IllegalArgumentException - The named logging property is not definedParseException