Java日志框架中有哪些最新选项? [英] What are the latest options in Java logging frameworks?
问题描述
这个问题会定期询问,但我一直认为现有的Java日志框架过于复杂和过度设计,我想看看有什么新内容。
我对当前项目有一个更为关键的问题,因为我们将JSON标准化为人类可读的数据编码,而且我见过的大多数日志框架都需要XML。我宁愿避免在95%的应用程序配置中使用JSON,而仅仅因为日志记录框架而使用XML(事实上,我不喜欢用于除文本标记以外的任何其他用途的XML)。
是否有任何热门的新Java日志框架,这些框架都是主动维护的,功能相当强大,有maven仓库,可以在不重新启动应用程序的情况下进行重新配置,并且不会将您绑定到XML ?
您有3个选择:
现在,让我们看看它们是如何满足您的要求的:
- 积极维护
- 相当强大
- 有一个maven repo
- 可以是重新配置而不重新启动您的应用
- 不要将您绑定到XML
log4j
:
java.util.logging
(JUL):
- 我会说是 -
- 由您自行决定 -
- N / A -
- 是(通过JMX或
LogManager #readConfiguration()
- - 是(使用属性文件)
- 是 -
- 是 -
- 是 -
- 是,通过 JMX 或 autoScan -
- XML或Groovy中的配置文件
- actively maintained
- reasonably powerful
- have a maven repo
- can be reconfigured without restarting your app
- don't tie you to XML
- I'd say Yes -
- at your discretion -
- N/A -
- Yes (via JMX or
LogManager#readConfiguration()
- - Yes (using properties files)
- Yes -
- Yes -
- Yes -
- Yes, via JMX or autoScan -
- Configuration files in XML or Groovy
Logback :
看起来你必须做出一些让步(或找到一个我不知道的框架)。我会去 Logback ,这就是现在发生的事情。
This question gets asked periodically, but I've long felt that existing Java logging frameworks were overcomplicated and over-engineered, and I want to see what's new.
I have a more critical issue on my current project as we've standardized on JSON as our human-readable data encoding, and most logging frameworks I've seen require XML. I would really rather avoid using JSON for 95% of my apps configuration, and XML for the rest just because of the logging framework (truth be told, I hate XML used for anything other than text markup, its original intended purpose).
Are there any hot new Java logging frameworks that are actively maintained, reasonably powerful, have a maven repo, can be reconfigured without restarting your app, and don't tie you to XML?
You have 3 options:
Now, let's see how they meet your requirements:
log4j
:
java.util.logging
(JUL):
Logback:
It looks like you'll have to make some concessions (or find a framework I'm not aware of). I would go for Logback, this is where things happen now.
这篇关于Java日志框架中有哪些最新选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!