Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-269

Logback groovy configuration add support for Perf4j

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.1.0
    • None
    • logback-classic
    • None

    Description

      I want to add an AsyncCoalescingStatisticsAppender. The XML confugration looks like this.

      <appender name="CoalescingStatistics" class="org.perf4j.logback.AsyncCoalescingStatisticsAppender">
          <param name="TimeSlice" value="60000"/>
          <appender-ref ref="graphExecutionTimes"/>
          <appender-ref ref="graphExecutionTPS"/>
          <!-- We add the JMX Appender reference onto the CoalescingStatistics -->
          <appender-ref ref="perf4jJmxAppender"/>
      </appender>
      

      logback.groovy's appender function doesn't support <appender-ref ref="perf4jJmxAppender"/>.

      The workaround is to write groovy directly:

      JmxAttributeStatisticsAppender jmxAppender = new JmxAttributeStatisticsAppender()
      jmxAppender.name = "Per4j"
      jmxAppender.context = context
      jmxAppender.tagNamesToExpose="tag1, tag2"
      appenderList.add(jmxAppender)
      
      AsyncCoalescingStatisticsAppender coalAppender = new AsyncCoalescingStatisticsAppender()
      // in millisecond
      coalAppender.timeSlice=10000
      coalAppender.name = "CoalescingStatistics"
      coalAppender.context = context
      coalAppender.addAppender(jmxAppender)
      appenderList.add(coalAppender)
      

      Attachments

        Activity

          People

            tony19 Tony Trinh
            muyen Muyen Lee
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: