Hi All, We are facing issue with logback in Flink...
# troubleshooting
d
Hi All, We are facing issue with logback in Flink. Below is the logback-console.xml being set in Flink :
Copy code
root@raw-data-sink-taskmanager-1-1:/opt/flink/conf# ls -ltr
total 0
lrwxrwxrwx 1 root root 26 May  8 11:12 logback-console.xml -> ..data/logback-console.xml
lrwxrwxrwx 1 root root 22 May  8 11:12 flink-conf.yaml -> ..data/flink-conf.yaml
root@raw-data-sink-taskmanager-1-1:/opt/flink/conf# cat logback-console.xml
<configuration debug="true" scan="true" scanPeriod="30 seconds">
  <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener"/>
  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
        <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

  <logger name="io.company" level="INFO" additivity="false">
    <appender-ref ref="CONSOLE"/>
  </logger>
  <logger name="com.company" level="INFO" additivity="false">
    <appender-ref ref="CONSOLE"/>
  </logger>
  <root level="WARN">
    <appender-ref ref="CONSOLE" />
  </root>
</configuration>
From within a package
com.company.processor.DummyClass.class
I am logging 2 statements, 1 with log.error() and other with log.info() Expecting both to be printed, but only see the ERROR log being printed. Can someone share thoughts on what could be the probable issue here ? Am I missing something ? Appreciate any inputs here. Thanks CC: @Mrinal Ekka
p
How do you define you logger on
com.company.processor.DummyClass
?
d
Hi @Pedro Mázala, Using LoggerFactory
Copy code
package com.company.processor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DummyClass extends ProcessFunction<String, String> {
static final Logger log = LoggerFactory.getLogger(DummyClass.class);

//---inside processElement method : 
log.info("Accepted Data INFO: " + value);
log.error("Accepted Data ERROR:: {}", value);
}
p
Have you tried creating a specific rule for
DummyClass
? This could either be that or Flink is not loading the logback config
Logging may seem hard sometimes. Are those logs on the console or file? IIRC Flink has one file for each. Flink could also be loading log4j config
d
The default logback was printing all INFO logs on the console from all packages. Post this change it certainly has picked up and has restricted to WARN as well. The only thing not working is the INFO level for those packages. Also the logback-console.xml is updated inside the pod as well as in the flink config map.
p
Have you tried moving the root warning to before the other 2 definitions?
d
That did not help either @Pedro Mázala. The logback file is pretty standard, not sure why it would work this way. Do you know if Flink manipulates the logging in anyway ?
Just to close the thread : Had to remove the log4j-* jars from Image. Missed this.