Configuring Logging Levels with JVM Properties

In cloud native environments, change logging levels for MATRIXX applications and components with JVM properties.

For all MATRIXX applications, you can configure log levels in your Helm values file using this format:
subchartname.logging.level=level
Where:
  • sub-chart_name — The name of the sub-chart, such as rsgateway.
  • level — The logging level, such as debug.
For example, enter the following in your Helm values file the RS Gateway logging level:
rsgateway:
  logging:
    level: debug

If you want to limit log output, you can configure logging at the package level. The following sections describe how to configure logging at the package level for Spring Boot applications and non-Spring Boot applications.

Spring Boot Applications

For the following Spring Boot applications, configure logging by setting a JVM system property in your Helm values file:
  • RS Gateway
  • MATRIXX Backoffice Customer Tool
  • My MATRIXX
  • Event Streaming Framework
Set the JVM property using this format:
"-Dlogging.level.packageName=level"
Where:
  • packageName is a Java package name. For example:
    • RS Gatewaycom.matrixx.rsgateway.SendMessage
    • MATRIXX Backoffice Customer Toolcom.matrixx.cm
    • My MATRIXXcom.matrixx.data.AdminDataLoader
    • Event Streaming Frameworkcom.matrixx.eventStreamer
  • level is a valid log4j2 log level, for example, debug.
For example, to set the RS Gateway logging level using a JVM property, define the following in your Helm values file:
rsgateway:
  configuration:
    container:
      args:
        - "-Dlogging.level.com.matrixx.rsgateway.SendMessage=debug"

Non-Spring Boot Applications

For the non-Spring Boot applications Gateway Proxy and Notification Framework, you must create a ConfigMap in /opt/mtx/conf to pass a custom file (log4j2-custom.xml) with the logging levels.

Each application has an out-of-the-box configuration file that you should include in your JVM argument so that the configurations are additive and are not overwritten by your custom file. The out-of-the-box files and their locations are:
  • Gateway Proxy/opt/mtx/conf/log4j2-mtx_gateway_proxy.xml
  • Notification Framework/opt/mtx/conf/log4j2-mtx_notifier_camel.xml
Configure the following in your Helm values file:
sub-chart_name:
  configuration:
    container:
      configmap:
        customLog4j2FileName: |-
          <?xml version="1.0" encoding="UTF-8"?>
          <Configuration status="status" monitorInterval='interval'>
              <Loggers>
                  <Logger name="logger_name" level="level" />
                  <Logger name="logger_name" level="level" />
              </Loggers>
          </Configuration>
      args:
        - "-Dlog4j2.configurationFile=/opt/mtx/conf/customLog4j2FileName,/opt/mtx/conf/log4j2_file" 
Where:
  • sub-chart_name — The name of the sub-chart, such as rsgateway.
  • customLog4j2FileName — The name of your custom log4j2 file.
  • status — The level of internal log4j2 events that should be logged to the console. Valid values for this attribute are off, trace, debug, info, warn, error, fatal, and all. Log4j logs details about initialization, rollover and other internal actions to the status logger.
  • logger_name — The MATRIXX application logger name.
  • level — The logging level, such as debug.
  • log4j2_file — The out-of-the-box log4j2 configuration file.
For example, to configure the logging level for Gateway Proxy, enter the following in your Helm values file:
gateway-proxy:
  configuration:
    container:
      configmap:
        log4j2-custom.xml: |-
          <?xml version="1.0" encoding="UTF-8"?>
          <Configuration status="warn" monitorInterval='60'>
              <Loggers>
                  <Logger name="com.matrixx.gateway.minaIoHandlers.AuthClientHandler" level="debug" />
                  <Logger name="com.matrixx.gateway.engineInterface.EngineClient" level="trace" />
              </Loggers>
          </Configuration>
      args:
        - "-Dlog4j2.configurationFile=/opt/mtx/conf/log4j2-custom.xml,/opt/mtx/conf/log4j2-mtx_gateway_proxy.xml" 

Upgrade the Application

After you update your Helm values file, apply the configuration changes to the Kubernetes namespace containing these components with the following command:
helm upgrade [RELEASE] [CHART] [flags]
For example, the following command applies configuration changes in the matrixx-webapps-gateways_values.yaml file to the matrixx-webapps-gateways Kubernetes namespace:
helm upgrade ag1 matrixx/matrixx --namespace matrixx-webapps-gateways -f matrixx-webapps-gateways_values.yaml --version 5251

For more information about the MATRIXX environment variables, see the discussion about container directories and environment variables in MATRIXX Installation and Upgrade.