Liberty profile: Logging and Trace

The product has a unified logging component that handles messages that are written by the product and provides First Failure Data Capture (FFDC) services.

Additionally, the logging component captures messages that are written to System.out, System.err, java.util.logging, and OSGi logging. The logging component unifies the handling of these messages with other messages written by the product. The logging component is not capable of capturing messages that are written directly by the JVM process, such as -verbose:gc output.

There are three primary log files for a server:
  1. console.log - containing the redirected standard output and standard error from the JVM process, and this console output is intended for direct human consumption. The console output contains major events and errors if you use the default consoleLogLevel configuration. The console output also contains any messages that are written to the System.out and System.err streams if you use the default copySystemStreams configuration. Finally, the console output always contains messages that are written directly by the JVM process, such as -verbose:gc output. This file is created only if the server start command is used. For more information, see Administering the Liberty profile from the command prompt.
  2. messages.log - containing all messages except trace messages that are written or captured by the logging component. All messages that are written to this file contain additional information such as the message time stamp and the ID of the thread that wrote the message. This file does not contain messages that are written directly by the JVM process.
  3. trace.log - containing all messages that are written or captured by the product. This file is created only if you enable additional trace. This file does not contain messages that are written directly by the JVM process.

Logging configuration

The logging component can be controlled through the server configuration. The primary location for the logging configuration is in the server.xml file. Occasionally, you might need to configure trace to diagnose a problem that occurs before the server.xml file is processed. In this case, the equivalent configuration properties can be specified in the bootstrap.properties file. If a configuration property is specified in both the bootstrap.properties file and the server.xml file, the value in bootstrap.properties is used until the server.xml file is processed. Then, the value in the server.xml file is used. You should avoid specifying different values for the same configuration property in both the bootstrap.properties and the server.xml file.
Table 1. Logging properties for the Liberty profile. Column 1 contains attributes that can be set in the server.xml file. Column 2 contains equivalent properties that can be used in the bootstrap.properties file. Column 3 provides a description of each logging property.
Attribute Equivalent property Description
logDirectory
com.ibm.ws.logging
.log.directory
This attribute sets the directory for all log files, including FFDC.
Note: By default, logDirectory is set to the LOG_DIR environment variable. The LOG_DIR environment variable is set to WLP_OUTPUT_DIR/serverName/logs by default.
maxFileSize
com.ibm.ws.logging
.max.file.size
The maximum size (in MB) that a log file can reach before being rolled. The Liberty profile runtime only does size-based log rolling. To disable this attribute, set the value to 0. The maximum file size is approximate. By default, the value is 20.
Note: maxFileSize does not apply to the console.log file.
maxFiles
com.ibm.ws.logging
.max.files
If an enforced maximum file size exists, this setting is used to determine how many of each log file are kept. This setting also applies to the number of exception logs that summarize exceptions that occurred on any particular day. So if this number is 10, you might have 10 message logs, 10 trace logs, and 10 exception summaries in the ffdc/ directory. By default, the value is 2.
Note: maxFiles does not apply to the console.log file.
consoleLogLevel
com.ibm.ws.logging
.console.log.level
This filter controls the granularity of messages that go to the console.log file. The valid values are INFO, AUDIT, WARNING, ERROR, and OFF. By default, the level is AUDIT.
For distributed platforms Note: Before changing this value, consider the information in section "Unable to interact with the Liberty profile server after modifying the console log level settings" in the topic Liberty profile: Developer Tools known restrictions.
copySystemStreams
com.ibm.ws.logging.
copy.system.streams
If true, messages written to the System.out and System.err streams are copied to console.log. If false, those messages are written to configured logs such as messages.log or trace.log, but they are not copied to console.log. The default value is true.
messageFileName
com.ibm.ws.logging
.message.file.name
The message log has a default name of messages.log. This file always exists, and contains INFO and other (AUDIT, WARNING, ERROR, FAILURE) messages in addition to System.out and System.err. This log also contains time stamps and the issuing thread ID. If the log file is rolled over, the names of earlier log files have the format messages_timestamp.log
suppressSensitiveTrace   The server trace can expose sensitive data when tracing untyped data, such as bytes received over a network connection. This attribute, when set to true, prevents potentially sensitive information from being exposed in log and trace files. The default value is false.
traceFileName
com.ibm.ws.logging
.trace.file.name
The trace.log file is only created if additional or detailed trace is enabled. stdout is recognized as a special value, and causes trace to be directed to the original standard out stream.
traceSpecification
com.ibm.ws.logging
.trace.specification
The trace string is used to selectively enable trace. The default is *=info.
traceFormat
com.ibm.ws.logging
.trace.format
This attribute controls the format of the trace log. The default format for the Liberty profile is ENHANCED. You can also use BASIC and ADVANCED formats as in the full profile.
You can set logging properties in the server configuration file by selecting Logging and Tracing in the Server Configuration view in the developer tools, or by adding a logging element to the server configuration file as follows:
<logging traceSpecification="*=audit:com.myco.mypackage.*=debug"/>

For details of the trace specification format, see Log level settings.

The console.log file does not have the same level of management as other log files. The only property that you can change is consoleLogLevel. If you are concerned about the increasing size of the console.log file, you can disable the console.log file and use the message log file instead. The same data, in a different format, is written to the message log file, and you can control the size and number of message log files by using the maxFileSize and maxFiles attributes. For example, the following bootstrap.properties file results in a console.log file that contains one line and a maximum of three rolling 1 MB loggingMessages.log files. Settings in the bootstrap.properties file take effect before the message log file is created, so the message log file is initially created as loggingMessages.log and not the default messages.log.
   com.ibm.ws.logging.max.file.size=1
   com.ibm.ws.logging.max.files=3
   com.ibm.ws.logging.console.log.level=OFF
   com.ibm.ws.logging.message.file.name=loggingMessages.log
The console.log file is reset when the server is restarted.
Note: On all platforms, logs are written in the default system encoding.
  • For z/OS platforms On z/OS® systems, the console.log file uses the default code page, and all other log files uses ISO8859-1 encoding and are tagged as text files with that encoding. If the z/OS UNIX System Services (USS) automatic code page conversion feature is active, you can use standard editors and text utilities to view the log files that are encoded with ISO8859-1.
  • For Windows platforms On Windows systems, there are two types of encoding: OEM code page, which is used for console output, and ANSI code page, which is used to read and write files. The console.log file uses the OEM code page, and all other logs use the ANSI code page.
  • For distributed platforms On all other platforms, all log files use the default encoding.

Icon that indicates the type of topic Reference topic

Terms and conditions for information centers | Feedback


Timestamp icon Last updated: Monday, 21 April 2014
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-nd-mp&topic=rwlp_logging
File name: rwlp_logging.html