Fork me on GitHub
#cider
<
2020-11-14
>
st3fan15:11:09

n00b question: i am running my web api inside the repl now - but how do i log or print things? i am debugging something and I would like to print a few values

bozhidar15:11:16

Just use regular logging/printing functions. If some log output doesn't appear in the REPL buffer you can check *nrepl-server*.

st3fan16:11:33

Oh I see it appears but in a really odd place in the repl …

st3fan16:11:42

And println from my app code doesn’t appear at all - maybe Jetty captures stdout?

st3fan16:11:26

Ok that may be caused by the code not actually properly reloading. More to explore!

st3fan16:11:10

Maybe I am doing this the wrong way. I started a REPL and then started Jetty - but maybe I should keep using lein run but add a repl to it and then connect to that?

dpsutton17:11:34

That is basically what cider is doing. Calling lein repl and connecting you to that

dpsutton17:11:01

Have you opened the nrepl buffer mentioned above?

st3fan17:11:58

Yeah there is an unrelated trace in there but nothing else. But I think I have another problem .. Even though I compile functions, those changes don’t seem to actually happen in my running server. I’ll explore that a bit more first.

dpsutton17:11:14

Find where your routes are def ed. You probably need to reevaluate that or perhaps start using var refs there to make sure it’s always using new code. If you have questions about that ask in beginners or clojure and you’ll get some good explanations