簡體   English   中英

log4j - 為什么logger.debug無效?

[英]log4j - Why is logger.debug not working?

我的log4j.xml文件具有以下配置:

   <appender name="fileAppender"
           class="org.apache.log4j.DailyRollingFileAppender">
      <param name="Threshold" value="INFO" />
      <!-- Change Log File Root when Environment is Set Up -->
      <param name="File" value="${root}/application.log"/>
    <param name="DatePattern" value=".yyyy-MM-dd" />
      <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%d{yyyy-MMM-dd HH:mm:ss,SSS} [%t] %c %x%n  %-5p %m%n"/>
      </layout>
   </appender>

   <logger name="db.scheduler" additivity="false" >
      <level value="all"/>
      <appender-ref ref="consoleAppender"/>
      <appender-ref ref="fileAppender"/>
   </logger>

然而。 當我做logger.debug時,它沒有添加任何東西! logger.info和logger.error工作......但不是logger.debug!

<param name="Threshold" value="INFO" />

您的閾值設置為INFO ,比DEBUG 一級,因此任何調試消息都不會通過過濾器。 在這里查看相對級別:

Level       Description
=====       ===========
OFF         The highest possible rank and is intended to
            turn off logging.
FATAL       Severe errors that cause premature termination.
            Expect these to be immediately visible on a
            status console.
ERROR       Other runtime errors or unexpected conditions.
            Expect these to be immediately visible on a
            status console.
WARN        Use of deprecated APIs, poor use of API,
            'almost' errors, other runtime situations that
            are undesirable or unexpected, but not
            necessarily "wrong". Expect these to be
            immediately visible on a status console.
INFO        Interesting runtime events (startup or
            shutdown). Expect these to be immediately
            visible on a console, so be conservative
            and keep to a minimum.
DEBUG       Detailed information on the flow through
            the system. Expect these to be written to logs
            only.
TRACE       Most detailed information. Expect these to be
            written to logs only. Since version 1.2.12.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM