Tuesday, April 2, 2013

How to enable Logging in Spring MVC. 

To enable Logging in Spring MVC, Place the below log4j properties in to /WEB-ING/classes folder and add log4j.jar and common-logging.jar in to your lib it will automatically enable logging for your spring application and it displays log entries on console. 

log4j.rootLogger=INFO, CONSOLE

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.immediateFlush=true
log4j.appender.CONSOLE.target=System.out
log4j.appender.CONSOLE.threshold=DEBUG
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%p %t %c - %m%n

log4j.logger.org.springframework=DEBUG
log4j.logger.org.springframework.aop=DEBUG