I am trying to migrate from log4j1.x to log4j2.x.
Followed this link - https://logging.apache.org/log4j/2.x/manual/migration.html
But I am not seeing logs are generated after changing it. I can't figure out what I am missing.
Here is the detail - Exisging log4j version -
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
This is replaced with -
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.6.2</version>
</dependency>
I can see log4j-1.2.17.jar is replaced with these four jars-
- log4j-jcl-2.6.2.jar
- log4j-core-2.1.jar
- log4j-api-2.1.jar
- log4j-1.2-api-2.6.2.jar
This is the existing configuration file (filename /usr/local/log4j.properties) -
log4j.rootLogger=INFO, file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/var/log/access.log
log4j.appender.file.MaxFileSize=5MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
Replaced this system property value -
logging.config=/usr/local/log4j.properties
with these two lines
log4j1.compatibility=true
log4j.configuration=/usr/local/log4j.properties