@ProviderType public interface LoggerFactory
Provides methods for bundles to obtain named Loggers that can be used
to write messages to the log.
Logger names should be in the form of a fully qualified Java class names with
segments separated by full stop ('.' \u002E). For example:
com.foo.BarLogger names exist in a hierarchy. A logger name is said to be an ancestor of another logger name if the logger name followed by a full stop (
'.'
\u002E) is a prefix of the descendant logger name. The
root logger name is the top ancestor of the
logger name hierarchy. For example:
com.foo.Bar com.foo com ROOT
| Modifier and Type | Method and Description |
|---|---|
<L extends Logger> |
getLogger(Bundle bundle,
java.lang.String name,
java.lang.Class<L> loggerType)
Return the
Logger of the specified type named with the specified
name for the specified bundle. |
Logger |
getLogger(java.lang.Class<?> clazz)
Return the
Logger named with the specified class. |
<L extends Logger> |
getLogger(java.lang.Class<?> clazz,
java.lang.Class<L> loggerType)
Return the
Logger of the specified type named with the specified
class. |
Logger |
getLogger(java.lang.String name)
Return the
Logger named with the specified name. |
<L extends Logger> |
getLogger(java.lang.String name,
java.lang.Class<L> loggerType)
Return the
Logger of the specified type named with the specified
name. |
Logger getLogger(java.lang.String name)
Logger named with the specified name.name - The name to use for the logger name.Logger named with the specified name. If the name
parameter is equal to Logger.ROOT_LOGGER_NAME, then the
root logger is returned.Logger getLogger(java.lang.Class<?> clazz)
Logger named with the specified class.clazz - The class to use for the logger name.Logger named with the name of the specified class.<L extends Logger> L getLogger(java.lang.String name, java.lang.Class<L> loggerType)
Logger of the specified type named with the specified
name.L - The Logger type.name - The name to use for the logger name.loggerType - The type of Logger. Can be Logger or
FormatterLogger.Logger or FormatterLogger named with the
specified name. If the name parameter is equal to
Logger.ROOT_LOGGER_NAME, then the root logger is
returned.java.lang.IllegalArgumentException - If the specified type is not a supported
Logger type.<L extends Logger> L getLogger(java.lang.Class<?> clazz, java.lang.Class<L> loggerType)
Logger of the specified type named with the specified
class.L - A Logger type.clazz - The class to use for the logger name.loggerType - The type of Logger. Can be Logger or
FormatterLogger.Logger or FormatterLogger named with the name
of the specified class.java.lang.IllegalArgumentException - If the specified type is not a supported
Logger type.<L extends Logger> L getLogger(Bundle bundle, java.lang.String name, java.lang.Class<L> loggerType)
Logger of the specified type named with the specified
name for the specified bundle.
This method is not normally used. The other getLogger methods
return a Logger associated with the bundle used to obtain this
Logger Factory service. This method is used to obtain a Logger
for the specified bundle which may be useful to code which is logging on
behalf of another bundle.
L - The Logger type.bundle - The bundle associated with the Logger.name - The name to use for the logger name.loggerType - The type of Logger. Can be Logger or
FormatterLogger.Logger or FormatterLogger named with the
specified name for the specified bundle. If the name parameter is
equal to Logger.ROOT_LOGGER_NAME, then the root logger is
returned.java.lang.IllegalArgumentException - If the specified type is not a supported
Logger type or the specified Bundle is not a resolved bundle.Copyright © OSGi Alliance (2000, 2018). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0