Hi all,
I have configured a web application to use log4j logging using the Log4jConfigListener, running in Tomcat 5.0.25. All of my logging calls use commons-logging. But for some reason the system, when running, chooses the jdk1.4 logger rather than the log4j logger.
The log files I have configured in log4j.properties actually do get created by Spring, but for some reason commons-logging doesn't use the Spring configured logging.
Here is a copy of my web.xml file for reference:
Code:<web-app> <display-name>Esmart web booking</display-name> <!-- - Key of the system property that should specify the root directory of this - web app. Applied by WebAppRootListener or Log4jConfigListener. --> <context-param> <param-name>webAppRootKey</param-name> <param-value>esmart.root</param-value> </context-param> <!-- - Location of the Log4J config file, for initialization and refresh checks. - Applied by Log4jConfigListener. --> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/conf/log4j.properties</param-value> </context-param> <!-- - Specifies to system where to find Spring bean definition files. - Applied by ContextLoaderListener. --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/conf/spring-beans.xml /WEB-INF/conf/services.xml</param-value> <description>Location of Spring application context configuration files</description> </context-param> <!-- - Configures Log4J for this web app. - As this context specifies a context-param "log4jConfigLocation", its file path - is used to load the Log4J configuration, including periodic refresh checks. - - Would fall back to default Log4J initialization (non-refreshing) if no special - context-params are given. - - Exports a "web app root key", i.e. a system property that specifies the root - directory of this web app, for usage in log file paths. - This web app specifies "esmart.root" (see log4j.properties file). --> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <!-- - Listener that creates a Spring ApplicationContext upon startup, populated by - the beans defined in the contextConfigLocation param above. --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- - Specifies a filter that opens and binds a Hibernate session to the current - thread for the lifetime of the request/response. --> <filter> <filter-name>Hibernate Filter</filter-name> <filter-class>org.springframework.orm.hibernate.support.OpenSessionInViewFilter</filter-class> <init-param> <param-name>sessionFactoryBeanName</param-name> <param-value>sessionFactory</param-value> </init-param> </filter> <filter-mapping> <filter-name>Hibernate Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- - Specifies a filter that redirects incoming requests to the - main Tapestry application servlet (ie. esmart application servlet) --> <filter> <filter-name>redirect</filter-name> <filter-class>org.apache.tapestry.RedirectFilter</filter-class> </filter> <filter-mapping> <filter-name>redirect</filter-name> <url-pattern>/</url-pattern> </filter-mapping> <servlet> <servlet-name>esmart</servlet-name> <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>esmart</servlet-name> <url-pattern>/app</url-pattern> </servlet-mapping> </web-app>
If you have any thoughts on this or similar experiences I'd like to hear them.
regards,
Scott


Reply With Quote