flink operator 1.7 更换日志框架log4j 到logback

更换日志框架 flink 1.18

1 消除基础flink框架log4j 添加logback jar

bash 复制代码
1-1 log4j
log4j-1.2-api-2.17.1.jar
log4j-api-2.17.1.jar
log4j-core-2.17.1.jar
log4j-slf4j-impl-2.17.1.jar
1-2  logback
logback-core-1.2.3.jar
logback-classic-1.2.3.jar
slf4j-api-1.7.25.jar

2 在镜像制作的时候消除:

bash 复制代码
RUN rm -rf $FLINK_HOME/lib/log4j-1.2-api-2.17.1.jar
RUN rm -rf $FLINK_HOME/lib/log4j-api-2.17.1.jar
RUN rm -rf $FLINK_HOME/lib/log4j-core-2.17.1.jar
RUN rm -rf $FLINK_HOME/lib/log4j-slf4j-impl-2.17.1.jar
RUN rm -rf $FLINK_HOME/lib/log4j-1.2-api-2.17.1.jar
COPY logback-core-1.2.3.jar $FLINK_HOME/lib
COPY logback-classic-1.2.3.jar $FLINK_HOME/lib
COPY slf4j-api-1.7.25.jar $FLINK_HOME/lib      

3-2 制作flink yaml的时候添加参数

yaml 复制代码
logConfiguration:
    logback-console.xml: '<configuration>    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">        <file>${log.file}</file>        <Prudent>false</Prudent>        <encoder>            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{60} %X{sourceThread} - %msg%n</pattern>        </encoder>        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">            <fileNamePattern>${log.file}.%d{yyyy-MM-dd.HH.mm}</fileNamePattern>            <MaxHistory>15</MaxHistory>        </rollingPolicy>    </appender>    <appender name="localfile" class="ch.qos.logback.core.rolling.RollingFileAppender">        <file>/opt/flink/log/${log.file}</file>        <append>false</append>        <Prudent>true</Prudent>        <encoder>            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{60} %X{sourceThread} - %msg%n</pattern>        </encoder>        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">            <fileNamePattern>/opt/flink/log/${log.file}.%d{yyyy-MM-dd.HH.mm}</fileNamePattern>            <MaxHistory>15</MaxHistory>        </rollingPolicy>    </appender>    <root level="DEBUG">        <appender-ref ref="file"/>    </root>    <logger name="akka" level="INFO">        <appender-ref ref="file"/>    </logger>    <logger name="org.apache.kafka" level="INFO">        <appender-ref ref="file"/>    </logger>    <logger name="org.apache.hadoop" level="INFO">        <appender-ref ref="file"/>    </logger>    <logger name="org.apache.zookeeper" level="INFO">        <appender-ref ref="file"/>    </logger>    <logger name="org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline" level="ERROR">        <appender-ref ref="file"/>    </logger></configuration>'
相关推荐
对许6 小时前
SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder“
java·log4j
W Y8 小时前
【架构-37】Spark和Flink
架构·flink·spark
ycsdn109 小时前
Caused by: org.apache.flink.api.common.io.ParseException: Row too short:
大数据·flink
小袁在上班20 小时前
Python 单元测试中的 Mocking 与 Stubbing:提高测试效率的关键技术
python·单元测试·log4j
MinggeQingchun1 天前
Java - SpringBoot之logback设置日期分割并设置指定时间自动清除,Linux启动运行
logback
晨航1 天前
Flink本地模式安装详解
大数据·flink
sf_www1 天前
flink 内存配置(五):网络缓存调优
大数据·网络·flink
我的K84091 天前
Flink滑动窗口(Sliding)中window和windowAll的区别
flink
inori12561 天前
FlinkSql读取外部Mysql和HBase数据库的方法(scala)
mysql·flink·hbase
hello_syz2 天前
lock4j 不生效的问题(个人原因导致的)
java·spring boot·spring·log4j