Skip to content
Jan Wielemaker edited this page Sep 25, 2025 · 2 revisions

Showing debug messages

Debug messages
Showing debug messages, highlighting the HTTP redirect


The SWI-Prolog library(debug) provides debug/3 for printing debug messages. The signature is debug(+Channel, +Format, +Args), where Format and Args are passed to format/2. The Channel may be used to enable or disable the message and determine where it is printed to. This is controlled using debug/1 and nodebug/1.

The debug messages GUI can be launched from the Epilog Tools/Debug messages menu. It has two panes. The left pane shows the known debug channels and the right pane collects the debug messages. Clicking a channel in the left pane highlights all messages related to this channel. The context menu allows enabling or disabling channels, i.e., providing a GUI binding to debug/1 and nodebug/1.

Note Calls to debug/3 are removed if the code is compiled with optimization enabled. By default, all SWI-Prolog libraries are precompiled with optimization enabled. To use debug channels used by the libraries, you should start Prolog using the -Dsource option or use

?- set_prolog_flag(source, true).

before loading the library you want to debug. This notably applies for the HTTP client and server libraries. These libraries provide several debug channels that may be used to debug connection issues.

Clone this wiki locally