首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何通过nREPL查看音质日志?

如何通过nREPL查看音质日志?
EN

Stack Overflow用户
提问于 2020-06-06 19:04:11
回答 1查看 70关注 0票数 0

我使用Timbre来登录Clojure。当我通过nREPL连接到生产实例时,除非我通过SSH连接到机器并运行journalctl,否则我看不到进程日志。

如何对音色日志进行多路复用,使其在nREPL中可见?

我怀疑我需要修改*out*变量。

EN

回答 1

Stack Overflow用户

发布于 2020-06-06 20:47:13

在这里找到了答案:https://stackoverflow.com/a/38294275/198927

代码语言:javascript
复制
;; run this code on the repl where you wish to see all output.
;; You will need to add the dependency [commons-io "2.4"] to your
;; leiningen dependencies.
(import 'org.apache.commons.io.output.WriterOutputStream)
(import 'java.io.PrintStream)

;; First, we redirect the raw stdout of the server to this repl
(System/setOut (PrintStream. (WriterOutputStream. *out*)
                             true)) ;; Auto-flush the PrintStream

;; Next, we alter the root binding of *out* so that new threads
;; send their output to THIS repl rather than the original System/out.
(alter-var-root #'*out* (fn [_] *out*))

;; Now the snippets should both send output to this repl:
(.println System/out "Hello stdout.")
(.start (Thread. #(println "Hello from a new thread.")))
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62230777

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档