is there a way to reconfigure tinylog2 properties after I already logged some lines ? I want to change the log file name during run, when the user changes selections (working with diferent files) ,without restart my program.
my code works only first time :
private void initLogger(String fileName) {
// log to file
Configuration.set("writer","file");
// set log file name
if (inFileCheckBox.isSelected()){ // log file name is working file name
Configuration.set("writer.file",fileName);
}else{ // log file name by month (MM-YYYY)
Configuration.set("writer.file", new SimpleDateFormat("MM-yyyy").format(new Date()));
}
Logger.info("yow it's : {}", fileName);
}
I tried to shutdown it manualy before I change parameter but it didn't help :
ProviderRegistry.getLoggingProvider().shutdown();
this is the error I get second time I run the method :
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Configuration cannot be changed after applying to tinylog
thanks!