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 voidlog(int level, java.lang.String message)Logs a message.voidlog(int level, java.lang.String message, java.lang.Throwable exception)Logs a message with an exception.voidlog(ServiceReference ref, int level, java.lang.String message)Logs a message associated with a specificServiceReferenceobject.voidlog(ServiceReference ref, int level, java.lang.String message, java.lang.Throwable exception)Logs a message with an exception associated and aServiceReferenceobject.-
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:LogServiceLogs a message.The
ServiceReferencefield and theThrowablefield of theLogEntryobject will be set tonull.This method will log to the
Loggernamed"LogService"for the bundle. The specified level is mapped to aLogLevelas follows:LogService.LOG_ERROR-LogLevel.ERRORLogService.LOG_WARNING-LogLevel.WARNLogService.LOG_INFO-LogLevel.INFOLogService.LOG_DEBUG-LogLevel.DEBUG- Any other value -
LogLevel.TRACE
LogEntry.getLevel()must return the specified level.- Specified by:
login 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:LogServiceLogs a message with an exception.The
ServiceReferencefield of theLogEntryobject will be set tonull.This method will log to the
Loggernamed"LogService"for the bundle. The specified level is mapped to aLogLevelas follows:LogService.LOG_ERROR-LogLevel.ERRORLogService.LOG_WARNING-LogLevel.WARNLogService.LOG_INFO-LogLevel.INFOLogService.LOG_DEBUG-LogLevel.DEBUG- Any other value -
LogLevel.TRACE
LogEntry.getLevel()must return the specified level.- Specified by:
login 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:LogServiceLogs a message associated with a specificServiceReferenceobject.The
Throwablefield of theLogEntrywill be set tonull.This method will log to the
Loggernamed"LogService"for the bundle. The specified level is mapped to aLogLevelas follows:LogService.LOG_ERROR-LogLevel.ERRORLogService.LOG_WARNING-LogLevel.WARNLogService.LOG_INFO-LogLevel.INFOLogService.LOG_DEBUG-LogLevel.DEBUG- Any other value -
LogLevel.TRACE
LogEntry.getLevel()must return the specified level.- Specified by:
login interfaceLogService- Parameters:
ref- TheServiceReferenceobject 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:LogServiceLogs a message with an exception associated and aServiceReferenceobject.This method will log to the
Loggernamed"LogService"for the bundle. The specified level is mapped to aLogLevelas follows:LogService.LOG_ERROR-LogLevel.ERRORLogService.LOG_WARNING-LogLevel.WARNLogService.LOG_INFO-LogLevel.INFOLogService.LOG_DEBUG-LogLevel.DEBUG- Any other value -
LogLevel.TRACE
LogEntry.getLevel()must return the specified level.- Specified by:
login interfaceLogService- Parameters:
ref- TheServiceReferenceobject 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)
-
-