I am migrating from log4j to logback in my Spring MVC based web application. Currently, Spring’s Log4jConfigListener is configure in web.xml to locate log4j.xml file as shown below:
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>WEB-INF/spring/log4j.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
Now, I have created logback.xml file under WEB-INF/spring folder. Is there a similar configuration in web.xml for logback also?
I don’t find any LogbackConfigListener class in org.springframework.web.util package of Spring 3.1
As of Spring 3.1.x there is no way of configuring Logback with Spring using listeners.
This blog mentions that someone has sended the petition to mailing list though.
Anyways, qos-ch (Les Hazlewood) has created an artifact (spring extension) for such case. Check the github repo.