public class LogWrapper extends Object
m_logLevel
property which decides what messages
get logged.org.osgi.service.log.LogService
Modifier and Type | Field and Description |
---|---|
static int |
LOG_DEBUG
DEBUG LEVEL
|
static int |
LOG_ERROR
ERROR LEVEL
|
static int |
LOG_INFO
INFO LEVEL
|
static int |
LOG_WARNING
WARNING LEVEL
|
Modifier and Type | Method and Description |
---|---|
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.
|
int |
getLogLevel() |
void |
log(int level,
String msg)
Log a message with the given log level.
|
void |
log(int level,
String msg,
Throwable ex)
Log a message with the given log level and the associated exception.
|
void |
log(org.osgi.framework.ServiceReference sr,
int level,
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,
String msg,
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.
|
void |
setLogLevel(int logLevel)
Change the current log level.
|
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 Valuespublic static LogWrapper getLogger()
public static void setContext(org.osgi.framework.BundleContext context)
If the bundle context is null
, the service listener is
unregistered and all remaining references to LogServices dropped before
internally clearing the bundle context field.
context
- The context of the bundle.public void log(int level, String msg)
level
- The log level with which to log the msg.msg
- The message to log.public void log(int level, String msg, 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, 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, String msg, 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.public void setLogLevel(int logLevel)
logLevel
- new log levelpublic int getLogLevel()
Copyright © 2006–2015 The Apache Software Foundation. All rights reserved.