Flink logback

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Flink logback

Vishwas Siravara
Hi all,
I modified the logback.xml provided by flink distribution, so now the logback.xml file looks like this :

<configuration>
    <appender name="file" class="ch.qos.logback.core.FileAppender">
        <file>${log.file}</file>
        <append>false</append>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{60} %X{sourceThread} - %msg%n</pattern>
        </encoder>
    </appender>

    <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
        <resetJUL>true</resetJUL>
    </contextListener>

    <!-- To enable JMX Management -->
    <jmxConfigurator />

    <!-- Application Logger -->
    <appender name="applogfile"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>INFO</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
        <file>/var/mware/logs/APPLOGS/service.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/var/mware/logs/APPLOGS/Archive/service.%d{yyyy-MM-dd_HH}.log
                .gz</fileNamePattern>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} %p %c | %m%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>
    <appender name="ASYNC_APPLOG" class="ch.qos.logback.classic.AsyncAppender">
        <discardingThreshold>0</discardingThreshold>
        <queueSize>50000</queueSize>
        <appender-ref ref="applogfile" />
    </appender>
    <logger name="com.visa.flink" level="INFO"
            additivity="false">
        <appender-ref ref="ASYNC_APPLOG" />
    </logger>


    <!-- Error Report Logger -->
    <appender name="serviceerrorfile"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>ERROR</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
        <file>/var/mware/logs/APPLOGS/service-error.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/var/mware/logs/APPLOGS/Archive/service-error.%d{yyyy-MM-dd_HH}.log.gz</fileNamePattern>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} %p %c %m%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>
    <appender name="ASYNC_STREAMING_ERROR" class="ch.qos.logback.classic.AsyncAppender">
        <discardingThreshold>0</discardingThreshold>
        <queueSize>50000</queueSize>
        <appender-ref ref="serviceerrorfile" />
    </appender>
    <logger name="streaming.error" level="ERROR" additivity="false">
        <appender-ref ref="ASYNC_STREAMING_ERROR" />
    </logger>


    <!-- This affects logging for both user code and Flink -->
    <root level="DEBUG">
        <appender-ref ref="file"/>
    </root>

    <!-- Uncomment this if you want to only change Flink's logging -->
    <!--<logger name="org.apache.flink" level="INFO">-->
        <!--<appender-ref ref="file"/>-->
    <!--</logger>-->

    <!-- The following lines keep the log level of common libraries/connectors on
         log level INFO. The root logger does not override this. You have to manually
         change the log levels here. -->
    <logger name="akka" level="DEBUG">
        <appender-ref ref="file"/>
    </logger>
    <logger name="org.apache.kafka" level="DEBUG">
        <appender-ref ref="file"/>
    </logger>
    <logger name="org.apache.hadoop" level="DEBUG">
        <appender-ref ref="file"/>
    </logger>
    <logger name="org.apache.zookeeper" level="INFO">
        <appender-ref ref="file"/>
    </logger>

    <!-- Suppress the irrelevant (wrong) warnings from the Netty channel handler -->
    <logger name="org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline" level="ERROR">
        <appender-ref ref="file"/>
    </logger>
</configuration>



I have two file appenders defined. How ever my application log ends up going to the taskexecutor log file ? How can I fix this issue ? 


Thanks,
Vishwas