Customizing log4j2

All configuration for logging framework is now done programmatically during application startup.

About this task

To make any changes to log4j2 configuration, do the following steps.

Procedure

  1. Refer log4j2.xml.sample (<runtime>/properties/log4j2.sample.xml) to see what configurations are done for logging, by the application.
    Note: This file is a sample file and no support is intended for usage of this file. IBM can change this sample in its own discretion in future.
  2. To make additional configurations, define the following properties.
    
    yfs.log4j2.customPackages=<provide a comma separated list of package names>
    yfs.log4j2.customPackage.<packagename>.level= <logging level for the logger>
    

    The second property is optional, by default loggers are defined for all the packages provided in the first property with a level VERBOSE. If you wish to choose a different level for a certain package or packages, define the second property for each package requiring a different logging level instead of VERBOSE.

  3. Optionally, in addition to defining packages, you can make any other configurations in log4j2_extra.xml (<runtime>/properties/log4j2_extra.xml).
  4. Optionally, you can decide to disable the programmatic configuration by adding following property to customer_overrides.
    yfs.log4j2.omsConfig.disable=true

    If you disable the programmatic configuration, you must copy the contents of log4j2.sample.xml to log4j2_extra.xml and then change the log4j2_extra.xml file as needed.