I have question with regard to changing the name of the log file of the slf4j logger. In the logback.xml file this is set to myApp.log. I would like to to be able to change this filename each time I run my code in Java, where the name of the file is a combination of the settings for which I run the problem. As you can imagine, I rather have some code for this in Java, instead of each time changing this manually in the logback.xml file.
Change the name of a logging output file from Java in SLF4j
I have seen the thread in the link above, however this does seem to work for me. I currently implemented this as follows
/* Configure parameters */
Properties properties = new Properties();
Configuration.readFromFile(properties);
properties.setProperty("MAXTHREADS", "1");
properties.setProperty("EXPORT_MODEL", "false");
properties.setProperty("log4j.appender.debugFile.File", "test.log");
properties.setProperty("log4j.appender.infoFile.File", "test2.log");
properties.setProperty("log4j.appender.warnFile.File", "test3.log");
properties.setProperty("log4j.appender.errorFile.File", "test4.log");
If I run it with these settings, the output is still saved in myApp.log.
Any suggestions are welcome!