[AIX][Windows][MQ 9.4.0 Jun 2024][MQ 9.4.0 Jun 2024][Linux]

Enabling JSON formatted logs for MQTT

To enable JSON format error logging, you need to modify the MQTT configuration files mqxrtraceOn.properties and mqxrtraceOff.properties.

About this task

You can configure JSON format logging to be used exclusively, or simultaneously, alongside text-based error logging.
Note: Once you have modified the configuration files, you need to restart the MQTT service for any changes to come into effect.

Procedure

  1. To enable JSON format logging exclusively, modify the mqxrtraceOn.properties and mqxrtraceOff.properties configuration files and update the handlers property as follows:
    handlers= com.ibm.mq.util.logging.MQJSONErrorLogFileHandler
  2. To enable JSON format logging simultaneously alongside text-based error logging, modify the mqxrtraceOn.properties and mqxrtraceOff.properties configuration files and update the handlers property as follows:
    handlers= com.ibm.mq.util.logging.MQErrorLogFileHandler, com.ibm.mq.util.logging.MQJSONErrorLogFileHandler

Results

In either case, this enables JSON format error logging, and configures the logger with its following default properties:
  • com.ibm.mq.util.logging.MQJSONErrorLogFileHandler.level
  • com.ibm.mq.util.logging.MQJSONErrorLogFileHandler.filter
  • com.ibm.mq.util.logging.MQJSONErrorLogFileHandler.limit
  • com.ibm.mq.util.logging.MQJSONErrorLogFileHandler.count
  • com.ibm.mq.util.logging.MQJSONErrorLogFileHandler.append
  • com.ibm.mq.util.logging.MQJSONErrorLogFileHandler.permissions
  • com.ibm.mq.util.logging.MQJSONErrorLogFileHandler.formatter
  • com.ibm.mq.util.logging.MQJSONErrorLogFileHandler.pattern

Functionally, these properties work identically to the text-based error logger configured by the com.ibm.mq.util.logging.MQErrorLogFileHandler.