How do I create a log4j Logger using Spring XML configuration?
I would like to do something like this so I can inject the logger into other instances:
<bean id="logger" class="org.apache.log4j.Logger">
<property name="logName" value="my.Logger" />
</bean>
You can construct beans via static methods using the factory-method attribute. So for log4j we can use the static
Logger.getLogger()method to construct a bean: