抑制`clojure.tools.logging`的输出 [英] suppress output from `clojure.tools.logging`
问题描述
我无法隐藏库正在使用的 clojure.tools.logging
的输出。该库正在记录一个错误
,这会导致在 stderr
上的stacktrace,但它不是一个错误级别的消息,我不能想出一种隐藏它的方法。我使用 timbre
为我自己的应用程序,所以我想捕获输出和重新记录它作为警告或只是一个调试将是理想的,但现在我只需要stacktrace
with-out-str
。 我试过了 log4j.properties
文件在CLASSPATH上,根记录器的默认级别设置为 fatal
。
值得其他miscellanea。日志记录已在此处介绍到库中: https://github.com/apa512/clj- rethinkdb / commit / 5587bdadaed663fcab3b7c616840dfffec84569a ,我不知道如何捕获它的记录器和设置它的水平或为什么在我的log4j.properties中设置根记录器的级别不工作。
任何建议之前,我只需做一个 java -jar app 2> / dev / null
?
如果你希望输出 I'm having difficulty hiding the output of I've tried rebinding err to out and then nesting the body within a I've tried a I've tried an hours worth of other miscellanea. The logging was introduced to the library here: https://github.com/apa512/clj-rethinkdb/commit/5587bdadaed663fcab3b7c616840dfffec84569a and I can't figure out how to capture it's logger and set it's level or why setting the root logger's level in my log4j.properties is not working. Any suggestions before I simply do a The If you want output from 这篇关于抑制`clojure.tools.logging`的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! clojure.tools.logging
项目根据类路径上可用的依赖项动态加载日志记录实现。除非已经有SLF4J,Commons Logging或Log4j作为项目依赖项,否则 tools.logging
将使用 java.util.logging
(在没有任何配置的情况下将所有输出定向到
System.out
),并将 log4j.properties
tools.logging
重定向到Timbre,我建议将 [org.slf4j / slf4j-api]
添加到您的项目依赖项,然后使用 slf4j-timbre 适配器。clojure.tools.logging
a library is using. The library is logging an error
and this causes a stacktrace on stderr
but it's not an error-level message for me and I can't figure out a way to hide it. I use timbre
for my own application so I guess capturing the output and re-logging it as a warning or just a debug would be ideal, but for now I just need the stacktrace noise gone.with-out-str
.log4j.properties
file on the CLASSPATH with the root logger's default level set to fatal
.java -jar app 2> /dev/null
?clojure.tools.logging
project dynamically loads a logging implementation based on what dependencies are available on the classpath. Unless you already have SLF4J, Commons Logging, or Log4j as a project dependency, tools.logging
will fall back to using java.util.logging
(which directs all output to System.out
in the absence of any configuration) and putting log4j.properties
on your classpath will have no effect.tools.logging
redirected to Timbre, I'd suggest adding [org.slf4j/slf4j-api]
to your project dependencies and then using the slf4j-timbre adapter.