Reputation: 412
I use Log4J to log application runtime process. Here is my log4j.properties file:
log4j.rootLogger=INFO, DailyRollingFile
log4j.appender.DailyRollingFile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DailyRollingFile.File=${CATALINA_HOME}/logs/fnservice.log
log4j.appender.DailyRollingFile.append = true
log4j.appender.DailyRollingFile.DatePattern='.'yyyy-MM-dd
log4j.appender.DailyRollingFile.layout=org.apache.log4j.PatternLayout
log4j.appender.DailyRollingFile.layout.ConversionPattern=%d{HH:mm:ss} %-5p %t %c{1} %M:%L - %m%n'
I have deployed application on Tomcat and invoked some it's methods to get log messages. After these manipulations, into ${CATALINA_HOME}/logs folder I got a few .log files:
In my application I get loggers as:
//the code inside the MyClass class
Logger LOG = Logger.getLogger(MyClass.class);
Also I try to log messages with INFO and ERROR level.
As a result I get listed files and no one contains my log messages. And it seems that rolling does not work too.
Upvotes: 0
Views: 1065
Reputation: 412
I solved the issue by interchanging a line in my log4j.properties
by
log4j.appender.DailyRollingFile.File=${catalina.home}/logs/fnservice.log
Upvotes: 0