Dynamic Log path value in the Log4j2.properties

36 Views Asked by At

Facing issue while substituting the dynamic log path value in the external log4j2.properties in the Spring boot application during startup

here the log4j2.properties whhich is kept outside of the classpath ( in directory) .kindly help

Your response will help in resolving this issue.

status=warn
name=RollingFileLogConfig
property.basePath= ${sys:log.path}
appender.rolling.type = RollingFile
appender.rolling.name = applicationStart
appender.rolling.fileName= ${basePath}/Application.log

i am getting exception while i pass the value in the runtime of the application from the CMD

ERROR StatusConsoleListener Unable to create file ${sys:log.path}/Application.log java.io.IOException: The filename, directory name, or volume label syntax is incorrect

But if i try to set the value like this:

System.setProperty("logPath", "/test/path");
        SpringApplication.run(Application.class, args);

It is working but i try to get the value from the application.yml file log path is not creating ? help me on this

0

There are 0 best solutions below