Class PaxLoggingServiceImpl

  • All Implemented Interfaces:
    org.ops4j.pax.logging.PaxLoggingService, org.osgi.framework.ServiceFactory<Object>, org.osgi.service.log.LoggerFactory, org.osgi.service.log.LogService

    public class PaxLoggingServiceImpl
    extends Object
    implements org.ops4j.pax.logging.PaxLoggingService, org.osgi.framework.ServiceFactory<Object>
    • Field Summary

      • Fields inherited from interface org.osgi.service.log.LogService

        LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
    • Constructor Summary

      Constructors 
      Constructor Description
      PaxLoggingServiceImpl​(org.osgi.framework.BundleContext bundleContext, org.ops4j.pax.logging.spi.support.LogReaderServiceImpl logReader, org.ops4j.pax.logging.EventAdminPoster eventAdmin, org.ops4j.pax.logging.spi.support.ConfigurationNotifier configNotifier)  
    • Constructor Detail

      • PaxLoggingServiceImpl

        public PaxLoggingServiceImpl​(org.osgi.framework.BundleContext bundleContext,
                                     org.ops4j.pax.logging.spi.support.LogReaderServiceImpl logReader,
                                     org.ops4j.pax.logging.EventAdminPoster eventAdmin,
                                     org.ops4j.pax.logging.spi.support.ConfigurationNotifier configNotifier)
    • Method Detail

      • shutdown

        public void shutdown()
        Shut down the Pax Logging service. This will reset the logging configuration entirely, so it should only be used just before disposing of the service instance.
      • getLogger

        public org.ops4j.pax.logging.PaxLogger getLogger​(org.osgi.framework.Bundle bundle,
                                                         String category,
                                                         String fqcn)
        Specified by:
        getLogger in interface org.ops4j.pax.logging.PaxLoggingService
      • getLogLevel

        public org.osgi.service.log.LogLevel getLogLevel()
        Specified by:
        getLogLevel in interface org.ops4j.pax.logging.PaxLoggingService
      • log

        public void log​(int level,
                        String message)
        Specified by:
        log in interface org.osgi.service.log.LogService
      • log

        public void log​(int level,
                        String message,
                        Throwable exception)
        Specified by:
        log in interface org.osgi.service.log.LogService
      • log

        public void log​(org.osgi.framework.ServiceReference sr,
                        int level,
                        String message)
        Specified by:
        log in interface org.osgi.service.log.LogService
      • log

        public void log​(org.osgi.framework.ServiceReference sr,
                        int level,
                        String message,
                        Throwable exception)
        Specified by:
        log in interface org.osgi.service.log.LogService
      • getPaxContext

        public org.ops4j.pax.logging.PaxContext getPaxContext()
        Specified by:
        getPaxContext in interface org.ops4j.pax.logging.PaxLoggingService
      • getLogger

        public org.osgi.service.log.Logger getLogger​(String name)
        Specified by:
        getLogger in interface org.osgi.service.log.LoggerFactory
      • getLogger

        public org.osgi.service.log.Logger getLogger​(Class<?> clazz)
        Specified by:
        getLogger in interface org.osgi.service.log.LoggerFactory
      • getLogger

        public <L extends org.osgi.service.log.Logger> L getLogger​(String name,
                                                                   Class<L> loggerType)
        Specified by:
        getLogger in interface org.osgi.service.log.LoggerFactory
      • getLogger

        public <L extends org.osgi.service.log.Logger> L getLogger​(Class<?> clazz,
                                                                   Class<L> loggerType)
        Specified by:
        getLogger in interface org.osgi.service.log.LoggerFactory
      • getLogger

        public <L extends org.osgi.service.log.Logger> L getLogger​(org.osgi.framework.Bundle bundle,
                                                                   String name,
                                                                   Class<L> loggerType)
        Specified by:
        getLogger in interface org.osgi.service.log.LoggerFactory
      • setDefaultConfiguration

        public void setDefaultConfiguration​(Dictionary<String,​String> config)
        When there's system/context property specified using PaxLoggingConstants.LOGGING_CFG_PROPERTY_FILE, and ConfigurationAdmin is available, Pax Logging may first get null configuration. When "default configuration" is set before that, we'll use it instead of empty configuration.
        Parameters:
        config -
      • getService

        public Object getService​(org.osgi.framework.Bundle bundle,
                                 org.osgi.framework.ServiceRegistration registration)
        Use local class to delegate calls to underlying instance while keeping bundle reference. We don't need anything special from bundle-scoped service (ServiceFactory) except the reference to client bundle.
        Specified by:
        getService in interface org.osgi.framework.ServiceFactory<Object>
      • ungetService

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