Package org.apache.felix.utils.log
Class Logger
java.lang.Object
org.apache.felix.utils.log.Logger
Internal logger to be used in order to avoid a mandatory dependency on OSGi LogService.
It first tries to log to a log service implementation if there is one available and then fallback to System out/err
in case there is no log service available.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
private final org.osgi.framework.BundleContext
Bundle context.private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
Lookup the OSGi LogService and if available use it.private PrintStream
getStream
(int level) Return the standard print streams to use depending on log level.void
Logs a message.void
Logs a message.
-
Field Details
-
LOG_ERROR
public static final int LOG_ERROR- See Also:
-
LOG_WARNING
public static final int LOG_WARNING- See Also:
-
LOG_INFO
public static final int LOG_INFO- See Also:
-
LOG_DEBUG
public static final int LOG_DEBUG- See Also:
-
m_context
private final org.osgi.framework.BundleContext m_contextBundle context. -
m_isLogClassPresent
private boolean m_isLogClassPresent
-
-
Constructor Details
-
Logger
public Logger(org.osgi.framework.BundleContext context) Constructor.- Parameters:
context
- bundle context
-
-
Method Details
-
log
Logs a message.- Parameters:
level
- The severity of the message. Tmessage
- Human readable string describing the condition ornull
.- See Also:
-
log
Logs a message.- Parameters:
level
- The severity of the message. Tmessage
- Human readable string describing the condition ornull
.exception
- The exception that reflects the condition ornull
.- See Also:
-
_log
Lookup the OSGi LogService and if available use it. -
getStream
Return the standard print streams to use depending on log level.- Parameters:
level
- log level- Returns:
- print stream corresponding to log level
-