org.ops4j.pax.logging.service.internal
Class PaxLoggingServiceImpl

java.lang.Object
  extended by org.ops4j.pax.logging.service.internal.PaxLoggingServiceImpl
All Implemented Interfaces:
PaxLoggingService, org.osgi.framework.ServiceFactory, org.osgi.service.cm.ManagedService, LogService

public class PaxLoggingServiceImpl
extends java.lang.Object
implements PaxLoggingService, LogService, org.osgi.service.cm.ManagedService, org.osgi.framework.ServiceFactory


Field Summary
 
Fields inherited from interface org.ops4j.pax.logging.PaxLoggingService
APPENDER_NAME_PROPERTY
 
Fields inherited from interface org.osgi.service.log.LogService
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
 
Constructor Summary
PaxLoggingServiceImpl(org.osgi.framework.BundleContext context, LogReaderServiceImpl logReader, EventAdminPoster eventAdmin)
           
 
Method Summary
 PaxLogger getLogger(org.osgi.framework.Bundle bundle, java.lang.String category, java.lang.String fqcn)
           
 int getLogLevel()
          * Get the current log level.
 PaxContext getPaxContext()
           
 java.lang.Object getService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration registration)
           
 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(org.osgi.framework.ServiceReference sr, int level, java.lang.String message)
          Logs a message associated with a specific ServiceReference object.
 void log(org.osgi.framework.ServiceReference sr, int level, java.lang.String message, java.lang.Throwable exception)
          Logs a message with an exception associated and a ServiceReference object.
 void ungetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration registration, java.lang.Object service)
           
 void updated(java.util.Dictionary configuration)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PaxLoggingServiceImpl

public PaxLoggingServiceImpl(org.osgi.framework.BundleContext context,
                             LogReaderServiceImpl logReader,
                             EventAdminPoster eventAdmin)
Method Detail

getLogger

public PaxLogger getLogger(org.osgi.framework.Bundle bundle,
                           java.lang.String category,
                           java.lang.String fqcn)
Specified by:
getLogger in interface PaxLoggingService

getLogLevel

public int getLogLevel()
Description copied from interface: LogService
* Get the current log level. The log will discard log entires * with a level that is less severe than the current level. * * E.g. If the current log level is LOG_WARNING then the log will * discard all log entries with level LOG_INFO and LOG_DEBUG. I.e. * there is no need for a bundle to try to send such log entries * to the log. The bundle may actually save a number of CPU-cycles * by getting the log level and do nothing if the intended log * entry is less severe than the current log level. * *

Specified by:
getLogLevel in interface PaxLoggingService
Returns:
the lowest severity level that is accepted into the * log.

log

public void log(int level,
                java.lang.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_ERROR, LogService.LOG_WARNING, LogService.LOG_INFO, LogService.LOG_DEBUG

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 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_ERROR, LogService.LOG_WARNING, LogService.LOG_INFO, LogService.LOG_DEBUG

log

public void log(org.osgi.framework.ServiceReference sr,
                int level,
                java.lang.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:
sr - 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_ERROR, LogService.LOG_WARNING, LogService.LOG_INFO, LogService.LOG_DEBUG

log

public void log(org.osgi.framework.ServiceReference sr,
                int level,
                java.lang.String message,
                java.lang.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:
sr - 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_ERROR, LogService.LOG_WARNING, LogService.LOG_INFO, LogService.LOG_DEBUG

updated

public void updated(java.util.Dictionary configuration)
             throws org.osgi.service.cm.ConfigurationException
Specified by:
updated in interface org.osgi.service.cm.ManagedService
Throws:
org.osgi.service.cm.ConfigurationException

getService

public java.lang.Object getService(org.osgi.framework.Bundle bundle,
                                   org.osgi.framework.ServiceRegistration registration)
Specified by:
getService in interface org.osgi.framework.ServiceFactory

ungetService

public void ungetService(org.osgi.framework.Bundle bundle,
                         org.osgi.framework.ServiceRegistration registration,
                         java.lang.Object service)
Specified by:
ungetService in interface org.osgi.framework.ServiceFactory

getPaxContext

public PaxContext getPaxContext()
Specified by:
getPaxContext in interface PaxLoggingService


Copyright © 2006-2011 OPS4J - Open Participation Software for Java. All Rights Reserved.