Hi Team, Unable to override the log4j configuratio...
# troubleshooting
d
Hi Team, Unable to override the log4j configurations Running the flink application using
/opt/flink-1.15.2/bin/flink run-application
. Have passed the following configuration
-Denv.java.opts="-Dflink.profile=$PROFILE -Dlog4j.configurationFile=file:/opt/flink/customconf/log4j.properties
Update docker file and also verified the image to have the updated file
Copy code
FROM flink:1.15.2-v1
RUN mkdir -p $FLINK_HOME/usrlib
COPY target/myapp.jar $FLINK_HOME/usrlib/myapp.jar
RUN mkdir -p $FLINK_HOME/customconf
COPY target/classes/log4j.properties $FLINK_HOME/customconf/log4j.properties
COPY target/classes/logback.xml $FLINK_HOME/customconf/logback.xml
But when the application run, it seems to have multiple
log4j.configurationFile
and the property specified get overridden.
Copy code
2023-10-26 05:53:30,807 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -  JVM Options:
2023-10-26 05:53:30,807 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -     -Xmx1073741824
2023-10-26 05:53:30,807 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -     -Xms1073741824
2023-10-26 05:53:30,807 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -     -XX:MaxMetaspaceSize=268435456
2023-10-26 05:53:30,807 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -     -Dflink.profile=azure_icici_pg
2023-10-26 05:53:30,807 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -     -Dlog4j.configurationFile=file:/opt/flink/customconf/log4j.properties
2023-10-26 05:53:30,808 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -     -Dlogback.configurationFile=file:/opt/flink/customconf/logback.xml
2023-10-26 05:53:30,808 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -     -Dlog.file=/opt/flink/log/flink--kubernetes-application-0-appname-5f89565684-l8nt7.log
2023-10-26 05:53:30,808 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -     -Dlog4j.configuration=file:/opt/flink/conf/log4j-console.properties
2023-10-26 05:53:30,808 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -     -Dlog4j.configurationFile=file:/opt/flink/conf/log4j-console.properties
2023-10-26 05:53:30,808 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -     -Dlogback.configurationFile=file:/opt/flink/conf/logback-console.xml
We are using Flink : 1.15.2 Can someone please help to find what am I missing here ? Appreciate any inputs. CC: @Nishant Goenka Thanks