-
Notifications
You must be signed in to change notification settings - Fork 17
Debugging
I am a strong believer, that during normal operation a normal log file should remain empty, unless there is a condition raised worth logging.
The code uses different debug levels (debug1,2,3,4,5) for different details on diagnostics.
Use set log_min_messages=<debuglevel>; to temporarily activate that level when interacting on the psql console.
The lowest debug level is used primarily to generate an entry/exit function trace. The trace is designed to generally follow function calls when the code executes.
2025-11-10 16:10:38.303 CET [572901] DEBUG: > db2GetForeignRelSize
2025-11-10 16:10:38.303 CET [572901] DEBUG: > db2GetFdwState
2025-11-10 16:10:38.303 CET [572901] DEBUG: > db2GetOptions
2025-11-10 16:10:38.303 CET [572901] DEBUG: < db2GetOptions
2025-11-10 16:10:38.303 CET [572901] DEBUG: > source/db2_fdw_utils.c::guessNlsLang(nls_lang: (null))
2025-11-10 16:10:38.303 CET [572901] DEBUG: < source/db2_fdw_utils.c::guessNlsLang - returns: 'NLS_LANG=GERMAN_GERMANY.AL32UTF8'
2025-11-10 16:10:38.303 CET [572901] DEBUG: > db2GetSession
2025-11-10 16:10:38.303 CET [572901] DEBUG: > findenvEntry
2025-11-10 16:10:38.303 CET [572901] DEBUG: < findenvEntry - returns: 0
2025-11-10 16:10:38.303 CET [572901] DEBUG: > db2AllocEnvHdl
2025-11-10 16:10:38.303 CET [572901] DEBUG: > setDB2Environment
2025-11-10 16:10:38.303 CET [572901] DEBUG: < setDB2Environment
2025-11-10 16:10:38.335 CET [572901] DEBUG: allocate env handle - rc: 0, henv: 1
2025-11-10 16:10:38.335 CET [572901] DEBUG: > db2CheckErr
2025-11-10 16:10:38.335 CET [572901] DEBUG: < db2CheckErr - returns: 0
2025-11-10 16:10:38.335 CET [572901] DEBUG: set env attributes odbcv3 - rc: 0, henv: 1
2025-11-10 16:10:38.335 CET [572901] DEBUG: > db2CheckErr
2025-11-10 16:10:38.335 CET [572901] DEBUG: < db2CheckErr - returns: 0
2025-11-10 16:10:38.335 CET [572901] DEBUG: > insertenvEntry
2025-11-10 16:10:38.335 CET [572901] DEBUG: < insertenvEntry - returns: 348916e0
2025-11-10 16:10:38.335 CET [572901] DEBUG: < db2AllocEnvHdl - returns: 348916e0
2025-11-10 16:10:38.335 CET [572901] DEBUG: > db2AllocConnHdl(envp: 348916e0, srvname: SAMPLE, user: db2inst1, password: db2inst1, nls_lang: (null))
2025-11-10 16:10:38.335 CET [572901] DEBUG: > findconnEntry
2025-11-10 16:10:38.335 CET [572901] DEBUG: < findconnEntry - returns: 0
2025-11-10 16:10:38.335 CET [572901] DEBUG: alloc dbc handle - rc: 0, henv: 1, hdbc: 1
2025-11-10 16:10:38.335 CET [572901] DEBUG: > db2CheckErr
2025-11-10 16:10:38.335 CET [572901] DEBUG: < db2CheckErr - returns: 0
2025-11-10 16:10:38.717 CET [572901] DEBUG: connect to database(SAMPLE) - rc: 0, hdbc: 1
Whereever feasible parameters received as well as return values produced are documented as well.
The second level of debugging is delivering the majority of output. This level already should enable to trace values calculated within functions.
On some occasions more values get traces using this third level. It is not used in many functions, just some.
Currently not used
Currently not used