My web application is running in tomcat 6. Currently all my log.info statements are added to catalina.out. Is there any way so that when an exception occurs it should go to my custom file called applicationExceptions.log file?
Update log4j.properties
with the following and check.
# add an extra category to a log file
log4j.category.yourPackage=ERROR,ERR
# Skip to write default logger
log4j.additivity.yourPackage=false
# ERR is set to be a FileAppender which will log Error actions in the application.
log4j.appender.ERR=org.apache.log4j.RollingFileAppender
log4j.appender.ERR.Threshold=ERROR
log4j.appender.ERR.layout=org.apache.log4j.PatternLayout
log4j.appender.ERR.file=logs/error.log
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.