Spring Pointer to Log4j Configuration File
From Kb
Contact Article Author | Blog of Article Author | FirstPartners.net Home | LinkedIn profile of Author
Spring Log4j
Add the following to the Spring appContext.xml to force Spring to pick up a Log4j configuration file from a specified location.
<bean id="log4jInitialization" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="targetClass" value="org.springframework.util.Log4jConfigurer" /> <property name="targetMethod" value="initLogging" /> <property name="arguments"> <list> <value>conf/log4j.xml</value> </list> </property> </bean>
or, You could also edit web.xml file to add the log4j configuration
<context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/log4j.properties</param-value> </context-param> <context-param> <param-name>log4jRefreshInterval</param-name> <param-value>1000</param-value> </context-param> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener>
Log4j General Configuration
- DailyRollingFileAppender allows rolling over of files based on a date / time pattern
Other Spring Related Articles
Spring MVC | Maven Information | Hibernate | Sending Web Email from Spring | Spring Pointer to Log4j Configuration File | Cron Timer functionality using Spring and Quartz | Customising Spring Property File Loading

