0

控制台一直充满了 Quartz WARN 记录器,对于在项目中工作的开发人员来说,在控制台中查找其他记录器消息真的很烦人。

[2013-09-14 11:18:35,142]  WARN {org.quartz.simpl.PropertySettingJobFactory} -  No setter on Job class lk.gov.elg.admin.action.detain.DetainJob for property 'system-id'
[2013-09-14 11:18:35,142]  WARN {org.quartz.simpl.PropertySettingJobFactory} -  No setter on Job class lk.gov.elg.admin.action.detain.DetainJob for property 'end-at'
[2013-09-14 11:18:35,143]  WARN {org.quartz.simpl.PropertySettingJobFactory} -  No setter on Job class lk.gov.elg.admin.action.detain.DetainJob for property 'cron-expression'
[2013-09-14 11:18:35,144]  WARN {org.quartz.simpl.PropertySettingJobFactory} -  No setter on Job class lk.gov.elg.admin.action.detain.DetainJob for property 'start-at'
[2013-09-14 11:18:35,144]  WARN {org.quartz.simpl.PropertySettingJobFactory} -  No setter on Job class lk.gov.elg.admin.action.detain.DetainJob for property 'scheduled-job-id'
[2013-09-14 11:18:35,144]  WARN {org.quartz.simpl.PropertySettingJobFactory} -  No setter on Job class lk.gov.elg.admin.action.detain.DetainJob for property 'size'
[2013-09-14 11:18:40,086]  WARN {org.quartz.simpl.PropertySettingJobFactory} -  No setter on Job class lk.gov.elg.admin.action.detain.DetainJob for property 'GNS'
[2013-09-14 11:18:40,087]  WARN {org.quartz.simpl.PropertySettingJobFactory} -  No setter on Job class lk.gov.elg.admin.action.detain.DetainJob for property 'limit'
[2013-09-14 11:18:40,087]  WARN {org.quartz.simpl.PropertySettingJobFactory} -  No setter on Job class lk.gov.elg.admin.action.detain.DetainJob for property 'tenantId'

我谷歌并找到了一种方法,但它没有给出解决方案。

<logger name="org.quartz">
        <level value="info" />
</logger>

我们使用 log4j.xml 而不是 log4j.properties。

这是 log4j.xml 文件的快照

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration debug="true" xmlns:log4j="http://jakarta.apache.org/log4j/">

    <!--
       Read http://logging.apache.org/log4j/docs/api/org/apache/log4j/DailyRollingFileAppender.html
       for more information on DaliyRollingFileAppender configuration options.
    -->
    <appender name="error" class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="/elg/logs/scandium-error.log"/>
        <param name="Threshold" value="error"/>
        <param name="DatePattern" value="'.'yyyy-MM-dd"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{DATE} %-5p - [%t] [%x] %m%n"/>
        </layout>
    </appender>

    <appender name="debug" class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="/elg/logs/scandium-debug.log"/>
        <param name="Threshold" value="trace"/>
        <param name="DatePattern" value="'.'yyyy-MM-dd"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{DATE} %-5p [%t] - %c{1} [%x] - %m%n"/>
        </layout>
    </appender>

    <appender name="info" class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="/elg/logs/scandium-info.log"/>
        <param name="Threshold" value="info"/>
        <param name="DatePattern" value="'.'yyyy-MM-dd"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{DATE} %-5p %c{1} - [%t] [%x] %m%n"/>
        </layout>
    </appender>

    <appender name="trace" class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="/elg/logs/scandium-trace.log"/>
        <param name="Threshold" value="info"/>
        <param name="DatePattern" value="'.'yyyy-MM-dd"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{DATE} %-5p %c{1} - [%t] [%x] %m%n"/>
        </layout>
    </appender>

    <appender name="console" class="org.apache.log4j.ConsoleAppender">
        <param name="Threshold" value="info"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %-5p %c{1} - [%t] [%x] %m%n"/>
        </layout>
    </appender>

    <category name="com.opensymphony.xwork2.ognl.OgnlValueStack">
        <priority value="error"/>
        <appender-ref ref="error"/>
        <appender-ref ref="console"/>
    </category>

    <root>
        <priority value="trace"/>
        <appender-ref ref="info"/>
        <appender-ref ref="trace"/>
        <appender-ref ref="debug"/>
        <appender-ref ref="error"/>
        <appender-ref ref="console"/>
    </root>

    <logger name="org.quartz">
        <level value="info" />
    </logger>

</log4j:configuration>

请帮助解决问题。提前致谢。

4

1 回答 1

1

WARN是比 更严重的日志级别INFO,因此将日志级别设置为INFO仍会收到警告。最好的解决方案是弄清楚为什么会收到所有这些警告;他们指出的是 Quartz 认为是一个真正的问题(您显然在目标作业类型无法理解的配置中设置了一堆属性)。如果您绝对无法解决真正的问题,那么您可以将日志级别设置为ERROR.

于 2013-09-14T06:05:00.697 回答