The Java logging utility, java.util.logging
, uses handler classes to output log messages. Table 7.1 shows
the handlers that are configured in the default logging.properties
file.
Table 7.1. Java.util.logging Handler Classes
Handler Class | Outputs to |
---|---|
ConsoleHandler
| Outputs log messages to the console |
FileHandler
| Outputs log messages to a file |
![]() | Important |
---|---|
The handler classes must be on the system classpath in order to be installed by the Java VM when it starts. This is done when you set the FUSE Services Framework environment. For details on setting the FUSE Services Framework environment, see Using the FUSE Services Framework Environment Script. |
Example 7.2 shows the code for configuring the console logger.
The console handler also supports the configuration properties shown in Example 7.3.
The configuration properties shown in Example 7.3 can be explained as follows:
The console handler supports a separate log level configuration property. This allows you to limit the log messages printed to the
console while the global logging setting can be different (see Configuring Logging Levels). The default setting is
| |
Specifies the |
Example 7.4 shows code that configures the file handler.
The file handler also supports the configuration properties shown in Example 7.5.
The configuration properties shown in Example 7.5 can be explained as follows:
Specifies the location and pattern of the output file. The default setting is your home directory. | |
Specifies, in bytes, the maximum amount that the logger writes to any one file. The default setting is | |
Specifies how many output files to cycle through. The default setting is | |
Specifies the |
You can set the logging utility to output log messages to both the console and to a file by specifying the console handler and the file handler, separated by a comma, as shown in Example 7.6.
Example 7.6. Configuring Both Console Logging and File Logging
handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler