[V9.0.1 Nov 2016]

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 which hosts the IBM® MQ Console and REST API. [V9.0.4 Oct 2017]From IBM MQ 9.0.4, you can configure logging by using the setmqweb command. In IBM MQ 9.0.3, and earlier, you can configure logging by editing the mqwebuser.xml file.

Before you begin

You must be a privileged user to complete this procedure.
[V9.0.4 Oct 2017]From IBM MQ 9.0.4,you can view the current configuration of the REST API logging by using the following command:
dspmqweb properties -a
The maxTraceFileSize field shows the maximum trace file size, the maxTraceFiles field shows the maximum number of trace files, and the traceSpec field shows the level of trace used. For more information, see dspmqweb.
[z/OS][V9.0.4 Oct 2017]Attention:

Before issuing 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 do this, 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.sh. For example:
export WLP_USER_DIR=/var/mqm/web/installation1

For more information, see Create the Liberty server definition.

About this task

The log files for the mqweb server can be found in one of the following directories:
  • [UNIX, Linux, Windows]On UNIX, Linux®, and Windows: MQ_DATA_DIRECTORY/web/installations/installationName/servers/mqweb/logs
  • [z/OS]On z/OS: WLP_user_directory/servers/mqweb/logs

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

For more information about enabling trace for the IBM MQ Console and REST API, see Tracing the IBM MQ Console and REST API.

Procedure

[V9.0.4 Oct 2017] Use one of the following methods to configure logging:
  • From IBM MQ 9.0.4, use the setmqweb properties command:
    • To set the maximum log file size, use the following command:

      setmqweb properties -k maxTraceFileSize -v size

      where size specifies the size, in MB, that each log file can reach. The default value is 20.

    • To set the maximum number of files to use for logging, use the following command:

      setmqweb properties -k maxTraceFiles -v max

      where max specifies the maximum number of files. The default value is 2.

    • To configure the level of logging that is used, use the following command:

      setmqweb properties -k traceSpec -v level

      where level is one of the values listed in Table 1. The table outlines the logging levels in increase 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.

      The default value is *=info. Change this value when IBM Service requests it.

      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
  • For IBM MQ 9.0.3 and earlier, edit the mqwebuser.xml file:
    1. Open the mqwebuser.xml file.
      The mqwebuser.xml file can be found in one of the following directories:
      • [UNIX, Linux, Windows]On UNIX, Linux, and Windows: MQ_DATA_DIRECTORY/web/installations/installationName/servers/mqweb
      • [z/OS]On z/OS: WLP_user_directory/servers/mqweb

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

    2. Configure logging:
      • To set the maximum log file size, add or edit the following line in the mqwebuser.xml file, within the <server> tags:

        <variable name="maxTraceFileSize" value="size" />

        where size specifies the size, in MB, that each log file can reach. The default value is 20.

      • To set the maximum number of files to use for logging, add or edit the following line in the mqwebuser.xml file, within the <server> tags:

        <variable name="maxTraceFiles" value="max"/>

        where max specifies the maximum number of files. The default value is 2.

      • To configure the level of logging that is used, add or edit the following line in the mqwebuser.xml file, within the <server> tags:

        <variable name="traceSpec" value="level"/>

        where level is one of the values listed in the Table 1 table.

        The table outlines the logging levels in increase 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.

        The default value is *=info. Change this value when IBM Service requests it.