Interface FormatterLogger
- All Superinterfaces:
Logger
Messages can be formatted by the Logger once the Logger determines the log
level is enabled. Uses printf-style format strings as described in
Formatter
.
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
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 %s.", serviceReference, serviceReference); logger.warn("Something named %s happened.", name, serviceReference, throwable); logger.error("Failed.", exception);
If an exception occurs formatting the message, the logged message will indicate the formatting failure including the format string and the arguments.
- Since:
- 1.4
-
Field Summary
Fields inherited from interface org.osgi.service.log.Logger
ROOT_LOGGER_NAME
-
Method Summary
Methods inherited from interface org.osgi.service.log.Logger
audit, audit, audit, audit, debug, debug, debug, debug, debug, error, error, error, error, error, getName, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn