이 콘텐츠는 선택한 언어로 제공되지 않습니다.

17.3. Default logging configuration file


17.3.1. Overview of Logging Configuration

The default logging configuration file, logging.properties, is located in the InstallDir/etc directory. It configures the Apache CXF loggers to print WARNING level messages to the console. If this level of logging is suitable for your application, you do not have to make any changes to the file before using it. You can, however, change the level of detail in the log messages. For example, you can change whether log messages are sent to the console, to a file or to both. In addition, you can specify logging at the level of individual packages.
Note
This section discusses the configuration properties that appear in the default logging.properties file. There are, however, many other java.util.logging configuration properties that you can set. For more information on the java.util.logging API, see the java.util.logging javadoc at: http://download.oracle.com/javase/1.5/docs/api/java/util/logging/package-summary.html.

17.3.2. Configuring Logging Output

Overview

The Java logging utility, java.util.logging, uses handler classes to output log messages. Table 17.1, “Java.util.logging Handler Classes” shows the handlers that are configured in the default logging.properties file.
Expand
Table 17.1. Java.util.logging Handler Classes
Handler ClassOutputs 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 Apache CXF environment.

Configuring the console handler

Example 17.2, “Configuring the Console Handler” shows the code for configuring the console logger.

Example 17.2. Configuring the Console Handler

handlers= java.util.logging.ConsoleHandler
Copy to Clipboard Toggle word wrap
The console handler also supports the configuration properties shown in Example 17.3, “Console Handler Properties”.

Example 17.3. Console Handler Properties

java.util.logging.ConsoleHandler.level = WARNING 1
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter 2
Copy to Clipboard Toggle word wrap
The configuration properties shown in Example 17.3, “Console Handler Properties” can be explained as follows:
1
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 Section 17.3.3, “Configuring Logging Levels”). The default setting is WARNING.
2
Specifies the java.util.logging formatter class that the console handler class uses to format the log messages. The default setting is the java.util.logging.SimpleFormatter.

Configuring the file handler

Example 17.4, “Configuring the File Handler” shows code that configures the file handler.

Example 17.4. Configuring the File Handler

handlers= java.util.logging.FileHandler
Copy to Clipboard Toggle word wrap
The file handler also supports the configuration properties shown in Example 17.5, “File Handler Configuration Properties”.

Example 17.5. File Handler Configuration Properties

java.util.logging.FileHandler.pattern = %h/java%u.log 1
java.util.logging.FileHandler.limit = 50000 2
java.util.logging.FileHandler.count = 1 3
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter 4
Copy to Clipboard Toggle word wrap
The configuration properties shown in Example 17.5, “File Handler Configuration Properties” can be explained as follows:
1
Specifies the location and pattern of the output file. The default setting is your home directory.
2
Specifies, in bytes, the maximum amount that the logger writes to any one file. The default setting is 50000. If you set it to zero, there is no limit on the amount that the logger writes to any one file.
3
Specifies how many output files to cycle through. The default setting is 1.
4
Specifies the java.util.logging formatter class that the file handler class uses to format the log messages. The default setting is the java.util.logging.XMLFormatter.

Configuring both the console handler and the file handler

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 17.6, “Configuring Both Console Logging and File Logging”.

Example 17.6. Configuring Both Console Logging and File Logging

handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
Copy to Clipboard Toggle word wrap

17.3.3. Configuring Logging Levels

Logging levels

The java.util.logging framework supports the following levels of logging, from the least verbose to the most verbose:
  • SEVERE
  • WARNING
  • INFO
  • CONFIG
  • FINE
  • FINER
  • FINEST

Configuring the global logging level

To configure the types of event that are logged across all loggers, configure the global logging level as shown in Example 17.7, “Configuring Global Logging Levels”.

Example 17.7. Configuring Global Logging Levels

.level= WARNING
Copy to Clipboard Toggle word wrap

Configuring logging at an individual package level

The java.util.logging framework supports configuring logging at the level of an individual package. For example, the line of code shown in Example 17.8, “Configuring Logging at the Package Level” configures logging at a SEVERE level on classes in the com.xyz.foo package.

Example 17.8. Configuring Logging at the Package Level

com.xyz.foo.level = SEVERE
Copy to Clipboard Toggle word wrap
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat