|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.eventadmin.impl.util.LogWrapper
public class LogWrapper
This class mimics the standard OSGi LogService interface. An instance of this class will be used by the EventAdmin for all logging. The implementation of this class sends log messages to standard output, if no LogService is present; it uses a log service if one is installed in the framework. To do that without creating a hard dependency on the package it uses fully qualified class names and registers a listener with the framework hence, it does not need access to the LogService class but will use it if the listener is informed about an available service. By using a DynamicImport-Package dependency we don't need the package but use it if present. Additionally, all log methods prefix the log message with EventAdmin: .
org.osgi.service.log.LogService
Field Summary | |
---|---|
static int |
LOG_DEBUG
DEBUG LEVEL |
static int |
LOG_ERROR
ERROR LEVEL |
static int |
LOG_INFO
INFO LEVEL |
static int |
LOG_WARNING
WARNING LEVEL |
Method Summary | |
---|---|
static LogWrapper |
getLogger()
Returns the singleton instance of this LogWrapper that can be used to send log messages to all currently available LogServices or to standard output, respectively. |
void |
log(int level,
java.lang.String msg)
Log a message with the given log level. |
void |
log(int level,
java.lang.String msg,
java.lang.Throwable ex)
Log a message with the given log level and the associated exception. |
void |
log(org.osgi.framework.ServiceReference sr,
int level,
java.lang.String msg)
Log a message with the given log level together with the associated service reference. |
void |
log(org.osgi.framework.ServiceReference sr,
int level,
java.lang.String msg,
java.lang.Throwable ex)
Log a message with the given log level, the associated service reference and exception. |
static void |
setContext(org.osgi.framework.BundleContext context)
Set the BundleContext of the bundle. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LOG_ERROR
org.osgi.service.log.LogService#LOG_ERROR
,
Constant Field Valuespublic static final int LOG_WARNING
org.osgi.service.log.LogService#LOG_WARNING
,
Constant Field Valuespublic static final int LOG_INFO
org.osgi.service.log.LogService#LOG_INFO
,
Constant Field Valuespublic static final int LOG_DEBUG
org.osgi.service.log.LogService#LOG_DEBUG
,
Constant Field ValuesMethod Detail |
---|
public static LogWrapper getLogger()
public static void setContext(org.osgi.framework.BundleContext context)
context
- The context of the bundle.public void log(int level, java.lang.String msg)
level
- The log level with which to log the msg.msg
- The message to log.public void log(int level, java.lang.String msg, java.lang.Throwable ex)
level
- The log level with which to log the msg.msg
- The message to log.ex
- The exception associated with the message.public void log(org.osgi.framework.ServiceReference sr, int level, java.lang.String msg)
sr
- The reference of the service associated with this message.level
- The log level with which to log the msg.msg
- The message to log.public void log(org.osgi.framework.ServiceReference sr, int level, java.lang.String msg, java.lang.Throwable ex)
sr
- The reference of the service associated with this message.level
- The log level with which to log the msg.msg
- The message to log.ex
- The exception associated with the message.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |