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
Just use regular logging/printing functions. If some log output doesn't appear in the REPL buffer you can check *nrepl-server*
.
Oh I see it appears but in a really odd place in the repl …
And println from my app code doesn’t appear at all - maybe Jetty captures stdout?
Ok that may be caused by the code not actually properly reloading. More to explore!
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?
That is basically what cider is doing. Calling lein repl and connecting you to that
Have you opened the nrepl buffer mentioned above?
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.
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
Thank you