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.
- console.log - This file contains the redirected standard output and standard error streams from the JVM process. This console output is intended for direct human consumption. The logging component writes major events to the standard output stream and errors to the standard error stream if you use the default consoleLogLevel configuration. The logging component also copies any messages that are written to the System.out stream to the standard output stream and any messages that are written to the System.err stream to the standard error stream if you use the default copySystemStreams configuration. The standard output and standard error streams 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, and its location can be altered only by using the LOG_DIR environment variable. For more information, see Administering Liberty from the command line.
- messages.log - This file contains all 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.
- trace.log - This file contains all messages that are written or captured by the logging component and any additional trace. 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
Attribute | Equivalent property | Description |
---|---|---|
logDirectory |
|
You can use this attribute to set a directory for all log files,
excluding the console.log file, but including FFDC. By default,
logDirectory is set to the LOG_DIR environment variable. The
default LOG_DIR environment variable path is
WLP_OUTPUT_DIR/serverName/logs. Avoid trouble: Use the LOG_DIR environment variable or
com.ibm.ws.logging.log.directory property rather than the logDirectory
attribute to configure the directory in which you want all the messages to be written. Otherwise, a
few messages are written initially in the logs directory by default, and then
the remaining messages are written to the specified directory based on your configuration. The
logDirectory attribute might be used to dynamically update the logs to the
specified directory while the server is running.
|
maxFileSize |
|
The maximum size (in MB) that a log file can reach before it is
rolled. The Liberty runtime does only 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 |
|
If an enforced maximum file size exists, this setting is used to
determine how many of each of the logs files 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 |
|
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. ![]() |
copySystemStreams |
|
If true, messages that are 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 |
|
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 it traces 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 |
|
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 |
|
The trace string is used to selectively enable trace. The default is *=info. |
traceFormat |
|
This attribute controls the format of the trace log. The default format for Liberty is ENHANCED. You can also use BASIC and ADVANCED formats as in the WebSphere Application Server traditional. |
hideMessage |
|
You can use this attribute to configure the messages that you want
to hide from the console.log and message.log files. If the
messages are configured to be hidden, then they are redirected to the trace.log
file. Note: Before you use this attribute, consider the
information that is given under the Unable to recognize the start of the server when the
hideMessage attribute is used to suppress the message section in the Developer Tools known restrictions topic.
|
<logging traceSpecification="*=audit:com.myco.mypackage.*=finest"/>
<component> = <level>
where <component> is the component for which to set a log detail level, and <level> is one of the valid logger levels (off, fatal, severe, warning, audit, info, config, detail, fine, finer, finest, all). Separate multiple log detail level specifications with colons (:).
- *
- Specifies all traceable code that is running in the application server, including the product system code and customer code.
- com.ibm.ws.*
- Specifies all classes with the package name beginning with com.ibm.ws.
- com.ibm.ws.classloader.JarClassLoader
- Specifies the JarClassLoader class only.
Version 6 and later logging level | Content / Significance |
---|---|
off | Logging is turned off. |
fatal | Task cannot continue and component, application, and server cannot function. |
severe | Task cannot continue but component, application, and server can still function. This level can also indicate an impending unrecoverable error. |
warning | Potential error or impending error. This level can also indicate a progressive failure (for example, the potential leaking of resources). |
audit | Significant event that affects server state or resources |
info | General information that outlines overall task progress |
config | Configuration change or status |
detail | General information that details subtask progress |
fine | Trace information - General trace + method entry, exit, and return values |
finer | Trace information - Detailed trace |
finest | Trace information - A more detailed trace that includes all the detail that is needed to debug problems |
all | All events are logged. If you create custom levels, all includes those levels, and can provide a more detailed trace than finest. |
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.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.
On all other platforms, all log files use the default encoding.