Skip to content

Commit

Permalink
[FLINK-16237][build] Add Log4j2 configuration properties
Browse files Browse the repository at this point in the history
  • Loading branch information
zentol committed Feb 24, 2020
1 parent 127fd56 commit 9969083
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion flink-connectors/flink-connector-kafka-0.11/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ under the License.
<configuration>
<!-- Enforce single fork execution due to heavy mini cluster use in the tests -->
<forkCount>1</forkCount>
<argLine>-Xms256m -Xmx2048m -Dlog4j.configuration=${log4j.configuration} -Dmvn.forkNumber=${surefire.forkNumber} -XX:-UseGCOverheadLimit</argLine>
<argLine>-Xms256m -Xmx2048m -Dlog4j.configurationFile=${log4j.configuration} -Dmvn.forkNumber=${surefire.forkNumber} -XX:-UseGCOverheadLimit</argLine>
</configuration>
</plugin>
</plugins>
Expand Down
2 changes: 1 addition & 1 deletion flink-connectors/flink-connector-kafka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ under the License.
<configuration>
<!-- Enforce single fork execution due to heavy mini cluster use in the tests -->
<forkCount>1</forkCount>
<argLine>-Xms256m -Xmx2048m -Dlog4j.configuration=${log4j.configuration} -Dmvn.forkNumber=${surefire.forkNumber} -XX:-UseGCOverheadLimit</argLine>
<argLine>-Xms256m -Xmx2048m -Dlog4j.configurationFile=${log4j.configuration} -Dmvn.forkNumber=${surefire.forkNumber} -XX:-UseGCOverheadLimit</argLine>
</configuration>
</plugin>
</plugins>
Expand Down
2 changes: 1 addition & 1 deletion flink-dist/src/main/flink-bin/bin/flink
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fi
CC_CLASSPATH=`constructFlinkClassPath`

log=$FLINK_LOG_DIR/flink-$FLINK_IDENT_STRING-client-$HOSTNAME.log
log_setting=(-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml)
log_setting=(-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlog4j.configurationFile=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml)

# Add HADOOP_CLASSPATH to allow the usage of Hadoop file systems
exec $JAVA_RUN $JVM_ARGS "${log_setting[@]}" -classpath "`manglePathList "$CC_CLASSPATH:$INTERNAL_HADOOP_CLASSPATHS"`" org.apache.flink.client.cli.CliFrontend "$@"
2 changes: 1 addition & 1 deletion flink-dist/src/main/flink-bin/bin/flink-console.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ esac

FLINK_TM_CLASSPATH=`constructFlinkClassPath`

log_setting=("-Dlog4j.configuration=file:${FLINK_CONF_DIR}/log4j-console.properties" "-Dlogback.configurationFile=file:${FLINK_CONF_DIR}/logback-console.xml")
log_setting=("-Dlog4j.configuration=file:${FLINK_CONF_DIR}/log4j-console.properties" "-Dlog4j.configurationFile=file:${FLINK_CONF_DIR}/log4j-console.properties" "-Dlogback.configurationFile=file:${FLINK_CONF_DIR}/logback-console.xml")

