Configuring Logger Default Values with a Properties File : Config Properties « Log « Java Tutorial





# The following creates two handlers
handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
    
# Set the default logging level for the root logger
.level = ALL
    
# Set the default logging level for new ConsoleHandler instances
java.util.logging.ConsoleHandler.level = INFO
    
# Set the default logging level for new FileHandler instances
java.util.logging.FileHandler.level = ALL
    
# Set the default formatter for new ConsoleHandler instances
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
    
# Set the default logging level for the logger named com.mycompany
com.mycompany.level = ALL

The custom logging properties file is loaded by specifying a system property on the command line:

java -Djava.util.logging.config.file=mylogging.properties <class>










35.6.Config Properties
35.6.1.Configuring Logger Default Values with a Properties File
35.6.2.config.properties
35.6.3.#define the properties for the SocketHandler