public class LoggerBeanPostProcessor extends Object implements BeanPostProcessor, Ordered
Injects loggers into new bean instances based on reflection.
Default logger factories configured are SLF4J, Apache Commons, Log4J, and JDK 1.4 Logging.
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
hLoggerFactories |
protected String |
methodName |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
LoggerBeanPostProcessor()
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected Object |
getLogger(String loggerName,
String loggerType)
Gets logger based on the logger name and type of
logger (class name, ex: 'org.slf4j.Logger').
|
int |
getOrder() |
void |
injectMethod(Object bean,
Method method)
Processes a property descriptor to inject a logger.
|
Object |
postProcessAfterInitialization(Object bean,
String beanName)
This method is used to execute after a bean's initialization callback.
|
Object |
postProcessBeforeInitialization(Object bean,
String beanName) |
protected void |
processLogger(Object bean,
String methodName)
Instantiates bean specific loggers and sets them.
|
void |
setLoggerFactoryMap(Map<String,String> hLoggerFactories)
Set logger factory
Map . |
void |
setMethodName(String methodName)
Sets target method name to set logger.
|
protected String methodName
public void setMethodName(String methodName)
public void setLoggerFactoryMap(Map<String,String> hLoggerFactories)
Map
.public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
postProcessBeforeInitialization
in interface BeanPostProcessor
BeansException
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
postProcessAfterInitialization
in interface BeanPostProcessor
BeansException
BeanPostProcessor.postProcessAfterInitialization(java.lang.Object, java.lang.String)
protected void processLogger(Object bean, String methodName)
public void injectMethod(Object bean, Method method)
Copyright © 2008-2014 Spring by Example. All Rights Reserved.