public class LoggerBeanPostProcessor extends Object implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.core.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 |
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 org.springframework.beans.BeansException
postProcessBeforeInitialization
in interface org.springframework.beans.factory.config.BeanPostProcessor
org.springframework.beans.BeansException
public Object postProcessAfterInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException
postProcessAfterInitialization
in interface org.springframework.beans.factory.config.BeanPostProcessor
org.springframework.beans.BeansException
BeanPostProcessor.postProcessAfterInitialization(java.lang.Object, java.lang.String)
public int getOrder()
getOrder
in interface org.springframework.core.Ordered
protected void processLogger(Object bean, String methodName)
public void injectMethod(Object bean, Method method)
Copyright © 2008-2013 Spring by Example. All Rights Reserved.