JAVA_VERSION=$(${JAVA_RUN} -version 2>&1 | sed 's/.*version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ JVM_ARGS="$JVM_ARGS -Xmx512m"
CC_CLASSPATH=`manglePathList $(constructFlinkClassPath):$INTERNAL_HADOOP_CLASSPATHS`

log=$FLINK_LOG_DIR/flink-$FLINK_IDENT_STRING-k8s-session-$HOSTNAME.log
log_setting="-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-console.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback-console.xml"
log_setting="-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-console.properties -Dlog4j.configurationFile=file:"$FLINK_CONF_DIR"/log4j-console.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback-console.xml"

export FLINK_CONF_DIR

Expand Down
2 changes: 1 addition & 1 deletion flink-dist/src/main/flink-bin/yarn-bin/yarn-session.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ JVM_ARGS="$JVM_ARGS -Xmx512m"
CC_CLASSPATH=`manglePathList $(constructFlinkClassPath):$INTERNAL_HADOOP_CLASSPATHS`

log=$FLINK_LOG_DIR/flink-$FLINK_IDENT_STRING-yarn-session-$HOSTNAME.log
log_setting="-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-yarn-session.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback-yarn.xml"
log_setting="-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-yarn-session.properties -Dlog4j.configurationFile=file:"$FLINK_CONF_DIR"/log4j-yarn-session.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback-yarn.xml"

$JAVA_RUN $JVM_ARGS -classpath "$CC_CLASSPATH" $log_setting org.apache.flink.yarn.cli.FlinkYarnSessionCli -j "$FLINK_LIB_DIR"/flink-dist*.jar "$@"

Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ private static String getLogging(String logFile, String confDir, boolean hasLogb
}
if (hasLog4j) {
logging.append(" -Dlog4j.configuration=file:").append(confDir).append("/log4j.properties");
logging.append(" -Dlog4j.configurationFile=file:").append(confDir).append("/log4j.properties");
}
}
return logging.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class KubernetesUtilsTest extends TestLogger {
private static final String confDirInPod = "/opt/flink/conf";
private static final String logDirInPod = "/opt/flink/log";
private static final String logback = String.format("-Dlogback.configurationFile=file:%s/logback.xml", confDirInPod);
private static final String log4j = String.format("-Dlog4j.configuration=file:%s/log4j.properties", confDirInPod);
private static final String log4j = String.format("-Dlog4j.configuration=file:%s/log4j.properties -Dlog4j.configurationFile=file:%s/log4j.properties", confDirInPod, confDirInPod);
private static final String jmLogfile = String.format("-Dlog.file=%s/jobmanager.log", logDirInPod);
private static final String jmLogRedirects = String.format("1> %s/jobmanager.out 2> %s/jobmanager.err", logDirInPod, logDirInPod);
private static final String tmLogfile = String.format("-Dlog.file=%s/taskmanager.log", logDirInPod);
Expand Down
2 changes: 1 addition & 1 deletion flink-python/bin/pyflink-gateway-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ do
done

log=$FLINK_LOG_DIR/flink-$FLINK_IDENT_STRING-python-$HOSTNAME.log
log_setting=(-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml)
log_setting=(-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlog4j.configurationFile=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml)

PYTHON_JAR_PATH=`echo "$FLINK_HOME"/opt/flink-python*.jar`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void startProcess() throws IOException {
String[] cmd = new String[] {
javaCommandPath,
"-Dlog.level=DEBUG",
"-Dlog4j.configuration=file:" + log4jConfigFilePath,
"-Dlog4j.configurationFile=file:" + log4jConfigFilePath,
"-Xms" + jvmMemoryInMb + "m",
"-Xmx" + jvmMemoryInMb + "m",
"-classpath", getCurrentClasspath(),
Expand Down
2 changes: 1 addition & 1 deletion flink-scala-shell/start-script/start-scala-shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ then
FLINK_CLASSPATH=$FLINK_CLASSPATH:$HADOOP_CLASSPATH:$HADOOP_CONF_DIR:$YARN_CONF_DIR
fi

log_setting="-Dlog.file="$LOG" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/$LOG4J_CONFIG -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/$LOGBACK_CONFIG"
log_setting="-Dlog.file="$LOG" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/$LOG4J_CONFIG -Dlog4j.configurationFile=file:"$FLINK_CONF_DIR"/$LOG4J_CONFIG -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/$LOGBACK_CONFIG"

if ${EXTERNAL_LIB_FOUND}
then
Expand Down
2 changes: 1 addition & 1 deletion flink-table/flink-sql-client/bin/sql-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CC_CLASSPATH=`constructFlinkClassPath`
################################################################################

log=$FLINK_LOG_DIR/flink-$FLINK_IDENT_STRING-sql-client-$HOSTNAME.log
log_setting=(-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml)
log_setting=(-Dlog.file="$log" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlog4j.configurationFile=file:"$FLINK_CONF_DIR"/log4j-cli.properties -Dlogback.configurationFile=file:"$FLINK_CONF_DIR"/logback.xml)

# get path of jar in /opt if it exist
FLINK_SQL_CLIENT_JAR=$(find "$FLINK_OPT_DIR" -regex ".*flink-sql-client.*.jar")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public TestProcessBuilder(String mainClass) throws IOException {
CommonTestUtils.printLog4jDebugConfig(tempLogFile);

jvmArgs.add("-Dlog.level=DEBUG");
jvmArgs.add("-Dlog4j.configuration=file:" + tempLogFile.getAbsolutePath());
jvmArgs.add("-Dlog4j.configurationFile=file:" + tempLogFile.getAbsolutePath());
jvmArgs.add("-classpath");
jvmArgs.add(getCurrentClasspath());

Expand Down

0 comments on commit 9969083

Please sign in to comment.