Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print to the REPL window in a Ring handler?

Tags:

clojure

ring

ccw

(defn app [request]
  (println "test")
  {:body "Hello World"})

(defonce server (run-jetty #'app {:port 8080 :join? false}))

println doesn't seem to work in a handler. How do I write to the REPL window?

I'm using eclipse with counterclockwise.

EDIT: This looks like nrepl issue. (future (println "foo")) is fine, but no output with (.start (Thread. #(println "foo"))).

like image 285
alice Avatar asked Dec 01 '12 14:12

alice


2 Answers

println doesn't write to output directly, rather it buffers the output and flush it later. You can try (.println System/out "test")

like image 76
Ankur Avatar answered Nov 16 '22 08:11

Ankur


You can find the outputin the *nrepl-server ...* buffer for your project. In CIDER, this buffer is hidden. You can find it with C-x C-b though.

like image 45
Lispnik Avatar answered Nov 16 '22 07:11

Lispnik