Search code examples
clojureslimeswank

How to capture stdout/log output of an agent in SLIME?


I send a task to an agent, but can't see the output of any print statements I've put into the function. How do I trace code execution on agents?

EDIT: Turns out I do get the output in the console, but not in SLIME. The question now is, how to see the output in SLIME?


Solution

  • The key is to start swank from emacs as the inferior lisp process instead of calling lein swank from the shell. One way to do this is to use elein (the command is M-x elein-swank). Then you can either inspect the output in the inferior lisp buffer (which is called *elein-swank* in the example of using elein), or execute slime-redirect-inferior-output and have the output inline in the repl. Clojure.contrib.logging is a useful tool for sending log output.