Configuring logging for the Transaction server

You can configure logging in the Transaction server Docker container by using one of two methods.

Procedure

  • Enable tracing in your target container by using Run Engine commands. There are different methods of implementation, and two sets of trace setting Run Engine command.
    Table 1. Run Engine commands to set trace level on the Transaction server Docker container
    Description Command
    Set the trace level for a running WebSphere Application Server application, which takes effect immediately. This trace level is reset to the default trace level upon restart.

    run set-dynamic-trace-specification spec

    spec
    The new logging trace specification.
    Note:
    • This method can be used to set the trace level on applications in containers that have already been started. If the HCL Commerce application is restarted within the running container, then the trace level that is set by this command is set back to the default level, or the level that is explicitly set by the set-trace-specification Run Engine command. This method is analagous to setting trace level within the Diagnostic Trace > Runtime tab within the WebSphere Application Server Administrative Console.
    • Use the reset-dynamic-trace-specification Run Engine command to clear any trace level that is set using this method.
    Set the default trace level for WebSphere Application Server applications. This will take effect after the next restart of the application and is persisted through any subsequent restart. run set-trace-specification spec
    spec
    The new logging trace specification.
    Note:
    • This method sets the trace level for any application, and takes effect the next time the application is started within the container. It will not apply to an already running application. This method is analagous to setting trace level within the Diagnostic Trace > Configuration tab within the WebSphere Application Server Administrative Console. To set the trace for a running application, you must use the set-dynamic-trace-specification Run Engine command.
    • set-trace-specification does not work when JSON/HPEL logging mode is enabled. You must create your own custom run engine command to set trace specification with this mode.
    Reset the trace level to its default value (*=information). run reset-dynamic-trace-specification

    Reset any trace level on a running HCL Commerce application that was set using the set-dynamic-trace-specification Run Engine command.

    Table 2. Examples of setting the trace level on the Transaction server Docker container
    Method Procedure
    Enabling trace in a running container in your local Docker environment. You do not need to restart the WAS JVM. Use this method on your local quality assurance or development environment.
    1. Enter your target container.
      docker exec -it container_name bash
    2. Set your trace specification. For example, the following command adds trace on ServiceLogger. For a list of specifications, see Trace strings.
      run set-trace-specification com.ibm.commerce.foundation.logging.ServiceLogger=FINEST
    3. Type exit to leave the container.
    4. Reproduce the issue.
    5. If you did not configure your Docker container to start with a volume mount to preserve logs in the Docker host machine, then run the following commands to make the trace available on the Docker host.
      docker cp container_name:/profile/logs/server1/trace.log /tmp/container_name_trace.log
    Creating a new Docker image to include the trace specification by default during start up. Use this method to create custom Docker images to set the trace specification by default. Then you can distribute the custom Docker image.
    1. Create a Dockerfile for the target Docker image.
    2. In the Dockerfile, define the Run Engine command to set your trace specification. For example,
      run set-trace-specification com.ibm.commerce.foundation.logging.ServiceLogger=FINEST
    3. Create a new Docker image with the Dockerfile.
    Providing the trace specification in an advanced system with orchestration tools and remote configuration center. This method also includes the trace specification by default during start up. Docker images can accept a TRACE_SPEC parameter value when starting the container. For more information about configuration parameters, see Docker container start up configuration parameters.
    1. Ensure that you configured your orchestration tool to retrieve configuration parameters from your Configuration center.
    2. In your Configuration center (such as Vault), define the trace specification in the TRACE_SPEC parameter.
    3. Now, when new containers are deployed, the containers will be configured with your trace specifications.
  • Enable tracing through the WebSphere Application Server Administrative Console. These steps are duplicated from theWebSphere Application Server documentation. For more information, see the Working with trace group of topics in the WebSphere Application Server documentation.
    1. Open the WebSphere Application Server Administrative Console.
      http://txn_hostname:9060/ibm/console
      or
      https://txn_hostname:9043/ibm/console
    2. Expand Troubleshooting > Logs and Trace. The Logging and Tracing page displays in the workspace on the right.
    3. Click the server for which you want to enable the tracing (such as 'server1'). The window refreshes to display the logging and tracing options for the server.
    4. Click Diagnostic Trace. The Diagnostic Trace Service window displays in the workspace.
    5. Click the Configuration or Runtime tab.
      Changes made to Configuration are stored on the file system and applied when the server starts. You must restart the server to pick up any changes. This is required for finding issues that originate or occur when the server is initiated. Modifications to Runtime are applied immediately and are lost after the server is restarted.
    6. Optional: Select Change Log Detail Levels to modify tracing configurations for components or packages.
      • For component-based traces, use the component names. For a list of component-based traces, see Trace strings.
      • For package-based loggers, find the package or class name and determine the appropriate logger name to use. Consider the following SolrSearchConfigurationRegistry class as an example,
        com.ibm.commerce.foundation.internal.server.services.search.config.solr.SolrSearchConfigurationRegistry
        Set the following trace specification:
        For class-level tracing, use the exact match to the package and class name. For example,
        com.ibm.commerce.foundation.internal.server.services.search.config.solr.SolrSearchConfigurationRegistry=all
      If you are tracing multiple log detail levels, separate the traces with a colon. For example:
      
      com.ibm.websphere.commerce.WC_SERVER=all:com.ibm.websphere.commerce.WC_ORDER=all
      

      Tracking all helps in diagnosing problems so that multiple traces can be avoided. As an alternative to all, classes can also use warning and info traces, where info contains the least trace impact.

    7. Click Apply > OK to apply the changes to your server. If you selected to change the log details levels on the Configuration tab, restart your server.
  • Trace components.

    The following table includes the trace strings that are available specifically for the Transaction server Docker container. In some cases, you might need to enable trace strings in multiple servers to fully troubleshoot a component. For more information, see the MustGather sections in Trace components.

    Component Trace string
    Access control
    com.ibm.websphere.commerce.WC_SERVER=all:
    com.ibm.websphere.commerce.WC_USER=all:
    com.ibm.websphere.commerce.WC_ACCESSCONTROL=all:
    com.ibm.commerce.foundation.logging.*=all
     
    Attribute Dictionary
    com.ibm.commerce.tools.*=all:
    com.ibm.commerce.catalog.*=all:
    com.ibm.commerce.foundation.*=all:
    com.ibm.websphere.commerce.WC_SERVER=all
    Catalog
    com.ibm.websphere.commerce.WC_CATALOG=all:
    com.ibm.commerce.foundation.*=all:
    com.ibm.websphere.commerce.WC_SERVER=all:
    com.ibm.commerce.foundation.client.lobtools.*=all:
    com.ibm.commerce.catalog.*=all
    Catalog filters
    com.ibm.commerce.catalog.*=all:
    com.ibm.commerce.catalogentry.*=all:
    com.ibm.commerce.contract.*=all:
    com.ibm.commerce.foundation.*=all:
    com.ibm.websphere.commerce.WC_CATALOG=all:
    com.ibm.websphere.commerce.WC_CONTRACT=all
    Commerce Composer
    *=info: 
    com.ibm.commerce.foundation.logging.*=all:
    com.ibm.commerce.pagelayout.*=all
    Cross site protection
    com.ibm.websphere.commerce.WC_SERVER=all:
    com.ibm.commerce.foundation.logging.*=all
    Data load
    • Data load framework trace
      com.ibm.commerce.foundation.dataload.*=all
    • Catalog data load
      com.ibm.commerce.catalog.dataload.*=all
    • Promotion data load
      com.ibm.commerce.promotion.dataload.*=all
    • Marketing data load
      com.ibm.commerce.marketing.dataload.*=all
    • Price data load
      com.ibm.commerce.price.dataload.*=all
    Dynamic Cache

    The following strings are useful for diagnosing cache-related problems on the Transaction server. The trace strings are listed from the highest-level and most important tracing to the most detailed.

    Each trace string creates some extra logging and can impact performance. To reduce the performance impact, remove the trace strings beginning from the end of the list, unless a particular string is required for diagnosing the initial issue.
    com.ibm.commerce.dynacache.commands.*=all:
    com.ibm.commerce.foundation.logging.*=all:
    com.ibm.commerce.datatype.*=all:
    com.ibm.websphere.commerce.WC_CACHE=all:
    com.ibm.ws.cache.*=all
    Management Center
    com.ibm.commerce.foundation.client.lobtools.*=all:
    com.ibm.commerce.foundation.logging.*=all
    Marketing
    com.ibm.websphere.commerce.WC_MARKETING=all:
    com.ibm.commerce.marketing.*=all:
    com.ibm.commerce.foundation.*=all:
    com.ibm.commerce.content.*=all:
    com.ibm.commerce.membergroup.*=all:
    com.ibm.websphere.commerce.WC_USER=all
    com.ibm.commerce.marketing.cache.*=all:
    com.ibm.commerce.store.marketing.*=all:
    com.ibm.commerce.foundation.logging.*=all
    Orders
    com.ibm.websphere.commerce.WC_ORDER=all:
    com.ibm.websphere.commerce.WC_CALCULATION=all:
    com.ibm.websphere.commerce.WC_EDP=all:
    com.ibm.websphere.commerce.WC_PPC=all:
    com.ibm.websphere.commerce.WC_INVENTORY=all:
    com.ibm.commerce.foundation.logging.*=all
    Orders (calculation framework)
    com.ibm.websphere.commerce.WC_ORDER=all:
    com.ibm.websphere.commerce.WC_CALCULATION=all:
    com.ibm.websphere.commerce.WC_MARKETING=all:
    com.ibm.commerce.foundation.logging.*=all
    Price rules
    com.ibm.commerce.foundation.*=all:
    com.ibm.commerce.price.*=all:
    com.ibm.websphere.commerce.WC_CONTRACT=all:
    com.ibm.websphere.commerce.WC_ORDER=all:
    com.ibm.commerce.catalog.*=all
    Promotion
    com.ibm.websphere.commerce.WC_ORDER=all:
    com.ibm.websphere.commerce.WC_CALCULATION=all:
    com.ibm.commerce.marketing.promotion.*=all:
    com.ibm.commerce.promotion.*=all:
    com.ibm.commerce.foundation.logging.*=all
    Search build index
    *=info:com.ibm.commerce.foundation.*=all:
    com.ibm.commerce.rest.*=all:
    com.ibm.commerce.catalog.facade.server.*=finest
    Search health check
    *=info:com.ibm.commerce.rest.*=finest
    Search rules
    :*=info:com.ibm.commerce.rest.*=all:
    com.ibm.commerce.marketing.*=all:
    com.ibm.commerce.foundation.*=all:
    com.ibm.commerce.catalog.*=finest
    Search Rules Based Sales Categories
    *=info:com.ibm.commerce.rest.*=all:
    com.ibm.commerce.marketing.*=all:
    com.ibm.commerce.foundation.*=all
    Search scheduled job for update index
    com.ibm.commerce.foundation.dataimport.*=all:
    com.ibm.commerce.foundation.logging.*=all
    SEO
    *=info:
    com.ibm.commerce.seo.*=all:
    com.ibm.commerce.foundation.logging.*=all
    Session Management
    com.ibm.websphere.commerce.WC_SERVER=all:
    com.ibm.websphere.commerce.WC_BUSINESSCONTEXT=all:
    com.ibm.websphere.commerce.WC_USER=all:
    com.ibm.websphere.commerce.WC_SESSIONMANAGEMENT=all:
    com.ibm.commerce.foundation.*=all
    User registration and login
    com.ibm.websphere.commerce.WC_SERVER=all:
    com.ibm.websphere.commerce.WC_USER=all:
    com.ibm.websphere.commerce.WC_ACCESSCONTROL=all:
    com.ibm.commerce.foundation.logging.*=all