Where does pprint
/println
output go in compojure?/Can I get it to show up in the terminal window that the figwheel repl is running in? (Sorry if this sounds dumb, google bested my efforts).

- 2,567
- 2
- 19
- 33
-
I'm new to Clojure myself but usually figwheel is for using with front-end clojurescript and Compojure is used for backend Clojure for the server. If I'm understanding it seems a little odd to have them interact directly. – JustGage Mar 08 '16 at 04:54
-
I thought because `lein figwheel` spun up the backend as well it would be the reasonable place to output server logging to. Basically I'm looking for how to do print-debugging with the server side of a compojure app. – BWStearns Mar 08 '16 at 04:57
2 Answers
Actually Figwheel has a related feature to cause such symptoms. All print/prn statements in your ring handlers will be "swallowed" by the Figwheel process and will either go to a log file or to the console.
Here is a snippet from project.clj:
:figwheel
{:http-server-root "public"
:server-port 3449
:nrepl-port 7002
:css-dirs ["resources/public/css"]
:ring-handler myapp.handler/app
:server-logfile false
}
The key :server-logfile is controlling this behavior. If it's false, then out is your regular repl console, if it's a filename, then anything printed will go to that file (if it's not present, then the default is using file "figwheel_server.log".
Figwheel issue: https://github.com/bhauman/lein-figwheel/issues/436 Figwheel commit: https://github.com/bhauman/lein-figwheel/commit/330d8d7fda8be145615910cf639bd9a3242339ba

- 3,962
- 23
- 21
It seems to show up there without any special setup... I get this at the console:
Prompt will show when Figwheel connects to your application
"I got a request"
Triggering the handler:
curl localhost:3449/foo
src/with_server/server.clj
(ns with-server.server)
(defn handler [req]
(prn "I got a request")
{})
In project.clj under :figwheel {}
:ring-handler with-server.server/handler
If you are having trouble, maybe you need ring-reload middleware so that the changes you are making get reloaded?

- 10,586
- 3
- 34
- 63
-
unexpected behavior was stopping my code from getting to the prn statement. *facepalm* – BWStearns Mar 08 '16 at 17:38