I'm trying to configure Logger to write to a file in the application configuration folder, but I'm not able to figure how to do so, here is the function I use to configure the logging output at program startup:
private void ConfigureLogger(){
Logger logger = Logger.getLogger(FormLogin.class.getName());
try{
FileHandler handler = new FileHandler(getConfigurationFolder()+"\\application.log", 10, 1, true);
logger.addHandler(handler);
}
catch(IOException e){
}
logger.log(Level.SEVERE, "test message");
}
The application.log file is created, but the test log is not written in it but in the console application.
catch(IOException e){ }might help{}with{ throw new RuntimeException(e); }