How to print to STDERR in Clojure?

There is no specific function for this, however you can dynamically rebind the var holding the stream that println writes to like this:

(println "Hello, STDOUT!")

(binding [*out* *err*]
  (println "Hello, STDERR!"))

In my REPL, the colour indicates the stream (red is STDERR):

enter image description here

Leave a Comment