0

I am new to log4j (well, specifically log4qt). I have implemented a DailyRollingFileAppender, and expected the file to be rolled over at the beginning of a new day - butthis does not seem to be happening.

Here is my .conf file:

log4j.rootLogger=debug, R

log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=logs/myapp.log
log4j.appender.R.DatePattern='.'yyyy-MM-dd
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{yyy-MM-dd HH:mm:ss.SSS} [%p] %c:%L - %m%n

Can anyone spot why the file is not being rolled over ?

Homunculus Reticulli
  • 65,167
  • 81
  • 216
  • 341

1 Answers1

0

It could be because of your file path. Other threads on this site seem to be suggesting that if you do not specify a root directory, log4j can use either the user's or the container's home directory.

Try: log4j.appender.R.File=/full/path/to/logs/myapp.log

Alternatively, use a variable.

Or at least: log4j.appender.R.File=./logs/myapp.log

user3341082
  • 113
  • 3
  • 13