Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logback ERROR : No attached appenders found

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

like image 403
TeamZ Avatar asked Nov 07 '19 05:11

TeamZ


1 Answers

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.

like image 192
Ramu Avatar answered Sep 17 '22 10:09

Ramu