Configuring logging for runtime environments

You can manage logging and tracing configurations in your runtime environments by using Run Engine commands.

About this task

You can use Run Engine commands to configure tracing in the Search, Store, and Customization servers. To configure tracing in the Transaction server, you either use the Open Liberty Server Administrative console or use Run Engine commands.

Procedure

You have several choices for how you use the Run Engine, depending on your environment and needs:
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. For example,
    docker exec -it <container_name> bash
  2. Set your trace specification. For example, the following command adds trace on ServiceLogger.
    run set-trace-specification com.ibm.commerce.foundation.logging.ServiceLogger=FINEST
  3. Type exit to leave the container.
  4. 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.
    • For Store/Search/Customization server:
      docker cp <container_name>:/profile/logs/trace.log /tmp/store_trace.log
    • For Transaction server:
      docker cp <txn_container_name>:/profile/logs/server1/trace.log /tmp/app_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.
  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.