Skip to content
logo Knowledgebase

How to run an Engine trace in Sage X3

Created on  | Last modified on 

Summary

An "Engine trace" is also known as an "openlog trace" or sometimes called a "system log" Whatever you call it, this tracing will allow you to see the path a classic process is taking through the 4GL code by generating a text file listing the 4GL system calls. The level of detail shown and the log file location is given as part of the process to start such as trace.

Description

This article aims to address these requirements:

  1. I want to run an engine trace for my X3 session.
  2. How do I run an engine trace from within a function?
  3. I want to run an engine trace on only a certain portion of my code.


Resolution

1.  How to run an Engine Trace from within X3 generally

The Engine Tracing functionality changed significantly in 2021 R3 (Version 12 Patch 27). See the attached PDFs for more details on both the pre-V12 P27 and V12 P27+ methods of setting up Engine Tracing.

See the attached PDF files for more information:


2.  How to run an Engine Trace interactively from within a function

You can manually enable and disable logging interactively following these steps:

  • From within a function go to Help, Diagnosis, Calculator
  • In the Calculation: field enter Openlog ("TRA", 2) and press ENTER (You should see 0 in results field). Note: TRA represents the folder that the log file will be written to in the working folder. 2 represents the engine log level.
  • Do the processing you wish to trace
  • To stop the log, go back to the Calculator, type Closelog() and press ENTER (You should see 0 in results field)
  • To retrieve the log file from within the application:
    Go to Log reading (Reports, Reports, Log Reading)
    Find and Open up the log (it will start x3diary_...)
    Click Copy to download the file
    Alternatively, if you wish to retrieve it from the server then go to the TRA directory and look for the file starting "x3diary"


3.  How to run/initiate an Engine Trace from within your 4GL code

Within your code, you are going to enter something similar to:

Local Integer RETTRACE
RETTRACE =openlog('TRA',5) **NOTE: Entering flag of "5" is just an example. Enter whatever flag is appropriate for your requirements
# The code you want to trace
RETTRACE=CloseLog()

Note: TRA represents the folder that the log file will be written to. The value corresponds to the flag as defined in the Online help for Engine trace.

Related Solutions

You can also refer to the presentation materials "Introduction to tracing classic functions" included in "Index page: Sage X3 Technical Support Tips and Tricks (March 2021)" and "Deep dive into the engine trace log file" included in "Index page: Sage X3 Technical Support Tips and Tricks (October 2022)"