-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output to each session's *err* in the same manner as *out* #387
Conversation
…System/out to *out* and System/err to *err*.
I don't quite understand the Travis failure, but if there's anything I should do about that, let me know. |
;; `PrintStream` (or maybe just not use a `PrintWriter` above). | ||
;; (System/setOut (PrintStream. o)) | ||
(alter-var-root #'*out* (constantly o)))) | ||
(let [ow (forking-printer (vals new-state) :out) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess we can come up with better names than ow
and ew
. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, okay. I was trying to follow the existing conventions, which seemed to favor short names in this file. Plus, ow
and ew
made me chuckle. I'll use more descriptive names.
(PrintStream. (proxy [OutputStream] [] | ||
(close [] (.flush ^OutputStream this)) | ||
(write | ||
([b] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does b
stand for bytes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - I can change that too
You should also update the namespace's description to reflect the current behaviour of the code. I'm assuming you've tested those changes locally and they work, right? |
Okay, will do. And yes, it works locally :) |
I fixed the things you requested, but I also discovered an encoding issue. Trying to get to the bottom of that. |
And, fixed! I'm unaware of any remaining issues. |
Hi @bhagany, I think this has resulted in some undesired behaviour for us. We’re using Our logs, which used to go to Here are our logging deps: [org.clojure/tools.logging "0.3.1"]
[org.slf4j/jul-to-slf4j "1.7.22"]
[ch.qos.logback/logback-classic "1.1.8" :exclusions [org.slf4j/slf4j-api]] logback.xml:
And the behaviour we see is: user> (clojure.tools.logging/warn "hi")
2017-01-03 13:38:23.432 [nREPL-worker-16] WARN user - hi severity=WARN, namespace=user,
nil
user> (println "hi")
hi
nil We only expect Can you suggest a workaround or change to accommodate our use case? Thanks |
This was always a bug and I cautioned people not to rely on this. There's a ticket on CIDER's side about redirecting certain type of output to a specific buffer, but it's been on hold for a while. Guess now we'll finally have to implement it. This is the ticket - clojure-emacs/cider#1525 It's client-side work only and should be trivial to implement. Unfortunately I'm kinda busy right now, so ideally we'd find some volunteer to help. |
Hi @oliyh, The fastest thing you can do is probably downgrade CIDER... that's obviously temporary though. The things that come to mind longer term are logging to a file instead of stdout, or configuring logging to be quieter on dev. |
@oliyh See also clojure-emacs/cider#1907 There's a strong chance I'll reject this functionality in the end given some of the comments, but you can join the discussion. I think that it's best to just log to file and tail it within Emacs. |
This builds on @Malabarba's work in #304 in order to fix clojure-emacs/cider#1588 and clojure-emacs/cider#1896. In addition, this also redirects Java's
System/out
andSystem/err
to*out*
and*err*
(they're confusingly not the same) so that everything you'd expect gets printed at the repl.I didn't add tests because I'm not sure how to go about doing that without actually spinning up an nrepl server. I'm glad to accept guidance on this, though. Existing tests do pass.