【问题标题】:set the way log is written using Commons-logging使用 Commons-logging 设置日志的写入方式
【发布时间】:2011-03-07 07:20:36
【问题描述】:

我可以设置使用 Commons-logging 而不是 log4j 写入日志的方式吗?

由于规范,我真的很想使用 commin-logging。

【问题讨论】:

    标签: java logging apache-commons-logging


    【解决方案1】:

    不,你不能。引用the documentation itself:

    JCL 只为编写日志消息提供了一个桥梁。它不(也不会)支持底层日志系统的任何类型的配置 API。

    这是设计使然。这个想法是使用一个通用的日志 API,同时能够使用你想要的任何底层日志库。您仍然需要配置该底层库。

    【讨论】:

      【解决方案2】:

      Commons-logging 只是您的应用程序和底层日志系统之间的桥梁,因此 Joachim 指出您不能将它用于配置。 也不会阻止你使用 log4j,你仍然需要一个底层的日志实现。

      还可能想查看此处讨论的 slf4j http://helpdesk.objects.com.au/java/which-logging-framework

      【讨论】:

        猜你喜欢
        • 2019-07-22
        • 2010-11-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-11-24
        • 2023-02-24
        • 1970-01-01
        • 2010-09-18
        相关资源
        最近更新 更多