IBM Support

How to Enable and Disable Debug Logging on Planning Analytics TM1 Using REST API

How To


Summary

This document provides an example of using REST API to enable and disable TM1 debug logging on a Planning Analytics as a Service.

Environment

The steps in this document have been written for Visual Studio Code using the REST Client extension.
 

Sample Code:

@host = https://us-east-1.planninganalytics.saas.ibm.com
@tenant = A1B2C3D4E5C6
@tm1db = Test Database
@apiKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@Authorization = Basic apikey:{{apiKey}}

### Authenticate using apikey.  paSession cookie set.
# @name Authenticate
GET {{host}}/api/{{tenant}}/v0/rolemgmt/v1/users/me  HTTP/1.1
Authorization: {{Authorization}}
Content-Type: application/json

### Retrieve list of available loggers and their status
# @name getLoggers
GET {{host}}/api/{{tenant}}/v0/tm1/{{tm1db}}/Loggers  HTTP/1.1
Content-Type: application/json

### Logger to toggle (example, TM1.Lock.Exception)
### Logger must be one available in the list retrieved in previous step
@logger = TM1.Lock.Exception

### Send enableLogger
# @name enableLogger

PATCH {{host}}/api/{{tenant}}/v0/tm1/{{tm1db}}/Loggers  HTTP/1.1
Content-Type: application/json

{
    "@odata.context": "#$delta",
    "value": [
        {
            "Name": "{{logger}}",
            "Level": "Debug"
        }
    ]
}

### Send disableLogger
# @name disableLogger

PATCH {{host}}/api/{{tenant}}/v0/tm1/{{tm1db}}/Loggers  HTTP/1.1
Content-Type: application/json

{
    "@odata.context": "#$delta",
    "value": [
        {
            "Name": "{{logger}}",
            "Level": "Info"
        }
    ]
}

Steps

  • Download and install Visual Studio Code with the REST Client extension
    • Downloading Visual Studio Code and using the REST Client extension is out of scope of this document
  • Create a new text file containing the sample code above, with a .http extension.  For example: pa_loggers.http
  • Open the .http file created with Visual Studio Code
  • Update the @host@tenant@tm1db and @apikey parameters accordingly
    • See the following to learn about API Keys in PA Workspace: 
      https://cloud.ibm.com/docs/planning-analytics?topic=planning-analytics-api__key_based_authentication
  • Assuming the REST Client extension has been installed correctly, there should be a Send Request text button available before each request (GET / POST)
  • Click Send Request for @name Authentication.  If successful, you should see an output that includes the response headers as well as some information related to the authenticated user
    image-20240909130336-1
  • Click Send Request for @name getLoggers.  If successful, you should see an output that includes the response headers as well as a JSON output containing the loggers available to the database and the logger status.  image-20241001142630-1
  • To enable a logger, populate @logger with the name of the logger you want to enable (for example, TM1.Lock.Exception, from the output generated above).  Click Send Request for @name enableLogger.  If successful, you will a response indicating the HTTP status code: 200.  The body will include the logger Name and Level that has been set.image-20241001143002-2
  • To disable a logger, populate @logger with the name of the logger you want to enable (for example, TM1.Lock.Exception, from the output generated above).  Click Send Request for @name disableLogger.  If successful, you will a response indicating the HTTP status code: 200.  The body will include the logger Name and Level that has been set.
    image-20241001143158-3

Additional Information

  • It is important to ensure that debug logging is disabled (set to Info) when no longer needed

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB76","label":"Data Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSEAI8G","label":"Planning Analytics as a Service"},"ARM Category":[{"code":"a8m3p000000GoaGAAS","label":"Planning Analytics-\u003EPlanning Analytics as a Service Specific"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
09 December 2025

UID

ibm17171900