Log File not created using log4j2

Viewed 23

I changing my log4j lib from log4j to log4j2.

However, for the new log4j2, there is not log file created.

package log4j;

import java.io.IOException;
import java.sql.SQLException;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


public class Log4jExample {
    
    private static final Logger log = LogManager.getLogger(Log4jExample.class);
    
       public static void main(String[] args)throws IOException,SQLException{  
          log.info("log4j2");  
       }  
}

My properties file as below

status = info
property.basePath = D:/

appender.rolling.type = RollingFile
appender.rolling.name = fileLogger
appender.rolling.fileName= ${basePath}../app.log
appender.rolling.filePattern= ${basePath}/app_%d{yyyyMMdd}.log.gz
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} %level [%t] [%l] - %msg%n
appender.rolling.policies.type = Policies

And my project directory setting as per below

enter image description here

Can you guide me, what is wrong with the configuration or project directory setting?

1 Answers
logger.app.name = package_name
logger.app.level = info, error
logger.app.additivity = false
logger.app.appenderRef.rolling.ref = LogToRollingFile
Related