应用程序的log

WEB-INF 下 log4j的配置:

<appender name="xoa" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="DatePattern" value="'.'yyyy-MM-dd"/>
    <param name="File" value="../logs/catalina.out"/>
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d{ISO8601} %t %-5p %c - %m%n"/>
    </layout>
</appender>

<logger name="com.xiaonei.jebe.xoa">
    <level value="DEBUG"/>
    <appender-ref ref="xoa" />
  </logger>

 

web.xml 中:

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/log4j.xml</param-value>
    </context-param>

 

性能监控日志:

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

 

<appender name="CoalescingStatistics"
          class="org.perf4j.log4j.AsyncCoalescingStatisticsAppender">
    <!--
      The TimeSlice option is used to determine the time window for which
      all received StopWatch logs are aggregated to create a single
      GroupedTimingStatistics log. Here we set it to 10 seconds, overriding
      the default of 30000 ms
    -->
    <param name="TimeSlice" value="60000"/>
    <appender-ref ref="perf4jFileAppender"/>
</appender>

<!-- This file appender is used to output aggregated performance statistics -->
<appender name="perf4jFileAppender" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="File" value="/data/ad/log/xoa/performance.log"/>
    <param name="DatePattern" value="'_'yyyy-MM-dd'.log'"/>
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%m%n"/>
    </layout>
</appender>