Configure logging for the Store server
We can configure logging in the Store server Docker container by using Run Engine commands.Note:
When you work with IBM to debug request processing problems, there might be occasions where low-level tracing components must be enabled to capture details for how the request is processed. These low-level Application server trace components do not know the request intent or the potential data within. Therefore, when enabled, it is possible that these tracing components might potentially include sensitive information, in plain text, in the trace file.
IBM recommends that you do not enable these types of tracing components on a production system and attempt to simulate the problem on a quality assurance environment to capture the appropriate information. However, if the tracing components must be enabled on a production system, handle the trace files with caution. Before you send the trace, remove sensitive data that might be in the trace before you allow a third party to use the trace for diagnosis. Further, when the trace is no longer required, remove the files with a military-grade data wiping process. When the problem is found and the tracing component is no longer required, immediately disable the low-level tracing components.
Procedure
- Enable tracing in your target container by using Run Engine commands. There are different methods of implementation.
Method Procedure Enable trace in a running container in your local Docker environment. Use this method on your local quality assurance or development environment.
- Enter your target container.
docker exec -it container_name bash
- Set your trace specification. For example, the following command adds trace on ServiceLogger. For a list of specifications, see see Trace strings.
run set-trace-specification com.ibm.commerce.foundation.logging.ServiceLogger=FINEST
- (v9.0.0.0) (v9.0.0.1) By default, the trace is output to STDOUT. To output the trace to a log file, then update /opt/WebSphere/Liberty/usr/servers/default/configDropins/overrides/logging.xml and replace traceFileName=stdout with traceFileName=trace.log. Save the file and restart the container.
- Reproduce the issue.
- If we did not configure our 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/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 we can distribute the custom Docker image.
- Create a Dockerfile for the target Docker image.
- 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
- (v9.0.0.0) (v9.0.0.1) By default, the trace is output to STDOUT. To output the trace to a log file, then update /opt/WebSphere/Liberty/usr/servers/default/configDropins/overrides/logging.xml and replace traceFileName=stdout with traceFileName=trace.log. Save the file and restart the container.
- 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.
- Ensure that you configured your orchestration tool to retrieve configuration parameters from your Configuration center.
- In your Configuration center (such as Vault), define the trace specification in the TRACE_SPEC parameter.
- Now, when new containers are deployed, the containers will be configured with your trace specifications.
- Trace strings
The following table includes the trace strings available specifically for the Store server Docker container. In some cases, we might need to enable trace strings in multiple servers to fully troubleshoot a component. See the MustGather sections in Trace components.
Component Trace string Marketing com.ibm.commerce.marketing.cache.*=all com.ibm.commerce.store.marketing.*=all com.ibm.commerce.foundation.logging.*=all
Search com.ibm.commerce.foundation.*=all: com.ibm.commerce.rest.*=all
Dynamic Cache Each trace string creates some extra logging and can impact performance. If you need 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.component.cache.config.*=all com.ibm.commerce.dynacache.filter.*=all com.ibm.commerce.foundation.logging.*=all
Session Management com.ibm.commerce.store.foundation.session.*=all com.ibm.commerce.foundation.logging.*=all
Access control com.ibm.commerce.component.helper.*=all com.ibm.commerce.component.registry.*=all com.ibm.commerce.foundation.logging.*=all
Cross site protection com.ibm.commerce.store.foundation.utils.*=all com.ibm.commerce.foundation.logging.*=all
SEO com.ibm.commerce.component.seo.*=all com.ibm.commerce.store.foundation.internal.client.taglib.*=all com.ibm.commerce.foundation.logging.*=all
Commerce Composer com.ibm.commerce.store.pagelayout.*=all com.ibm.commerce.store.pagelayout.internal.client.taglib.*=all com.ibm.commerce.foundation.logging.*=all
Store foundation com.ibm.commerce.component.mvc.*=all com.ibm.commerce.store.mvc.*=all com.ibm.commerce.store.servlet.*=all com.ibm.commerce.component.server.*=all com.ibm.commerce.component.internal.client.util.*=all com.ibm.commerce.component.rest.helper.*=all com.ibm.commerce.client.rest.RestClientReadEfficiencyLogger=fine com.ibm.commerce.foundation.logging.service.RestClientLogger=fine com.ibm.commerce.foundation.logging.*=all