【问题标题】:Sending System.out to a file and Commons Logging将 System.out 发送到文件和 Commons Logging
【发布时间】:2011-01-21 22:24:11
【问题描述】:

我正在使用公共日志记录:

  private static final Log LOG = LogFactory.getLog(MyClass.class);

为什么我运行时这些日志没有进入日志文件

sh Main 2>&1 > logfile

我正在使用默认属性,并且类路径中没有 log4j.properties。

【问题讨论】:

    标签: java shell logging apache-commons-logging


    【解决方案1】:

    你有向后的重定向。它们是从左到右处理的。试试这个:

    sh Main > logfile 2>&1 
    

    【讨论】:

    • 我检查了一些我的管理员部署的脚本,确实我倒退了。感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-08
    • 1970-01-01
    • 2010-10-26
    • 2011-11-19
    相关资源
    最近更新 更多