SWI-Prolog provides several facilities to debug and update running (server) applications. The core to these facilities are:
library(hotswap)) allow, with some limitation, making 
modifications to running services. This includes adding debugging and 
logging statements.
library(prolog_server) 
that allow interaction using netcat (nc) or telnet.