Logback Configuration in Apache Flink

When a Flink job is started in local mode, the logging config file from the classpath will be used. When the Flink job is started in standalone mode, the logging config is used from the path /opt/flink/conf. Refer the following steps If you want to use logback implementation in Flink jobs running in standalone mode.

Tested Version: Apache Flink 1.9.1


  1. Remove the following files
    • /opt/flink/conf/log4j*.properties
    • /opt/flink/lib/log4j-1.2.17.jar
    • /opt/flink/lib/slf4j-log4j12-1.7.15.jar
  2. Copy the following files to /opt/flink/lib
    • logback-core-1.2.3.jar
    • slf4j-api-1.7.15.jar
    • logback-classic-1.2.3.jar
  3. Update the logback.xml in the path /opt/flink/conf
  4. Update the file /opt/flink/bin/flink-console.sh
    Existing Command:
    #log_setting=("-Dlog4j.configuration=file:${FLINK_CONF_DIR}/log4j-console.properties" "-Dlogback.configurationFile=file:${FLINK_CONF_DIR}/logback-console.xml")
    Updated Command:
    log_setting=("-Dlog4j.configuration=file:${FLINK_CONF_DIR}/logback-console.xml" "-Dlogback.configurationFile=file:${FLINK_CONF_DIR}/logback.xml")

Leave a Reply