Interface Logger
- All Known Subinterfaces:
FormatterLogger
Messages can be formatted by the Logger once the Logger determines the log
level is enabled. Use a left curly bracket ('{' \u007B)
followed by a right curly bracket ('}' \u007D) as a place
holder for an argument: "{}". If you need to use the literal
"{}" in the formatted message, precede the place holder with a
reverse solidus ('\' \u005C): "\{}". If you need to
place a backslash before the place holder, precede the reverse solidus with a
reverse solidus: "\\{}".
You can also add a Throwable and/or ServiceReference to the
generated LogEntry by passing them to the logging methods as
additional arguments. If the last argument is a Throwable or a
ServiceReference, it is added to the generated LogEntry and
then, if the next to last argument is a ServiceReference or
Throwable and not the same type as the last argument, it is also
added to the generated LogEntry. These arguments will not be used as
message arguments. For example:
logger.info("Found service {}.", serviceReference, serviceReference);
logger.warn("Something named {} happened.", name, serviceReference,
throwable);
logger.error("Failed.", exception);
- Since:
- 1.4
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidLog a message at theLogLevel.AUDITlevel.voidLog a formatted message at theLogLevel.AUDITlevel.voidLog a formatted message at theLogLevel.AUDITlevel.voidLog a formatted message at theLogLevel.AUDITlevel.voidLog a message at theLogLevel.DEBUGlevel.voidLog a formatted message at theLogLevel.DEBUGlevel.voidLog a formatted message at theLogLevel.DEBUGlevel.voidLog a formatted message at theLogLevel.DEBUGlevel.<E extends Exception>
voiddebug(LoggerConsumer<E> consumer) Perform the specified operation if logging enabled for theLogLevel.DEBUGlevel.voidLog a message at theLogLevel.ERRORlevel.voidLog a formatted message at theLogLevel.ERRORlevel.voidLog a formatted message at theLogLevel.ERRORlevel.voidLog a formatted message at theLogLevel.ERRORlevel.<E extends Exception>
voiderror(LoggerConsumer<E> consumer) Perform the specified operation if logging enabled for theLogLevel.ERRORlevel.getName()Return the name of this Logger.voidLog a message at theLogLevel.INFOlevel.voidLog a formatted message at theLogLevel.INFOlevel.voidLog a formatted message at theLogLevel.INFOlevel.voidLog a formatted message at theLogLevel.INFOlevel.<E extends Exception>
voidinfo(LoggerConsumer<E> consumer) Perform the specified operation if logging enabled for theLogLevel.INFOlevel.booleanIs logging enabled for theLogLevel.DEBUGlevel?booleanIs logging enabled for theLogLevel.ERRORlevel?booleanIs logging enabled for theLogLevel.INFOlevel?booleanIs logging enabled for theLogLevel.TRACElevel?booleanIs logging enabled for theLogLevel.WARNlevel?voidLog a message at theLogLevel.TRACElevel.voidLog a formatted message at theLogLevel.TRACElevel.voidLog a formatted message at theLogLevel.TRACElevel.voidLog a formatted message at theLogLevel.TRACElevel.<E extends Exception>
voidtrace(LoggerConsumer<E> consumer) Perform the specified operation if logging enabled for theLogLevel.TRACElevel.voidLog a message at theLogLevel.WARNlevel.voidLog a formatted message at theLogLevel.WARNlevel.voidLog a formatted message at theLogLevel.WARNlevel.voidLog a formatted message at theLogLevel.WARNlevel.<E extends Exception>
voidwarn(LoggerConsumer<E> consumer) Perform the specified operation if logging enabled for theLogLevel.WARNlevel.
-
Field Details
-
ROOT_LOGGER_NAME
Root Logger Name.- See Also:
-
-
Method Details
-
getName
String getName()Return the name of this Logger.- Returns:
- The name of this Logger.
-
isTraceEnabled
boolean isTraceEnabled()Is logging enabled for theLogLevel.TRACElevel?- Returns:
trueif logging is enabled for theLogLevel.TRACElevel.
-
trace
Log a message at theLogLevel.TRACElevel.- Parameters:
message- The message to log.
-
trace
Log a formatted message at theLogLevel.TRACElevel.- Parameters:
format- The format of the message to log.arg- The argument to format into the message.
-
trace
Log a formatted message at theLogLevel.TRACElevel.- Parameters:
format- The format of the message to log.arg1- The first argument to format into the message.arg2- The second argument to format into the message.
-
trace
Log a formatted message at theLogLevel.TRACElevel.- Parameters:
format- The format of the message to log.arguments- The arguments to format into the message.
-
trace
Perform the specified operation if logging enabled for theLogLevel.TRACElevel.- Parameters:
consumer- The operation to perform on this Logger.- Throws:
E- An exception thrown by the operation.
-
isDebugEnabled
boolean isDebugEnabled()Is logging enabled for theLogLevel.DEBUGlevel?- Returns:
trueif logging is enabled for theLogLevel.DEBUGlevel.
-
debug
Log a message at theLogLevel.DEBUGlevel.- Parameters:
message- The message to log.
-
debug
Log a formatted message at theLogLevel.DEBUGlevel.- Parameters:
format- The format of the message to log.arg- The argument to format into the message.
-
debug
Log a formatted message at theLogLevel.DEBUGlevel.- Parameters:
format- The format of the message to log.arg1- The first argument to format into the message.arg2- The second argument to format into the message.
-
debug
Log a formatted message at theLogLevel.DEBUGlevel.- Parameters:
format- The format of the message to log.arguments- The arguments to format into the message.
-
debug
Perform the specified operation if logging enabled for theLogLevel.DEBUGlevel.- Parameters:
consumer- The operation to perform on this Logger.- Throws:
E- An exception thrown by the operation.
-
isInfoEnabled
boolean isInfoEnabled()Is logging enabled for theLogLevel.INFOlevel?- Returns:
trueif logging is enabled for theLogLevel.INFOlevel.
-
info
Log a message at theLogLevel.INFOlevel.- Parameters:
message- The message to log.
-
info
Log a formatted message at theLogLevel.INFOlevel.- Parameters:
format- The format of the message to log.arg- The argument to format into the message.
-
info
Log a formatted message at theLogLevel.INFOlevel.- Parameters:
format- The format of the message to log.arg1- The first argument to format into the message.arg2- The second argument to format into the message.
-
info
Log a formatted message at theLogLevel.INFOlevel.- Parameters:
format- The format of the message to log.arguments- The arguments to format into the message.
-
info
Perform the specified operation if logging enabled for theLogLevel.INFOlevel.- Parameters:
consumer- The operation to perform on this Logger.- Throws:
E- An exception thrown by the operation.
-
isWarnEnabled
boolean isWarnEnabled()Is logging enabled for theLogLevel.WARNlevel?- Returns:
trueif logging is enabled for theLogLevel.WARNlevel.
-
warn
Log a message at theLogLevel.WARNlevel.- Parameters:
message- The message to log.
-
warn
Log a formatted message at theLogLevel.WARNlevel.- Parameters:
format- The format of the message to log.arg- The argument to format into the message.
-
warn
Log a formatted message at theLogLevel.WARNlevel.- Parameters:
format- The format of the message to log.arg1- The first argument to format into the message.arg2- The second argument to format into the message.
-
warn
Log a formatted message at theLogLevel.WARNlevel.- Parameters:
format- The format of the message to log.arguments- The arguments to format into the message.
-
warn
Perform the specified operation if logging enabled for theLogLevel.WARNlevel.- Parameters:
consumer- The operation to perform on this Logger.- Throws:
E- An exception thrown by the operation.
-
isErrorEnabled
boolean isErrorEnabled()Is logging enabled for theLogLevel.ERRORlevel?- Returns:
trueif logging is enabled for theLogLevel.ERRORlevel.
-
error
Log a message at theLogLevel.ERRORlevel.- Parameters:
message- The message to log.
-
error
Log a formatted message at theLogLevel.ERRORlevel.- Parameters:
format- The format of the message to log.arg- The argument to format into the message.
-
error
Log a formatted message at theLogLevel.ERRORlevel.- Parameters:
format- The format of the message to log.arg1- The first argument to format into the message.arg2- The second argument to format into the message.
-
error
Log a formatted message at theLogLevel.ERRORlevel.- Parameters:
format- The format of the message to log.arguments- The arguments to format into the message.
-
error
Perform the specified operation if logging enabled for theLogLevel.ERRORlevel.- Parameters:
consumer- The operation to perform on this Logger.- Throws:
E- An exception thrown by the operation.
-
audit
Log a message at theLogLevel.AUDITlevel.- Parameters:
message- The message to log.
-
audit
Log a formatted message at theLogLevel.AUDITlevel.- Parameters:
format- The format of the message to log.arg- The argument to format into the message.
-
audit
Log a formatted message at theLogLevel.AUDITlevel.- Parameters:
format- The format of the message to log.arg1- The first argument to format into the message.arg2- The second argument to format into the message.
-
audit
Log a formatted message at theLogLevel.AUDITlevel.- Parameters:
format- The format of the message to log.arguments- The arguments to format into the message.
-