Para aplicaciones web, Spring tiene un configurardor de log. Este se configura en el fichero web.xml. En el cual le dices:
- que fichero tiene la configuracion de log4j.
- Y cual es la clase de Spring que levanta la configuracion.
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <!-- ... --> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j_pepito.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener </listener-class> </listener> <!-- ... --> </web-app>