logback.xml的perf4j设置

大家好,我想知道在使用perf4j时logback.xml的确切配置设置。 我在logback.xml中创建此配置

                       firstBlock,secondBlock <!-- The NotificationThresholds param configures the sending of JMX notifications when statistic values exceed specified thresholds. This config states that the firstBlock max value should be between 0 and 800ms, and the secondBlock max value should be less than 1500 ms. You can also set thresholds on the Min, Mean, StdDev, Count and TPS statistics - eg firstBlockMean(<600). firstBlockMax(0-800),secondBlockMax(<1500)-->            logs/perf4j.log  %date %-5level [%thread] %logger{36} [%file:%line] %msg%n   logs/perf4j.%d{yyyy-MM-dd}.log    

我从perf4j logback文档中得到了它。 因此,当我尝试使用此logback conf时,它不会通过任何exception,但它会打印一些奇怪的语句,如下所示

 18:26:19,945 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 18:26:19,945 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 18:26:19,945 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/home/ifkaar/Backup/eclipse/workspace/Perf4jTestProject/bin/logback.xml] 18:26:20,245 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 18:26:20,263 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [org.perf4j.logback.AsyncCoalescingStatisticsAppender] 18:26:20,308 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CoalescingStatistics] 18:26:20,462 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [graphExecutionTimes]. Did you define it below in the config file? 18:26:20,462 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - See http://logback.qos.ch/codes.html#appender_order for more details. 18:26:20,462 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [graphExecutionTPS]. Did you define it below in the config file? 18:26:20,462 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - See http://logback.qos.ch/codes.html#appender_order for more details. 18:26:20,462 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [perf4jJmxAppender]. Did you define it below in the config file? 18:26:20,462 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - See http://logback.qos.ch/codes.html#appender_order for more details. 18:26:20,471 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [org.perf4j.logback.GraphingStatisticsAppender] 18:26:20,506 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [graphExecutionTimes] 18:26:20,535 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [org.perf4j.logback.GraphingStatisticsAppender] 18:26:20,535 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [graphExecutionTPS] 18:26:20,538 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [org.perf4j.logback.JmxAttributeStatisticsAppender] 18:26:20,554 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [perf4jJmxAppender] 18:26:20,913 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [org.perf4j.TimingLogger] to false 18:26:20,914 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - org.perf4j.TimingLogger level set to INFO 18:26:20,914 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CoalescingStatistics] to Logger[org.perf4j.TimingLogger] 18:26:20,914 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [perf4jFileAppender]. Did you define it below in the config file? 18:26:20,914 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - See http://logback.qos.ch/codes.html#appender_order for more details. 18:26:20,914 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender] 18:26:20,930 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [perf4jFileAppender] 18:26:20,962 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 18:26:21,136 |-INFO in cqlcore.rolling.TimeBasedRollingPolicy - No compression will be used 18:26:21,141 |-INFO in cqlcore.rolling.TimeBasedRollingPolicy - Will use the pattern logs/perf4j.%d{yyyy-MM-dd}.log for the active file 18:26:21,151 |-INFO in cqlcore.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern 'logs/perf4j.%d{yyyy-MM-dd}.log'. 18:26:21,151 |-INFO in cqlcore.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight. 18:26:21,158 |-INFO in cqlcore.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Thu May 31 18:26:21 PKT 2012 18:26:21,161 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[perf4jFileAppender] - Active log file name: logs/perf4j.log 18:26:21,161 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[perf4jFileAppender] - File property is set to [logs/perf4j.log] enter code here 

错误消息非常具有描述性:

18:26:20,462 | -ERROR in ch.qos.logback.core.joran.action.AppenderRefAction – 找不到名为[ graphExecutionTimes ]的appender。 你在配置文件中定义了下面的内容吗?

[…]

18:26:20,506 | -INFO in ch.qos.logback.core.joran.action.AppenderAction – 将appender命名为[ graphExecutionTimes ]

错误消息明确询问您:您是否在配置文件中定义了下面的[graphExecutionTimes] appender? 事实上,就是这种情况,如上所示。 只需切换这些声明:

                  

以防万一将perf4jFileAppender移到顶部。 如果此代码段来自Perf4J文档,您应该要求作者修复它。