flink日志配置

STEP1: 难受真的难受, 由于网上关于flink日志的的配置很少,导致笔者在配置日志的时候遇到了很多大坑!!!!!!

STEP2:当jar包通过flink的WEBUI提交的时候, 自己配置的log日志没办法打印到配置的路径下,这让人很难受!!!!!

STEP3:后来查询了中外资料发现, flink自带日志配置文件假如是集群运行要提前看一下jar包运行在哪台机器,也就是说我们不需要自己配置配置文件,这个文件就在  flink/conf 文件夹下面!!!  如下两张图:

 

                        

STEP4: 修改配置文件 修改后的文件如下图(具体的修改方法不再演示)

# This affects logging for both user code and Flink
log4j.rootLogger=DEBUG, file

# Uncomment this if you want to _only_ change Flink's logging
#log4j.logger.org.apache.flink=INFO

# 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.
log4j.logger.akka=INFO
log4j.logger.org.apache.kafka=INFO
log4j.logger.org.apache.hadoop=INFO
log4j.logger.org.apache.zookeeper=INFO

# Log all infos in the given file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.file=${log.file}
log4j.appender.file.append=false
log4j.appender.file.Threshold = INFO
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %-60c %x - %m%n


log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.file=/SERVICES01/logs/test.log
log4j.appender.file.append=true
log4j.appender.file.Threshold =WARN
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %-60c %x - %m%n


# Suppress the irrelevant (wrong) warnings from the Netty channel handler
log4j.logger.org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline=ERROR, file

STEP5: 修改后重启集群,日志可以正常打印到配置的路径下!!!!!! 

相关推荐
©️2020 CSDN 皮肤主题: 精致技术 设计师:CSDN官方博客 返回首页