It's hard for me to see the issue from what you posted, However i can post
how i added that jar to my flink pods and you can compare
Instead of creating a custom image i loaded the JAR as a config map

You can create a configMap easily from a file:
1.Download the jar you want
2.Create the configMap in k8s using this command kubectl create configmap
log4j-layout-template-json-2-16-0-jar
--from-file=log4j-layout-template-json-2.16.0.jar
3.Then in flink just mount the configMap and copy it to the lib folder with
the custom entrypoint

As for the logging config

rootLogger.level = INFO
rootLogger.appenderRef.console.ref = ConsoleAppender
rootLogger.appenderRef.rolling.ref = RollingFileAppender

logger.akka.name = akka
logger.akka.level = INFO
logger.kafka.name= org.apache.kafka
logger.kafka.level = INFO
logger.hadoop.name = org.apache.hadoop
logger.hadoop.level = INFO
logger.zookeeper.name = org.apache.zookeeper
logger.zookeeper.level = INFO
# Log all infos to the console
appender.console.name = ConsoleAppender
appender.console.type = CONSOLE
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %-60c %x
- %m%n
# Log all infos in the given rolling file
appender.rolling.name = RollingFileAppender
appender.rolling.type = RollingFile
appender.rolling.append = false
appender.rolling.fileName = ${sys:log.file}
appender.rolling.filePattern = ${sys:log.file}.%i
appender.rolling.layout.type = JsonTemplateLayout #This and all other
layout setting are the important part
appender.rolling.layout.compact = true
appender.rolling.layout.eventEol = true
appender.rolling.layout.stacktraceAsString = true
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=100MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 10
# Suppress the irrelevant (wrong) warnings from the Netty channel handler
logger.netty.name =
org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline
logger.netty.level = OFF


On 2022/01/20 14:24:32 Jessy Ping wrote:
> Hi Team,
>
> How can I use log4j-layout-template-json in flink for logging in json
> format ?.
> I have tried to add this jar into the /flink/lib/ directory with a custom
> image and I am getting the following error.
> Any insight would be appreciated.
>
> [image: image.png]
>
> Thanks
> Jessy
>

Reply via email to