I want my Logger with a FileHandler to use the settings defined in my config file. Do I have to use Logger.getLogger or Logger.addHandler(new FileHandler()) after I have used LogManager.readConfiguration(InputStream) or is there more to it? In other words, what is the order that I am supposed to do the following 3 things (getLogger, addHandler, readConfigurations) assuming it has to do with the order and isn't something else?
I wasn't able to find many examples of this and the ones I found had the LogManager.readConfiguration after Logger.getLogger, but that doesn't seem to work.
Here is the config file:
handlers = java.util.logging.FileHandler
.level = ALL
# Default
java.util.logging.FileHandler.limit = 10000000
java.util.logging.FileHandler.count = 10
java.util.logging.FileHandler.append = true
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level = FINE
EDIT: Here is the part of the code relating to the configuration.
String configFilename = "C:\\Users\\dalawh\\Documents\\config.properties";
LogManager manager = LogManager.getLogManager();
String property = manager.getProperty(this.getClass().getPackage().getName()); //DEBUGGING
LogManager.getLogManager().readConfiguration(new FileInputStream(configFilename));
String property2 = manager.getProperty(this.getClass().getPackage().getName()); //DEBUGGING
Logger logger = java.util.logging.Logger.getLogger(this.getClass().getPackage().getName());
String property3 = manager.getProperty(this.getClass().getPackage().getName()); //DEBUGGING
String filename = "C:\\Users\\dalawh\\Documents\\log.log";
this.fileHandler = new FileHandler(filename);
this.logger.addHandler(this.fileHandler);