Configuring log rotation

The log rotation parameters define the log level for messages, maximum log file size in megabytes (MB), and the maximum backup count of log files.

About this task

Log rotation parameters can be configured centrally for all components or separately in their respective configuration files. By default, the log rotation parameters that are defined in the HostFactory service file is propagated to all requestor and provider instances.

The packaged log rotation settings are set to use the propagated values from the host factory service.

A requestor instance uses these propagated values from the host factory parameters when the requestor instance does not specify the log rotation settings in its configuration files. If a requestor instance has its own local log rotation settings, then the requestor instance overrides the propagated values from the host factory.

A provider instance uses these propagated values from the host factory parameters if the ACCEPT_PROPAGATED_LOG_SETTING parameter is set to true. Otherwise, when the value of the ACCEPT_PROPAGATED_LOG_SETTING parameter is set to false, the provider instance uses the log settings from the log4j.xml file available in the configuration folder. For more information about the propagated log settings from the log4j.xml, see the MaxFileSize and MaxBackupIndex parameters in the LoggerAppenderRollingFile and the Loggers references available in the Apache log4php documentation.

Procedure

Configuring log rotation for host factory

Procedure

  1. Open the HostFactory service configuration file: hostfactoryconf.json
  2. Configure the HostFactory service log rotation parameters HF_LOGLEVEL, HF_LOG_MAX_FILE_SIZE, and HF_LOG_MAX_ROTATE.
      “HF_LOGLEVEL”: “LOG_INFO”,
      "HF_LOG_MAX_FILE_SIZE": 50,
      "HF_LOG_MAX_ROTATE": 10,
    By default, the log rotation parameters configured here are propagated to all requestor and provider instances.
  3. Start the host factory.

Configuring log rotation for requestor instances

Procedure

  1. Open the requestor instance configuration file: requestorname_config.json ($HF_CONFDIR/providers/cwsAinst/).
  2. Remove the log setting parameters from the requestorname_config.json for example (cwsinstreq_config.json) to accept the log rotation configuration from the HostFactory service configuration.
  3. Alternatively, to reject the log rotation configuration propagated from the HostFactory service configuration, include the log setting parameters in the requestorname_config.json and configure the parameters that you want for the requestor instance:
    "LoggingLevel": "LOG_INFO",
    "LoggingFileSizeLimitMB": 10,
    "LoggingFileNumLimit": 5,

Configuring log rotation for provider instances

Procedure

  1. Open the provider instance configuration file that you want to configure:
  2. Set the ACCEPT_PROPAGATED_LOG_SETTING parameter to false to reject log rotation parameters propagated from host factory:
    "ACCEPT_PROPAGATED_LOG_SETTING": "false"
  3. Configure the log settings in the log4j.XML file available in the configuration folder of the provider instance:
    1. Configure the MaxFileSize and MaxBackupIndex parameters. For more information, see the MaxFileSize and MaxBackupIndex parameter in the LoggerAppenderRollingFile and the Loggers references available in the Apache log4php documentation.
          <param name="MaxFileSize" value="10MB"/>
          <param name="MaxBackupIndex" value="5"/>
          <priority value="DEBUG"/>