[det]debug(+Topic)nodebug(_) removes 
all topics. Gives a warning if the topic is not defined unless it is 
used from a directive. The latter allows placing debug topics at the 
start of a (load-)file without warnings.
For debug/1, Topic 
can be a term Topic > Out, where Out is 
either a stream or stream-alias or a filename (an atom). This redirects 
debug information on this topic to the given output. On Linux systems 
redirection can be used to make the message appear, even if the user_error 
stream is redefined using
?- debug(Topic > '/proc/self/fd/2').
A platform independent way to get debug messages in the current 
console (for example, a swipl-win window, or login using ssh 
to Prolog running an SSH server from the libssh pack) is to 
use:
?- stream_property(S, alias(user_error)), debug(Topic > S).
Do not forget to disable the debugging using nodebug/1 before quitting the console if Prolog must remain running.