Class PaxLoggingServiceImpl
- java.lang.Object
-
- org.ops4j.pax.logging.log4j2.internal.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>
-
-
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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.osgi.service.log.LoggergetLogger(Class<?> clazz)<L extends org.osgi.service.log.Logger>
LgetLogger(Class<?> clazz, Class<L> loggerType)org.osgi.service.log.LoggergetLogger(String name)<L extends org.osgi.service.log.Logger>
LgetLogger(String name, Class<L> loggerType)<L extends org.osgi.service.log.Logger>
LgetLogger(org.osgi.framework.Bundle bundle, String name, Class<L> loggerType)org.ops4j.pax.logging.PaxLoggergetLogger(org.osgi.framework.Bundle bundle, String category, String fqcn)org.osgi.service.log.LogLevelgetLogLevel()org.ops4j.pax.logging.PaxContextgetPaxContext()ObjectgetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration registration)Use local class to delegate calls to underlying instance while keeping bundle reference.voidlog(int level, String message)voidlog(int level, String message, Throwable exception)voidlog(org.osgi.framework.ServiceReference sr, int level, String message)voidlog(org.osgi.framework.ServiceReference sr, int level, String message, Throwable exception)voidsetDefaultConfiguration(Dictionary<String,String> config)When there's system/context property specified usingPaxLoggingConstants.LOGGING_CFG_PROPERTY_FILE, and ConfigurationAdmin is available, Pax Logging may first get null configuration.voidshutdown()Shut down the Pax Logging service.voidungetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration registration, Object service)
-
-
-
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:
getLoggerin interfaceorg.ops4j.pax.logging.PaxLoggingService
-
getLogLevel
public org.osgi.service.log.LogLevel getLogLevel()
- Specified by:
getLogLevelin interfaceorg.ops4j.pax.logging.PaxLoggingService
-
log
public void log(int level, String message)- Specified by:
login interfaceorg.osgi.service.log.LogService
-
log
public void log(int level, String message, Throwable exception)- Specified by:
login interfaceorg.osgi.service.log.LogService
-
log
public void log(org.osgi.framework.ServiceReference sr, int level, String message)- Specified by:
login interfaceorg.osgi.service.log.LogService
-
log
public void log(org.osgi.framework.ServiceReference sr, int level, String message, Throwable exception)- Specified by:
login interfaceorg.osgi.service.log.LogService
-
getPaxContext
public org.ops4j.pax.logging.PaxContext getPaxContext()
- Specified by:
getPaxContextin interfaceorg.ops4j.pax.logging.PaxLoggingService
-
getLogger
public org.osgi.service.log.Logger getLogger(String name)
- Specified by:
getLoggerin interfaceorg.osgi.service.log.LoggerFactory
-
getLogger
public org.osgi.service.log.Logger getLogger(Class<?> clazz)
- Specified by:
getLoggerin interfaceorg.osgi.service.log.LoggerFactory
-
getLogger
public <L extends org.osgi.service.log.Logger> L getLogger(String name, Class<L> loggerType)
- Specified by:
getLoggerin interfaceorg.osgi.service.log.LoggerFactory
-
getLogger
public <L extends org.osgi.service.log.Logger> L getLogger(Class<?> clazz, Class<L> loggerType)
- Specified by:
getLoggerin interfaceorg.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:
getLoggerin interfaceorg.osgi.service.log.LoggerFactory
-
setDefaultConfiguration
public void setDefaultConfiguration(Dictionary<String,String> config)
When there's system/context property specified usingPaxLoggingConstants.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:
getServicein interfaceorg.osgi.framework.ServiceFactory<Object>
-
-