|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.httplite.osgi.Logger
public class Logger
This class mimics the standard OSGi LogService interface. An instance of this class is used by the framework for all logging. By default this class logs messages to standard out. The log level can be set to control the amount of logging performed, where a higher number results in more logging. A log level of zero turns off logging completely.
The log levels match those specified in the OSGi Log Service (i.e., 1 = error, 2 = warning, 3 = information, and 4 = debug). The default value is 1.
This class also uses the System Bundle's context to track log services and will use the highest ranking log service, if present, as a back end instead of printing to standard out. The class uses reflection to invoking the log service's method to avoid a dependency on the log interface.
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 |
Constructor Summary | |
---|---|
Logger()
|
Method Summary | |
---|---|
protected void |
doLog(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceReference sr,
int level,
java.lang.String msg,
java.lang.Throwable throwable)
|
int |
getLogLevel()
|
void |
log(org.osgi.framework.Bundle bundle,
int level,
java.lang.String msg)
|
void |
log(org.osgi.framework.Bundle bundle,
int level,
java.lang.String msg,
java.lang.Throwable throwable)
|
void |
log(int level,
java.lang.String msg)
|
void |
log(int level,
java.lang.String msg,
java.lang.Throwable throwable)
|
void |
log(org.osgi.framework.ServiceReference sr,
int level,
java.lang.String msg)
|
void |
log(org.osgi.framework.ServiceReference sr,
int level,
java.lang.String msg,
java.lang.Throwable throwable)
|
void |
serviceChanged(org.osgi.framework.ServiceEvent event)
This method implements the callback for the ServiceListener interface. |
void |
setLogLevel(int i)
|
protected void |
setSystemBundleContext(org.osgi.framework.BundleContext context)
|
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
public static final int LOG_WARNING
public static final int LOG_INFO
public static final int LOG_DEBUG
Constructor Detail |
---|
public Logger()
Method Detail |
---|
public final void setLogLevel(int i)
i
- log levelpublic final int getLogLevel()
protected void setSystemBundleContext(org.osgi.framework.BundleContext context)
public final void log(int level, java.lang.String msg)
level
- log levelmsg
- message to logpublic final void log(int level, java.lang.String msg, java.lang.Throwable throwable)
level
- log levelmsg
- message to logthrowable
- error to logpublic final void log(org.osgi.framework.ServiceReference sr, int level, java.lang.String msg)
sr
- service reference to loglevel
- level to logmsg
- message to logpublic final void log(org.osgi.framework.ServiceReference sr, int level, java.lang.String msg, java.lang.Throwable throwable)
sr
- service reference to loglevel
- level to logmsg
- message to logthrowable
- error to logpublic final void log(org.osgi.framework.Bundle bundle, int level, java.lang.String msg)
bundle
- bundle to loglevel
- level to logmsg
- message to logpublic final void log(org.osgi.framework.Bundle bundle, int level, java.lang.String msg, java.lang.Throwable throwable)
bundle
- source of log eventlevel
- level to logmsg
- message to logthrowable
- error to logprotected void doLog(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceReference sr, int level, java.lang.String msg, java.lang.Throwable throwable)
public final void serviceChanged(org.osgi.framework.ServiceEvent event)
serviceChanged
in interface org.osgi.framework.ServiceListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |