为什么没有生成perf4j图?

时间:2013-05-03 14:19:59

标签: java logging logback perf4j

我在一个独立的应用程序中集成了Perf4j。我正在使用SLF4J / logback作为日志记录系统。

在perfs.log中正确生成统计信息,但graphs.log文件中没有生成任何内容。

这是我的logback.xml配置文件:

<configuration>
    <appender name="graphs_file" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <File>logs/graphs.log</File>
        <encoder>
            <Pattern>%m%n</Pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <FileNamePattern>logs/graphs.%d{yyyy-MM-dd}.log</FileNamePattern>
        </rollingPolicy>
    </appender>

    <appender name="graph_mean" class="org.perf4j.logback.GraphingStatisticsAppender">
        <param name="GraphType" value="Mean"/>
        <param name="TagNamesToGraph" value="g2p-load,p2g-load,phonetize-request,graphetize-request,full-request"/>
        <appender-ref ref="graphs_file"/>
    </appender>

    <appender name="perf_file" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <File>logs/perfs.log</File>
        <encoder>
            <Pattern>%date %-5level [%thread] %logger{36} [%file:%line] %msg%n</Pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <FileNamePattern>logs/perfs.%d{yyyy-MM-dd}.log</FileNamePattern>
        </rollingPolicy>
    </appender>

    <appender name="log_file" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <File>logs/veriname.log</File>
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <FileNamePattern>logs/veriname.%d{yyyy-MM-dd}.log</FileNamePattern>
        </rollingPolicy>
    </appender>

    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
        </encoder>
    </appender>

    <appender name="coalescer" class="org.perf4j.logback.AsyncCoalescingStatisticsAppender">
        <param name="TimeSlice" value="60000"/>

        <appender-ref ref="graph_mean"/>

        <appender-ref ref="perf_file"/>
    </appender>

    <logger name="org.perf4j.TimingLogger" additivity="false">
        <level value="INFO"/>
        <appender-ref ref="coalescer"/>
    </logger>

    <root>
        <appender-ref ref="console" />
        <appender-ref ref="log_file" />
    </root>
</configuration>

在代码中,我正在使用:

StopWatch watch = new Slf4JStopWatch("phonetize-request");

奇怪的是,它适用于perfs.log文件中的聚合,但graphs.log中没有任何反应。

我做错了什么?

0 个答案:

没有答案