使用 lein 管理 log4j.properties
我试图弄清楚如何使用 leiningen 管理我的 log4j.properties 文件。我希望能够自动将文件包含在 lein 创建的 jar 中,并让“lein swank”(和 lein repl)可以访问属性文件。
现在我的项目“root”中有该文件,但是当我使用 swank 的日志记录时出现此错误
[null] log4j:WARN No appenders could be found for logger (com.dev).
[null] log4j:WARN Please initialize the log4j system properly.
谢谢!
I'm trying to figure out how I can manage my log4j.properties file with leiningen. I'd like to be able to automatically include the file in the jars that lein creates as well as have the properties file be accessible to "lein swank" (and lein repl).
Right now I have the file in my project "root", but I get this error when I using logging from swank
[null] log4j:WARN No appenders could be found for logger (com.dev).
[null] log4j:WARN Please initialize the log4j system properly.
Thanks!
NOTE: I got my log4j.properties file from the blog post at http://www.paullegato.com/blog/log4j-clojure/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+clojure+(Planet+Clojure0
I'd be content (actually thrilled) configuring my logging output format from within Clojure, but I haven't found a way to do it yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该将 log4j.properties 文件放在 lein 项目的 resources(顶级文件夹 - 其中包含 project.clj、src、test、lib、classes)文件夹中。这样,如果您运行 lein jar,它将在类路径上可用并与项目打包在一起。
You should put the log4j.properties file in the resources(top level folder - where project.clj, src, test, lib, classes are) folder of your lein project. That way it will be made available on the classpath and packaged with the project if you run
lein jar
.只是为了保持最新状态...
您应该查看 clj-logging-config。它允许您从 Clojure 配置记录器。
Just to keep this current...
You should look at clj-logging-config. It allows you to configure your logger from Clojure.