Package org.apache.qpid.protonj2.logging
Class ProtonLoggerFactory
- java.lang.Object
-
- org.apache.qpid.protonj2.logging.ProtonLoggerFactory
-
- Direct Known Subclasses:
NoOpProtonLoggerFactory,Slf4JLoggerFactory
public abstract class ProtonLoggerFactory extends java.lang.ObjectFactory used to create Proton Logger abstractions
-
-
Constructor Summary
Constructors Constructor Description ProtonLoggerFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ProtonLoggercreateLoggerWrapper(java.lang.String name)static ProtonLoggergetLogger(java.lang.Class<?> clazz)Logger lookup based on theClassthat will host the logger instance.static ProtonLoggergetLogger(java.lang.String name)Logger lookup based on the given logger name that will host the logger instance.static ProtonLoggerFactorygetLoggerFactory()Returns aProtonLoggerFactoryinstance.static voidsetLoggerFactory(ProtonLoggerFactory factory)Configure Proton with a custom ProtonLoggerFactory implementation which will be used by the Proton classes when logging library events.
-
-
-
Method Detail
-
getLoggerFactory
public static ProtonLoggerFactory getLoggerFactory()
Returns aProtonLoggerFactoryinstance.The factory returned depends on the configuration and available logger implementations at the time this method is called. If a custom ProtonLoggerFactory is configured than that instance is returned, otherwise this class will attempt to find a factory for the slf4j logger library.
- Returns:
- a
ProtonLoggerFactorythat will be used by this library.
-
setLoggerFactory
public static void setLoggerFactory(ProtonLoggerFactory factory)
Configure Proton with a custom ProtonLoggerFactory implementation which will be used by the Proton classes when logging library events.- Parameters:
factory- TheProtonLoggerFactoryto use when loggers are requested.- Throws:
java.lang.IllegalArgumentException- if the factory given is null.
-
getLogger
public static ProtonLogger getLogger(java.lang.Class<?> clazz)
Logger lookup based on theClassthat will host the logger instance.- Parameters:
clazz- TheClassthat will host the logger instance being requested.- Returns:
- a
ProtonLoggerthat is tied to the givenClassinstance.
-
getLogger
public static ProtonLogger getLogger(java.lang.String name)
Logger lookup based on the given logger name that will host the logger instance.- Parameters:
name- The given name that will host the logger instance being requested.- Returns:
- a
ProtonLoggerthat is tied to the given logger name.
-
createLoggerWrapper
protected abstract ProtonLogger createLoggerWrapper(java.lang.String name)
-
-