|
Service Activator Toolkit
Version 1.1.0 (20081206) |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.soda.sat.core.util.LogUtility
public final class LogUtility
The LogUtility
class provides access to an instance of the OSGi
defined interface LogService
that is guaranteed to never change
identity.
The class provides an implementation of the LogService
whose
identity never changes. This implementation must wrap a target instance of
the LogService
that can be changed. Operations on the
LogService
provided by this class will be delegated to the
target LogService
. The class also provides a way for the target
LogService
to be changed.
This class is an anomaly and should never needs to be used under normal
circumstances. While coupling an application to the OSGi framework is
rarely a good design choice, arguably there are benefits to allowing an
application's business model to use the LogService
. Therefore,
this utility class provides static access to an implementation of the
LogService
.
This class also includes static methods as a convenient way of logging the
four categories of message as defined by the LogService
, namely:
For example, the following methods are provided for logging errors:
In addition to the following convenience static method have been provided for
querying the current logging level:
The static method setLoggingLevel(int)
may be used to set the
current logging level to one of the LogService values defined above.
Note: This is a singleton class, accessible only via the static method
getInstance()
. For example:
LogUtility utility = LogUtility.getInstance();
LogService log = utility.getLog();
LogService
Method Summary | |
---|---|
static LogUtility |
getInstance()
Public getter for the LogUtility singleton instance. |
LogService |
getLog()
Get the org.osgi.service.log.LogService . |
static int |
getLoggingLevel()
Get the current logging level. |
static boolean |
isLoggingDebug()
Query whether debug messages are being logged. |
static boolean |
isLoggingError()
Query whether error messages are being logged. |
static boolean |
isLoggingInfo()
Query whether info messages are being logged. |
static boolean |
isLoggingWarning()
Query whether debug messages are being logged. |
static boolean |
isTracing()
Query the tracing field. |
static void |
logDebug(Object id,
String message)
Log a LogService.LOG_DEBUG message. |
static void |
logDebug(Object id,
String message,
Throwable throwable)
Log a LogService.LOG_DEBUG level message. |
static void |
logDebug(String message)
Log a LogService.LOG_DEBUG message. |
static void |
logDebug(String message,
Throwable throwable)
Log a LogService.LOG_DEBUG level message. |
static void |
logError(Object id,
String message)
Log a LogService.LOG_ERROR message. |
static void |
logError(Object id,
String message,
Throwable throwable)
Log a LogService.LOG_ERROR level message. |
static void |
logError(String message)
Log a LogService.LOG_ERROR message. |
static void |
logError(String message,
Throwable throwable)
Log a LogService.LOG_ERROR level message. |
static void |
logInfo(Object id,
String message)
Log a LogService.LOG_INFO message. |
static void |
logInfo(Object id,
String message,
Throwable throwable)
Log a LogService.LOG_INFO level message. |
static void |
logInfo(String message)
Log a LogService.LOG_INFO message. |
static void |
logInfo(String message,
Throwable throwable)
Log a LogService.LOG_INFO level message. |
static void |
logTrace(Object id,
String message)
Log a LogService.DEBUG_INFO level trace message. |
static void |
logTrace(Object id,
String message,
Throwable throwable)
Log a LogService.DEBUG_INFO level trace message. |
static void |
logTrace(String message)
Log a LogService.DEBUG_INFO level trace message. |
static void |
logTrace(String message,
Throwable throwable)
Log a LogService.DEBUG_INFO level trace message. |
static void |
logWarning(Object id,
String message)
Log a LogService.LOG_INFO message. |
static void |
logWarning(Object id,
String message,
Throwable throwable)
Log a LogService.LOG_WARNING level message. |
static void |
logWarning(String message)
Log a LogService.LOG_WARNING message. |
static void |
logWarning(String message,
Throwable throwable)
Log a LogService.LOG_WARNING level message. |
void |
setLog(LogService log)
Set the org.osgi.service.log.LogService . |
static void |
setLoggingLevel(int level)
Set the current logging level. |
static void |
setTracing(boolean tracing)
Set the tracing field to true or false . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static LogUtility getInstance()
LogUtility
singleton instance.
LogUtility
singleton instance.public static int getLoggingLevel()
org.osgi.service.log.LogService
constants.public static boolean isLoggingDebug()
public static boolean isLoggingError()
public static boolean isLoggingInfo()
public static boolean isLoggingWarning()
public static boolean isTracing()
true
when
tracing in on, and false
when tracing is off.
public static void logDebug(Object id, String message)
LogService.LOG_DEBUG
message.
id
- An object that uniquely identifies the source of the
message to logged.message
- The message to log.public static void logDebug(Object id, String message, Throwable throwable)
LogService.LOG_DEBUG
level message.
id
- An object that identifies who is logging the message.message
- The message that will be logged.throwable
- An accompanying Throwable.public static void logDebug(String message)
LogService.LOG_DEBUG
message.
message
- The message to log.public static void logDebug(String message, Throwable throwable)
LogService.LOG_DEBUG
level message.
message
- The message that will be logged.throwable
- An accompanying Throwable.public static void logError(Object id, String message)
LogService.LOG_ERROR
message.
id
- An object that uniquely identifies the source of the
message to logged.message
- The message to log.public static void logError(Object id, String message, Throwable throwable)
LogService.LOG_ERROR
level message.
id
- An object that identifies who is logging the message.message
- The message that will be logged.throwable
- An accompanying Throwable.public static void logError(String message)
LogService.LOG_ERROR
message.
message
- The message to log.public static void logError(String message, Throwable throwable)
LogService.LOG_ERROR
level message.
message
- The message that will be logged.throwable
- An accompanying Throwable.public static void logInfo(Object id, String message)
LogService.LOG_INFO
message.
id
- An object that uniquely identifies the source of the
message to logged.message
- The message to log.public static void logInfo(Object id, String message, Throwable throwable)
LogService.LOG_INFO
level message.
id
- An object that identifies who is logging the message.message
- The message that will be logged.throwable
- An accompanying Throwable.public static void logInfo(String message)
LogService.LOG_INFO
message.
message
- The message to log.public static void logInfo(String message, Throwable throwable)
LogService.LOG_INFO
level message.
message
- The message that will be logged.throwable
- An accompanying Throwable.public static void logTrace(Object id, String message)
LogService.DEBUG_INFO
level trace message.
id
- An object that identifies who is logging the message.message
- The message that will be logged.public static void logTrace(Object id, String message, Throwable throwable)
LogService.DEBUG_INFO
level trace message.
id
- An object that identifies who is logging the message.message
- The message that will be logged.throwable
- An accompanying Throwable.public static void logTrace(String message)
LogService.DEBUG_INFO
level trace message.
message
- The message that will be logged.public static void logTrace(String message, Throwable throwable)
LogService.DEBUG_INFO
level trace message.
message
- The message that will be logged.throwable
- An accompanying Throwable.public static void logWarning(Object id, String message)
LogService.LOG_INFO
message.
id
- An object that uniquely identifies the source of the
message to logged.message
- The message to log.public static void logWarning(Object id, String message, Throwable throwable)
LogService.LOG_WARNING
level message.
id
- An object that identifies who is logging the message.message
- The message that will be logged.throwable
- An accompanying Throwable.public static void logWarning(String message)
LogService.LOG_WARNING
message.
message
- The message to log.public static void logWarning(String message, Throwable throwable)
LogService.LOG_WARNING
level message.
message
- The message that will be logged.throwable
- An accompanying Throwable.public static void setLoggingLevel(int level)
level
- One of the org.osgi.service.log.LogService
constants.public static void setTracing(boolean tracing)
true
or false
.
tracing
- The value of true
turns tracing on, and a
value of false
turns tracing off.public LogService getLog()
org.osgi.service.log.LogService
.
public void setLog(LogService log)
org.osgi.service.log.LogService
.
log
- A log service.
|
Service Activator Toolkit
Version 1.1.0 (20081206) |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2001, 2008 IBM Corporation and others. All Rights Reserved.