Configure logging
You can handle logging and tracing configurations by enabling tracing at server startup, enabling tracing on a WebSphere Commerce instance, or enabling logging on the WebSphere Commerce client library on a standalone program.
When working 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 have knowledge of 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 whenever possible to 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, when this is not possible and the tracing components might have to be enabled on a production system, it is recommend to take the necessary precautions when handling the trace files. Before sending the trace, any sensitive data contained in the trace should be removed when a third party is using them for diagnosing the problem. Further, when the trace is no longer required, the files should be removed using a military-grade data wiping process. Once the problem has been determined and the tracing component is no longer required, those tracing components should immediately be disabled.
Procedure
- Enable tracing at server startup
- Open the WebSphere Application Server Administrator's Console. Right-click the WebSphere Commerce Test Server and select Administrative Console.
- Expand Troubleshooting > Logs and Trace. The Logging and Tracing page displays in the workspace on the right.
- Click on the server for which to enable the tracing (for example 'server1'). The window refreshes to display the logging and tracing options for the server.
- Click Diagnostic Trace. The Diagnostic Trace Service window displays in the workspace.
- Click the Configuration tab.
- Select the Enable log check box to enable tracing, or clear the check box to disable tracing.
- Select whether to direct trace output to either a file or an in-memory circular buffer.
- Select Advanced from the drop down menu for the trace output format for the generated trace.
- Save the format for the generated trace.
- Save the changed configuration
- In the left navigation tree:
- Expand Troubleshooting>Logs and Trace. The Logging and Tracing page displays in the workspace on the right.
- Click on the server for which to enable the tracing (for example 'server1') . The window refreshes to display the logging and tracing options for the server.
- Click Change Log Detail Levels.
- You will now be presented with the option of changing Configuration or Runtime. Changes made to Configuration are stored on the file system and applied when the server starts. A server restart is required to pick up any changes. Modifications to Runtime are applied immediately and are lost during server restarts.
- Click the Configuration tab. You can now make changes to the logging settings by expanding com.ibm.websphere.commerce.*. This will present you with all the different components in WebSphere Commerce that can be logged. Click on each component that you are interested in and select the logging level. Refer to the section Components that can be traced for WebSphere Commerce. You can select different WebSphere Commerce Components from the list in the tab, or you may enter a trace string to set the trace specification to the state that you want. (For more information, see Enabling trace at server startup )
If you are tracing multiple components you should separate them by a colon. For example:
com.ibm.websphere.commerce.WC_SERVER=all:com.ibm.websphere.commerce.WC_ORDER=all
Track 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.
- Save the changed configuration.
- Start the server.
- Enable tracing on a WCS instance
You can modify the trace service state that determines which components are being actively traced for a running server which is federated, by using the following procedure.
- Open the WebSphere Application Server Administrator's Console.
- In the left navigation tree:
- Expand Troubleshooting > Logs and Trace. The Logging and Tracing page displays in the workspace on the right. The Logging and Tracing page displays in the right windows.
- Click on the server for which to enable the trace (for example, server1). The window refreshes to display the logging and tracing options for the server.
- Change log detail levels. The Diagnostic Trace Service window displays in the workspace.
- Select the Runtime tab.
- Refer to the section Components that can be traced for WebSphere Commerce. You can select different WebSphere Commerce Components from the list in the tab, else you may enter a trace string to set the trace specification to the state that you want. (For more information, see Enabling trace at server startup)
com.ibm.websphere.commerce.WC_SERVER=all
If you are tracing multiple components separate the components by a colon. For example:
com.ibm.websphere.commerce.WC_SERVER=all:com.ibm.websphere.commerce.WC_ORDER=all
- Click Apply.
- If a change from the existing Trace Output is required:
- Expand Troubleshooting > Logs and Trace. The Logging and Tracing page displays in the workspace on the right. The Logging and Tracing page displays in the right windows.
- Click on the server for which to enable the trace (for example, server1). The window refreshes to display the logging and tracing options for the server.
- Change log detail levels. The Diagnostic Trace Service window displays in the workspace.
- Select the Runtime tab.
- Configure the change in the trace output.
- Click Apply.
For more information about any of these steps see the Enabling trace on a running server topic in the WebSphere Application Server Information Center.
- Enable logging on the WebSphere Commerce client library on a standalone program
You can debug problems when a standalone Java program has issues with the WebSphere Commerce client library by enabling logging.
The foundation logging helper, com.ibm.commerce.foundation.common.util.logging.LoggingHelper, is used to obtain logging objects. This class has helper methods that determine if tracing and entry and exit tracing has been enabled. Logging properties are overridden with a separate logging properties file.
- Navigate to a directory of the choice and create a new file called logging.properties.
- Paste the following contents into the logging.properties file:
#------------------------------------------ # Handlers #----------------------------------------- handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler # Default global logging level .level=ALL # ConsoleHandler java.util.logging.ConsoleHandler.level=OFF java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter # FileHandler java.util.logging.FileHandler.level=FINE # Naming style for the output file: java.util.logging.FileHandler.pattern=logs/loadData.log # Name of the character set encoding to use java.util.logging.FileHandler.encoding=UTF8 # Limiting size of output file in bytes: java.util.logging.FileHandler.limit=25000000 # Number of output files to cycle through java.util.logging.FileHandler.count=2 # Style of output (Simple or XML): java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
Where the default properties are:
Property Value Log level FINE Encode UTF8 Log file size limit 25MB Log file scrolling 2
- Restart the application, specifying the following generic JVM arguments in the WebSphere Application Server Administrator's Console (for example, Application servers > server1 > Process definition > Java Virtual Machine):
-Djava.util.logging.config.file="file_path/logging.properties"
Include the following path into the classpath of the Java application:
file_path/logging.properties
Where file_path is the directory of the choice, created in the first step.