Fork me on GitHub
#nrepl
<
2022-01-24
>
DenisMc16:01:41

Hi, I’m tearing my hair out with an issue that I think is to do with my nrepl config. I have a clojure project that I am running in a docker container, and I have logging (using logback) enabled for the project. I can see that logback is logging (as configured) to the console within the docker container, but when I connect to the running application locally using an nrepl (set up in IDEA/cursive), I am not getting the logback logs - but I am seeing messages that I (print) to the console within the application. That is to say, for the following code:

(print "this is printing in the nrepl...")
(log/error "this is not printing in the nrepl")
The first line appears in the nrepl and the second does not - but both lines appear in the console for the docker container where the application is running. When I run the application entirely locally (no docker) via a normal repl the console logs appear as expected in the repl when I run tests and so on. So it appears to be a problem with my nrepl config. Any help gratefully accepted on this - I know this may be some typo or screwup in my deps.edn or something, but maybe someone has come across this sort of issue before and can point me in the right direction. Thanks in advance.

DenisMc21:01:09

Ok, I’ve found a workaround for this using this gist: https://gist.github.com/daviesian/4517859. I’ve created a cursive command that I can run with a shortcut whenever I start a new repl and it fixes the issue. I don’t know why stdout isn’t printing to the repl (maybe because it’s in docker?), but this fixes the problem.