Fork me on GitHub

Heya, I'm connecting to an embedded remote REPL server (as in: nrepl.server/start-server with cider.nrepl/cider-nrepl-handler) via M-x cider-connect which works fine except for one problem: The main process is a server which writes (a lot of) log output to stderr. This all gets redirected into my REPL buffer, often grinding my Emacs instance to a halt. Is anyone aware of a way to deal with this? I could live with only having stdout redirected, for example.


The usual thing I do is disabling stdout/stderr logging in my app by tweaking my app's Logback (or Timbre, or what have you) config I make it log to log/dev.log instead which I can tail -f if necessary (bonus tip, less +F is awesome )


Hey @U45T93RA6, thanks for your reply (and the nice bonus tip :D). However, logging to files is something I would prefer to avoid since that means having to take care of log rotation, compaction and purging, as well. I'd rather leave that concern to journald 😄

🍻 1

The trick is that you only tweak logging in your dev env, where rotation is not a concern Sometimes (but not necessarily) I (File/delete "log/dev.log") on app startup, mostly so that old logs don't confuse me when debugging


Ah yeah, I am actually talking about REPLing into a production server for purposes of doing some runtime state inspection.


Got it So I have a snippet that should help:

(let [silently--old System/out
      silently--pw ( "/dev/null")
      silently--ps ( (proxy [] []
                                             ([a b c])
                                             ([a b c d e]))))]
  (binding [*out* silently--pw
            *err* silently--pw]
      (System/setOut silently--ps)
      (System/setErr silently--ps)
      ;; do your thing here...
        (System/setOut silently--old)
        (System/setErr silently--old)))))


the snippet is oriented for use in e.g. test suites but you can trivially adapt it for repl usage (e.g. binding -> set!)