Class Logger
- java.lang.Object
-
- org.apache.felix.resolver.Logger
-
public class Logger extends java.lang.ObjectThis 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
Fields Modifier and Type Field Description static intLOG_DEBUGstatic intLOG_ERRORstatic intLOG_INFOstatic intLOG_WARNINGprivate intm_logLevel
-
Constructor Summary
Constructors Constructor Description Logger(int i)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_log(int level, java.lang.String msg, java.lang.Throwable throwable)voiddebug(java.lang.String msg)protected voiddoLog(int level, java.lang.String msg, java.lang.Throwable throwable)intgetLogLevel()booleanisDebugEnabled()voidlog(int level, java.lang.String msg)voidlog(int level, java.lang.String msg, java.lang.Throwable throwable)voidlogUsesConstraintViolation(org.osgi.resource.Resource resource, ResolutionError error)voidsetLogLevel(int i)
-
-
-
Field Detail
-
LOG_ERROR
public static final int LOG_ERROR
- See Also:
- Constant Field Values
-
LOG_WARNING
public static final int LOG_WARNING
- See Also:
- Constant Field Values
-
LOG_INFO
public static final int LOG_INFO
- See Also:
- Constant Field Values
-
LOG_DEBUG
public static final int LOG_DEBUG
- See Also:
- Constant Field Values
-
m_logLevel
private int m_logLevel
-
-
Method Detail
-
setLogLevel
public final void setLogLevel(int i)
-
getLogLevel
public final int getLogLevel()
-
log
public final void log(int level, java.lang.String msg)
-
log
public final void log(int level, java.lang.String msg, java.lang.Throwable throwable)
-
isDebugEnabled
public boolean isDebugEnabled()
-
debug
public final void debug(java.lang.String msg)
-
doLog
protected void doLog(int level, java.lang.String msg, java.lang.Throwable throwable)
-
_log
private void _log(int level, java.lang.String msg, java.lang.Throwable throwable)
-
logUsesConstraintViolation
public void logUsesConstraintViolation(org.osgi.resource.Resource resource, ResolutionError error)
-
-