public class BundleLogger extends LogServiceEnabledLogger
BundleLogger
defines a simple API to enable some logging on behalf of
an extended bundle. This avoids that all clients doing logging on behalf of
a component bundle need to pass in things like BundleContext
.Modifier and Type | Field and Description |
---|---|
private ScrLogger |
parent |
logServiceTracker, trackingCount
Constructor and Description |
---|
BundleLogger(org.osgi.framework.BundleContext bundleContext,
ScrLogger parent) |
Modifier and Type | Method and Description |
---|---|
(package private) InternalLogger |
getDefaultLogger() |
(package private) InternalLogger |
getLogger(java.lang.String className) |
(package private) int |
getTrackingCount() |
boolean |
log(int level,
java.lang.String message,
java.lang.Throwable ex)
Method to actually emit the log message.
|
boolean |
log(int level,
java.lang.String pattern,
java.lang.Throwable ex,
java.lang.Object... arguments)
Method to actually emit the log message.
|
close, getLogger
getBundleIdentifier, getConfiguration, getPrefix, isLogEnabled, setPrefix
private final ScrLogger parent
public BundleLogger(org.osgi.framework.BundleContext bundleContext, ScrLogger parent)
InternalLogger getDefaultLogger()
getDefaultLogger
in class LogServiceEnabledLogger
int getTrackingCount()
InternalLogger getLogger(java.lang.String className)
public boolean log(int level, java.lang.String pattern, java.lang.Throwable ex, java.lang.Object... arguments)
AbstractLogger
log
in class AbstractLogger
level
- The log level to log the message atpattern
- The java.text.MessageFormat
message format
string for preparing the messageex
- An optional Throwable
whose stack trace is written,arguments
- The format arguments for the pattern
string.public boolean log(int level, java.lang.String message, java.lang.Throwable ex)
AbstractLogger
log
in class AbstractLogger
level
- The log level of the messages. This corresponds to the log
levels defined by the OSGi LogService.message
- The message to printex
- The Throwable
causing the message to be logged.