Logging and Tracing in IBM Cloud Private
IBM Mobile Foundation logs errors, warnings and, informational messages into a log file. The underlying mechanism of logging varies depending on the application server. In IBM Cloud Private, the only supported application server is Liberty.
The following document explains how to enable trace and collect logs for MobileFirst Server running in Kubernetes cluster on IBM Cloud Private.
- Configure logging and monitoring mechanism
- Collecting kubectl logs
- Collecting logs using IBM provided custom script
Install and configure the following tools required for log collection and troubleshooting:
- Docker (
- Kubernetes CLI (
To configure the
kubectl client for your cluster running on IBM Cloud Private, follow the steps described here.
Configure logging and monitoring mechanism
By default, all Mobile Foundation logging goes to the application server log files. The standard tools that are available in Liberty can be used to control the Mobile Foundation server logging. Learn more from the documentation on Configuring Logging and Monitoring Mechanisms.
Configuring logging and monitoring Mechanisms provides details on how the
server.xml can be updated to configure the logging and also provides information on trace enablement. Use the filter
com.ibm.ws.logging.trace.specification to selectively enable trace, learn more. This property can be specified via
jvm.option or in
bootstrap.properties of the server instance.
For example, adding the following entry in the
jvm.options will enable tracing for all the methods starting with
com.ibm.mfp and the trace level will be set to all.
You can also set this entry using JNDI configuration. For more informatiion see here.
Collecting kubectl logs
kubectl logs command can be used to obtain information about the deployed container on Kubernetes Cluster. For example, the following command retrieves the logs for the pod, whose pod_name is provided in the command:
kubectl logs po/<pod_name>
For more information on
kubectl logs command, refer to Kubernetes documentation.
Collecting logs using IBM provided custom script
The MobileFirst Server logs and container logs can be collected using the script get-icp-logs.sh. It takes Helm release name as input and collects the logs from all pods deployed.
The script can be executed as follows:
get-icp-logs <helm_release_name> [<output_directory>] [<name_space>]
The table below describes each of the parameters used by the custom script.
|helm_release_name||Release name of the respective Helm Chart installation||Mandatory|
|output_directory||Output directory where the collected logs to be placed||Optional
Default: mfp-icp-logs under current working directory.
|name_space||Namespace where the respective Helm Chart is installed||Optional