Logging and Tracing in IBM Cloud Private

improve this page | report issue

Overview

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.

Jump to:

Prerequisites

Install and configure the following tools required for log collection and troubleshooting:

  • Docker (docker)
  • Kubernetes CLI (kubectl)

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.

-Dcom.ibm.ws.logging.trace.specification=com.ibm.mfp.*=all=enabled

You can also set this entry using JNDI configuration. For more informatiion see here.

Collecting kubectl logs

The 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.

Option Description Remarks
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
Default: default
Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.
Last modified on May 17, 2019