Search code examples
log4j2apache-flink

How to view task logs in flink web ui?


I can view the task manager's logs from web ui:

enter image description here

But suppose I submit a job, and use log4j2 to write some logs to a specific file, can I make some configurations so I can view the logs from web ui?


Solution

  • In the script :

    $FLINK_HOME/bin/flink
    

    You will find these 2 lines:

    log=$FLINK_LOG_DIR/flink-$FLINK_IDENT_STRING-client-$HOSTNAME.log
    log_setting=(-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml)
    

    Either you configure log4j to store the logs in flink path, i.e: $FLINK_HOME/log, or modify $FLINK_HOME/bin/flink script by adding log4j logs path location.

    Hope it helps :) !