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> </encoder> </appender>
There is many calls of this method in performance-sensitive method, and sum of calling logs 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.
|