Class Logger
- java.lang.Object
-
- org.osgi.util.tracker.ServiceTracker
-
- org.apache.aries.util.log.Logger
-
- All Implemented Interfaces:
LoggerFactory
,LogService
,ServiceTrackerCustomizer
public class Logger extends ServiceTracker implements LogService
This Logger class represents ServiceTracker for LogService. It provides a simple mechanism for interacting with the log service.
- See Also:
LogService
,ServiceTracker
-
-
Field Summary
-
Fields inherited from interface org.osgi.service.log.LogService
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
-
-
Constructor Summary
Constructors Constructor Description Logger(BundleContext context)
Constructs new Logger(ServiceTracker for LogService).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
log(int level, java.lang.String message)
Logs a message.void
log(int level, java.lang.String message, java.lang.Throwable exception)
Logs a message with an exception.void
log(ServiceReference ref, int level, java.lang.String message)
Logs a message associated with a specificServiceReference
object.void
log(ServiceReference ref, int level, java.lang.String message, java.lang.Throwable exception)
Logs a message with an exception associated and aServiceReference
object.-
Methods inherited from class org.osgi.util.tracker.ServiceTracker
addingService, close, getService, getService, getServiceReference, getServiceReferences, getServices, getServices, getTracked, getTrackingCount, isEmpty, modifiedService, open, open, remove, removedService, size, waitForService
-
-
-
-
Constructor Detail
-
Logger
public Logger(BundleContext context)
Constructs new Logger(ServiceTracker for LogService).- Parameters:
context
- bundle context.
-
-
Method Detail
-
log
public void log(int level, java.lang.String message)
Description copied from interface:LogService
Logs a message.The
ServiceReference
field and theThrowable
field of theLogEntry
object will be set tonull
.This method will log to the
Logger
named"LogService"
for the bundle. The specified level is mapped to aLogLevel
as follows:LogService.LOG_ERROR
-LogLevel.ERROR
LogService.LOG_WARNING
-LogLevel.WARN
LogService.LOG_INFO
-LogLevel.INFO
LogService.LOG_DEBUG
-LogLevel.DEBUG
- Any other value -
LogLevel.TRACE
LogEntry.getLevel()
must return the specified level.- Specified by:
log
in interfaceLogService
- Parameters:
level
- The severity of the message. This should be one of the defined log levels but may be any integer that is interpreted in a user defined way.message
- Human readable string describing the condition ornull
.- See Also:
LogService.log(int, java.lang.String)
-
log
public void log(int level, java.lang.String message, java.lang.Throwable exception)
Description copied from interface:LogService
Logs a message with an exception.The
ServiceReference
field of theLogEntry
object will be set tonull
.This method will log to the
Logger
named"LogService"
for the bundle. The specified level is mapped to aLogLevel
as follows:LogService.LOG_ERROR
-LogLevel.ERROR
LogService.LOG_WARNING
-LogLevel.WARN
LogService.LOG_INFO
-LogLevel.INFO
LogService.LOG_DEBUG
-LogLevel.DEBUG
- Any other value -
LogLevel.TRACE
LogEntry.getLevel()
must return the specified level.- Specified by:
log
in interfaceLogService
- Parameters:
level
- The severity of the message. This should be one of the defined log levels but may be any integer that is interpreted in a user defined way.message
- The human readable string describing the condition ornull
.exception
- The exception that reflects the condition ornull
.- See Also:
LogService.log(int, java.lang.String, java.lang.Throwable)
-
log
public void log(ServiceReference ref, int level, java.lang.String message)
Description copied from interface:LogService
Logs a message associated with a specificServiceReference
object.The
Throwable
field of theLogEntry
will be set tonull
.This method will log to the
Logger
named"LogService"
for the bundle. The specified level is mapped to aLogLevel
as follows:LogService.LOG_ERROR
-LogLevel.ERROR
LogService.LOG_WARNING
-LogLevel.WARN
LogService.LOG_INFO
-LogLevel.INFO
LogService.LOG_DEBUG
-LogLevel.DEBUG
- Any other value -
LogLevel.TRACE
LogEntry.getLevel()
must return the specified level.- Specified by:
log
in interfaceLogService
- Parameters:
ref
- TheServiceReference
object of the service that this message is associated with ornull
.level
- The severity of the message. This should be one of the defined log levels but may be any integer that is interpreted in a user defined way.message
- Human readable string describing the condition ornull
.- See Also:
LogService.log(org.osgi.framework.ServiceReference, int, java.lang.String)
-
log
public void log(ServiceReference ref, int level, java.lang.String message, java.lang.Throwable exception)
Description copied from interface:LogService
Logs a message with an exception associated and aServiceReference
object.This method will log to the
Logger
named"LogService"
for the bundle. The specified level is mapped to aLogLevel
as follows:LogService.LOG_ERROR
-LogLevel.ERROR
LogService.LOG_WARNING
-LogLevel.WARN
LogService.LOG_INFO
-LogLevel.INFO
LogService.LOG_DEBUG
-LogLevel.DEBUG
- Any other value -
LogLevel.TRACE
LogEntry.getLevel()
must return the specified level.- Specified by:
log
in interfaceLogService
- Parameters:
ref
- TheServiceReference
object of the service that this message is associated with.level
- The severity of the message. This should be one of the defined log levels but may be any integer that is interpreted in a user defined way.message
- Human readable string describing the condition ornull
.exception
- The exception that reflects the condition ornull
.- See Also:
LogService.log(org.osgi.framework.ServiceReference, int, java.lang.String, java.lang.Throwable)
-
-