更换日志框架 flink 1.18
1 消除基础flink框架log4j 添加logback jar
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 在镜像制作的时候消除:文章来源:https://www.toymoban.com/news/detail-834162.html
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的时候添加参数文章来源地址https://www.toymoban.com/news/detail-834162.html
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>'
到了这里,关于flink operator 1.7 更换日志框架log4j 到logback的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!