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

[android] immediateFlush false is not improving performance

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • 1.1.1
    • logback-core

    Description

      Version is 1.1.1-4, latest from the maven.

      I am using this version of your lib in android-project. Time of single calling org.slf4j.Logger.info method is about 4 milliseconds, appender seems like:

      <appender name="trace" class="ch.qos.logback.core.rolling.RollingFileAppender">
          <file>${LOG_DIR}/trace.log</file>
          <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
              <fileNamePattern>${LOG_DIR}/trace.log.%i.zip</fileNamePattern>
              <minIndex>1</minIndex>
              <maxIndex>10</maxIndex>
          </rollingPolicy>
      
          <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
              <maxFileSize>1MB</maxFileSize>
          </triggeringPolicy>
      
          <encoder>
              <pattern>-------------------%n%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %msg%n-------------------%n%n</pattern>
      
              <immediateFlush>false</immediateFlush>
          </encoder>
      </appender>
      

      There is many calls of this method in performance-sensitive method, and sum of calling it taking about 20% of time of method execution. I guess, it happens cause there is synchronous method of writing, this is not surprising. In manual i found immediateFlush flag for encoder, i am tried to add it, but on the average there is no change in performance.

      I guess the difference is must be here, isn't it? Maybe you can add some options for this flag, which can set the moment when deferred writing is happening?

      PS: asynchronous method is not match for my situation, cause worker thread for this asynchronous writing is taking processor time, so asynchronous method works even slowly than synchronous one.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            doubledeath Nevolin Dmitry Leonidovich
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: