org.apache.felix.useradmin.impl
Class Logger

java.lang.Object
  extended by org.osgi.util.tracker.ServiceTracker
      extended by org.apache.felix.useradmin.impl.Logger
All Implemented Interfaces:
LogService, ServiceTrackerCustomizer

public class Logger
extends ServiceTracker
implements LogService

This Logger class represents ServiceTracker for LogService. It provides methods for logging messages. If LogServic is not available it logs to stdout.

Version:
$Rev$ $Date$
See Also:
LogService, ServiceTracker

Field Summary
 
Fields inherited from class org.osgi.util.tracker.ServiceTracker
context, filter
 
Fields inherited from interface org.osgi.service.log.LogService
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
 
Constructor Summary
Logger(BundleContext context)
          Constructs new Logger(ServiceTracker for LogService).
 
Method Summary
 void log(int level, String message)
          Logs a message.
 void log(int level, String message, Throwable exception)
          Logs a message with an exception.
 void log(ServiceReference ref, int level, String message)
          Logs a message associated with a specific ServiceReference object.
 void log(ServiceReference ref, int level, String message, Throwable exception)
          Logs a message with an exception associated and a ServiceReference object.
 
Methods inherited from class org.osgi.util.tracker.ServiceTracker
addingService, close, getService, getService, getServiceReference, getServiceReferences, getServices, getTrackingCount, modifiedService, open, open, remove, removedService, size, waitForService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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,
                String message)
Description copied from interface: LogService
Logs a message.

The ServiceReference field and the Throwable field of the LogEntry object will be set to null.

Specified by:
log in interface LogService
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 or null.
See Also:
LogService.log(int, java.lang.String)

log

public void log(int level,
                String message,
                Throwable exception)
Description copied from interface: LogService
Logs a message with an exception.

The ServiceReference field of the LogEntry object will be set to null.

Specified by:
log in interface LogService
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 or null.
exception - The exception that reflects the condition or null.
See Also:
LogService.log(int, java.lang.String, java.lang.Throwable)

log

public void log(ServiceReference ref,
                int level,
                String message)
Description copied from interface: LogService
Logs a message associated with a specific ServiceReference object.

The Throwable field of the LogEntry will be set to null.

Specified by:
log in interface LogService
Parameters:
ref - The ServiceReference object of the service that this message is associated with or null.
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 or null.
See Also:
LogService.log(org.osgi.framework.ServiceReference, int, java.lang.String)

log

public void log(ServiceReference ref,
                int level,
                String message,
                Throwable exception)
Description copied from interface: LogService
Logs a message with an exception associated and a ServiceReference object.

Specified by:
log in interface LogService
Parameters:
ref - The ServiceReference 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 or null.
exception - The exception that reflects the condition or null.
See Also:
LogService.log(org.osgi.framework.ServiceReference, int, java.lang.String, java.lang.Throwable)


Copyright © 2011 Apache Software Foundation. All Rights Reserved.