1

In my java web application I would like to create daily zipped log and keep an active log that gets overwritten everyday.

I set log4j.properties in this way

log4j.appender.logFile=org.apache.log4j.rolling.RollingFileAppender  
log4j.appender.logFile.rollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy  
log4j.appender.logFile.rollingPolicy.ActiveFileName=../data/operations.log  
log4j.appender.logFile.rollingPolicy.FileNamePattern=../janus_data/operations.%d{dd}.log.zip
log4j.appender.logFile.layout=org.apache.log4j.PatternLayout  
log4j.appender.logFile.layout.ConversionPattern=%d %m%n

When I try to force the date changing it in windows, this works properly. In a real situation this is not working. I find just the active file operations.log

I tried to create a file every minute and this works correctly. I even tried to use different date format, but it never works.

Can anyone help me?

Thank you

  • [This question](http://stackoverflow.com/questions/5117758/configuring-rollingfileappender-in-log4j) might be helpful to you. – D.B. Oct 09 '16 at 23:15

0 Answers0