I am migrating from log4j 1.x to log4j2 in my spring boot application. Being on log4j 1.x I used to define the properties as follows: in my CustomRollingFileAppender I would extend this class with the DailyRollingFileAppender, and would override the setName() method to change my ‘<base.path>’ to the relevant directory name. Migrating to log4j 2.x I no longer have the
Tag: rollingfileappender
log4j2 change Rolling file appender max files programmatically
I am working on an application that uses log4j2 (initializes the parameters using log4j2.xml) and loads the logger. When the application runs, I am required to programmatically override a few parameters such as changing the log level and rolling file appender properties. I am able to change the log level using Now I tried to tackle the same problem using
log4j configurations with daily rolling, gzip and max backup files
Is there an appender that I can use that will get me daily rolling, compression and max files? I can get daily rolling file with compression using apache-log4j-extras with this configuration: But I can’t specify MaxBackupIndex as in org.apache.log4j.RollingFileAppender (note the slight namespace difference between the two). I would like both without having to implement my own FileAppender, TriggeringPolicy, or