Configuring logging

You can configure the logging levels, maximum log file size, and the maximum number of log files that are used by the mqweb server that hosts the IBM® MQ Console and REST API. You can configure logging by using the setmqweb command.

Before you begin

To complete this task, you must be a user with certain privileges so that you can use the dspmqweb and setmqweb commands:
  • [z/OS]On z/OS®, you must have authority to run the dspmqweb and setmqweb commands, and write access to the mqwebuser.xml file.
  • [UNIX, Linux, Windows, IBM i]On all other operating systems, you must be a privileged user.
  • [Linux][MQ 9.3.5 Feb 2024]If the mqweb server is part of a stand-alone IBM MQ Web Server installation, you must have write access to the mqwebuser.xml file in the IBM MQ Web Server data directory.
[z/OS]Attention:

Before you issue either the setmqweb or dspmqweb commands on z/OS, you must set the WLP_USER_DIR environment variable so that the variable points to your mqweb server configuration.

To set the WLP_USER_DIR environment variable, issue the following command:
export WLP_USER_DIR=WLP_user_directory
where WLP_user_directory is the name of the directory that is passed to crtmqweb. For example:
export WLP_USER_DIR=/var/mqm/web/installation1

For more information, see Create the mqweb server.

[Linux][MQ 9.3.5 Feb 2024]Attention:

Before you issue either the setmqweb or dspmqweb commands in a stand-alone IBM MQ Web Server installation, you must set the MQ_OVERRIDE_DATA_PATH environment variable to the IBM MQ Web Server data directory.

About this task

The mqweb server writes log messages and trace to the following log files:
console.log and messages.log
These files contain messages that are issued by the IBM MQ Console, the REST API, and the mqweb server that runs these components.
trace.log
This file contains trace for the IBM MQ Console and the REST API. Trace is written to this file only if trace is enabled.
The log files for the mqweb server can be found in one of the following directories:
  • In an IBM MQ installation:
    • [AIX][Linux]On AIX® or Linux®: /var/mqm/web/installations/installationName/servers/mqweb/logs
    • [Windows]On Windows: MQ_DATA_PATH\web\installations\installationName\servers\mqweb\logs, where MQ_DATA_PATH is the IBM MQ data path. This path is the data path that is selected during the installation of IBM MQ. By default, this path is C:\ProgramData\IBM\MQ.
    • [z/OS]On z/OS: WLP_user_directory/servers/mqweb/logs

      where WLP_user_directory is the directory that was specified when the crtmqweb script ran to create the mqweb server definition.

  • [MQ 9.3.5 Feb 2024][Linux]In a stand-alone IBM MQ Web Server installation: MQ_OVERRIDE_DATA_PATH/web/installations/MQWEBINST/servers/mqweb/logs

    where MQ_OVERRIDE_DATA_PATH is the IBM MQ Web Server data directory that the MQ_OVERRIDE_DATA_PATH environment variable points to.

Messaging trace files for the messaging REST API code that runs in the mqweb server can be found in one of the following directories:
  • In an IBM MQ installation:
    • [AIX][Linux]On AIX or Linux: /var/mqm/web/installations/installationName/servers/mqweb
    • [Windows]On Windows: MQ_DATA_PATH\web\installations\installationName\servers\mqweb, where MQ_DATA_PATH is the IBM MQ data path. This path is the data path that is selected during the installation of IBM MQ. By default, this path is C:\ProgramData\IBM\MQ.
    • [z/OS]On z/OS: WLP_user_directory/servers/mqweb

      where WLP_user_directory is the directory that was specified when the crtmqweb script ran to create the mqweb server definition.

  • [MQ 9.3.5 Feb 2024][Linux]In a stand-alone IBM MQ Web Server installation: MQ_OVERRIDE_DATA_PATH/web/installations/MQWEBINST/servers/mqweb

    where MQ_OVERRIDE_DATA_PATH is the IBM MQ Web Server data directory that the MQ_OVERRIDE_DATA_PATH environment variable points to.

For more information about enabling trace for the:

Procedure

  • View the current configuration of the REST API logging by using the following command:

    dspmqweb properties -a

    • The maxTraceFileSize field shows the maximum log file size
    • The maxTraceFiles field shows the maximum number of log files
    • The traceSpec field shows the level of trace that is used
    • The maxMsgTraceFileSize field shows the maximum messaging trace file size
    • The maxMsgTraceFiles field shows the maximum number of messaging trace files
  • Configure the maximum size of the messages.log and trace.log files:
    • Set the maximum log file size by using the following command:

      setmqweb properties -k maxTraceFileSize -v size

      where size specifies the size, in MB, that each log file can reach.

    • Reset the maximum log file size to the default value of 20 MB by using the following command:

      setmqweb properties -k maxTraceFileSize -d

  • Configure the maximum number of the messages.log and trace.log files:
    • Set the maximum number of each log file by using the following command:

      setmqweb properties -k maxTraceFiles -v max

      where max specifies the maximum number of files.

    • Reset the maximum number of each log file to the default value of 2 by using the following command:

      setmqweb properties -k maxTraceFiles -d

  • Configure the maximum messaging trace file size:
    • Set the maximum messaging trace file size by using the following command:

      setmqweb properties -k maxMsgTraceFileSize -v size

      where size specifies the size, in MB, that each messaging trace file can reach.

    • Reset the maximum messaging trace file size to the default value of 200 MB by using the following command:

      setmqweb properties -k maxMsgTraceFileSize -d

  • Configure the maximum number of messaging trace files to use:
    • Set the maximum number of files to use for messaging trace by using the following command:

      setmqweb properties -k maxMsgTraceFiles -v max

      where max specifies the maximum number of files.

    • Reset the maximum number of files to use for messaging trace to the default value of 5 by using the following command:

      setmqweb properties -k maxMsgTraceFiles -d

  • Configure the level of trace that the mqweb server writes:
    • Set the trace specification that is used by using the following command:

      setmqweb properties -k traceSpec -v level

      where level is one of the values that are listed in Table 1. The table outlines the logging levels, ordered by increasing level of detail. When you enable a logging level, you also enable each level before it. For example, if you enable the *=warning logging level, you also enable *=severe, and *=fatal logging levels.

      Change this value when requested by IBM Support.

    • Reset the trace specification that is used to the default value of *=info by using the following command:

      setmqweb properties -k traceSpec -d

    Table 1. Valid logging levels
    Value Logging level applied
    *=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 affecting server state or resources
    *=info General information outlining overall task progress
    *=config Configuration change or status
    *=detail General information detailing 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