Logback ERROR : No attached appenders found

TeamZ :

i am trying to print the logs Asynchronously to log file. So i am using AsyncAppender to RollingFileAppender. But somehow Logback is throwing Error No attached appenders found

Logback version logback-classic 1.3.0-alpha5 using

I am creating a RollingFileAppender and adding this to AsyncAppender.

below is my logback.xml

<appender name="FILE-ROLLING" 
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logPath}/zapp-info.log</file>

    <rollingPolicy 
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
        <fileNamePattern>${logPath}/archived/zapp.%d{yyyy-MM- 
dd}.%i.log</fileNamePattern>
        <SizeBasedTriggeringPolicy 
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <maxFileSize>10MB</maxFileSize>
        </SizeBasedTriggeringPolicy>
        <totalSizeCap>20GB</totalSizeCap>
        <maxHistory>10</maxHistory>
    </rollingPolicy>
    <encoder 
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
        <Pattern>%d %-5level %t %c{0} %msg%n</Pattern>
    </encoder>
</appender>

<appender name="ASYNC-INFO" 
class="ch.qos.logback.classic.AsyncAppender">
    <discardingThreshold>0</discardingThreshold>
    <queueSize>256</queueSize>
    <appender-ref ref="FILE-ROLLING"/>
</appender>

console logs shows below error messages

10:26:17,566 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler@3ba9ad43 - Processing appender named [ASYNC-INFO]
10:27:29,230 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler@3ba9ad43 - About to instantiate appender of type [ch.qos.logback.classic.AsyncAppender]
10:28:24,982 |-ERROR in ch.qos.logback.classic.AsyncAppender[ASYNC-INFO] - No attached appenders found.
10:28:24,982 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler@3ba9ad43 - Attaching appender [ASYNC-INFO] to Logger[com.logger]
10:28:29,667 |-INFO in ch.qos.logback.core.model.processor.DefaultProcessor@1622f1b - End of configuration.

It should load the AsyncAppender without any error

Ramu :

It seems like a bug in 1.3.0-alpha5 version. If you use 1.3.0-alpha4 or earlier version, that error is not showing up.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=323568&siteId=1