I'm working in an API Rest, and I need to have an specific log file named like my organization. When I'm creating or editing an organization my API must create its file if isn’t exists and then save its data. I already have this parameters in my application.properties with a default path file.
logging.file=/Users/xxxxxxxxx/application.log
In my Java class, specifically in my edit method I'm creating the file if isn’t created.
String fileLog = "/Users/xxxxxxxxxxxx/logs/" + orgId + ".log";
File file = new File(fileLog);
BufferedWriter bw;
if (!file.exists()) {
// crea el archivo para la Org si no existe
bw = new BufferedWriter(new FileWriter(file));
}
Finally I set the default definition of my (logging.file), defining the new log file for this organization.
PropertiesConfiguration config = new
PropertiesConfiguration("/Users/xxxxxxxx/application.properties");
config.setProperty("logging.file", "/Users/xxxxxxxxxxxx/logs/" +
orgId + ".log");
config.save();
My last problem is: How to reset the log manager without restart my server?