How can I redirect log4j logging from catalina.out to a separate file?
Created a log4j.properties file in my project as shown below, but no log file (test-service.log) is generated and log messages are logged in catalina.out directory, how to resolve this .......
log4j.debug = TRUE log4j.rootLogger = WARN, R log4j.appender.R = org.apache.log4j.RollingFileAppender log4j.appender.R.File = / opt / apache-tomcat-7.0.40 / logs / test-service.log log4j.appender.R.MaxFileSize = 1000KB log4j.appender.R.MaxBackupIndex = 5 log4j.appender.R.layout = org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern =% d {yyyy-MM-dd HH: mm: ss.SSSS} -% t-% x -% - 5p -% - 10c:% m% n
+1
source to share
1 answer
- Add log4j-1.2.17.jar to WEB-INF / lib.
- Move log4j.properties to the root of your src directory.
-
Initialize the registrar in your classes, for example:
private static final Logger LOG = Logger.getLogger (ClassName.class);
0
source to share