I am having a CommandLineRunner Spring Boot applicatio nwith Sytem property log_prefix.
I am currently using a log24j.xml for setting the log configurations. It is taking the filename etc from the <properites>
tag in the log24j.xml. Is there a way to change the log fileName to log_prefix_LogFileName ?
My Application.class
@SpringBootApplication
public class Application implements CommandLineRunner {
static Logger log = Logger.getLogger(Application.class.getName());
public static void main(String[] args) {
System.setProperty("log_prefix",args[0]);// Tried hardcoding a string value
SpringApplication springApplication = new SpringApplication(Application.class);
springApplication.run(args);
}
I tried setting runID in Application.class
and using ${log_prefix}
in log42j.xml but not working.
Pom.xml log4j2 dependency.
<log4j2.version>2.15.0</log4j2.version>
I am using @Slf4j
lombok annotaion over the class
import lombok.extern.slf4j.Slf4j;
@Slf4j