f2s_trace_on

Applies to: Oracle, MS SQL, MySQL/MariaDB, PostgreSQL Drivers

Enables driver tracing to a file or, on Windows, to the debug:// output channel. The intended driver must already be loaded and active.

Added in Flex2SQL 18.1: The CIRCULAR_MODE and maximum-size options. The earlier filename/level form remains supported.

Syntax

f2s_trace_on {Filename} [{Detail_Level}] [CIRCULAR_MODE [{MaxSizeMB}]]

Parameter

Description

Filename

Trace filename including its path, or debug:// for the Windows debug channel. The output directory must exist and be writable.

Detail_Level

Optional symbolic level from the table below. Default: DEBUG_LEVEL.

CIRCULAR_MODE

18.1. Enables wrap-around file output. When the size threshold is reached, new output overwrites the beginning of the same file.

MaxSizeMB

18.1. Positive size threshold in MB (1 MB = 1,024 x 1,024 bytes). The default threshold is 500 MB unless already configured; a non-positive value uses 500 MB. Supply it after CIRCULAR_MODE.

Use the 18.1 f2s.pkg and driver for the new options. Supply the explicit level before CIRCULAR_MODE and the size, as in the examples below. A size setting does not limit a non-circular trace.

Trace Levels

Use the symbolic level in the command; numeric values belong in TRACE_LEVEL INI/environment settings. In particular, use ERROR_LEVEL in the command rather than passing -1 as the level argument.

Detail_Level

TRACE_LEVEL

Output

ERROR_LEVEL

-1

Errors and warnings, plus diagnostic headers and some driver status messages. Suitable for ongoing deployment diagnostics.

DEBUG_LEVEL

0

Database operations and embedded SQL calls, with their parameters.

DETAIL_LEVEL1

1

Adds field-buffer moves and attribute operations.

DETAIL_LEVEL2

2

Adds text-file generation details.

DETAIL_LEVEL3

3

Adds driver-call entry and exit details.

Each level includes the preceding levels. Detailed tracing can affect performance even when circular mode bounds the file’s growth.

Errors-Only Deployment Example (18.1)

With the intended driver already loaded, create a 50 MB circular trace:

f2s_trace_on "C:\Logs\OrderEntry-errors.log" ERROR_LEVEL CIRCULAR_MODE 50

The directory must already exist. Use this for intermittent driver errors that might occur when no developer is present to start detailed tracing. See Circular Logging for Deployed Applications for INI and environment setup, flushing, and how to read a wrapped file.

Detailed Trace Example

Use a detailed trace temporarily while reproducing an issue:

f2s_trace_on "C:\Logs\OrderEntry-detail.log" DETAIL_LEVEL3
f2s_write_trace_ln "Starting the operation under investigation"
// Run the operation here.
f2s_trace_off

File Behavior

Opening or re-enabling a trace at the same filename starts a fresh file. Circular output writes a header and cycle marker after wrapping; it does not create rotated archives. Older content after the current write position can remain until overwritten, so use timestamps and cycle markers rather than assuming the file ends with the newest event. The size can slightly exceed its threshold because checks occur after writes.

Circular options affect file output, not debug://. Programmatic tracing only captures activity after the command runs. For initialization failures, use startup settings or Automatic Service-Mode Error Logging.

Environment variables TRACE_LEVEL and TRACE_FLUSH can override the corresponding settings when the trace header is written. Check the resulting header to confirm the active level and circular size.

Replaces

ENABLE_TRACE_ON