Configuring Logger Default Values with a Properties File

The default values for loggers and handlers can be set using a properties file. This example demonstrates a sample logging properties file.

For more information about logging properties, see the lib/logging.properties file in the JRE directory.

# Specify the handlers to create in the root logger # (all loggers are children of the root logger) # 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>

Comments

21 May 2010 - 4:51am by Kiran (not verified)

From this site i got some information

10 Jun 2010 - 2:43pm by gw (not verified)

Can you use unix envrionment variables in your logging.property file? If yes, then how to use them?

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.