[
https://issues.apache.org/jira/browse/FLINK-35898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17868717#comment-17868717
]
Ferenc Csaky commented on FLINK-35898:
--------------------------------------
I am not sure I understand how the passed {{-Dlog.layout.pattern}} connects to
the log file path.
I think according to the given command in the run example, the property that
contains spaces is guarded with single quotes:
{code}
-Dlog.layout.pattern='%d{yyyy-MM-dd HH:mm} %-5p %-60c %-60t %x - %m%n %ex'
{code}
That means it will become an invalid JVM arg in general, regardless of Flink.
If a JVM arg contains spaces, it should be guarded by double quotes:
{code}
-Dlog.layout.pattern="%d{yyyy-MM-dd HH:mm} %-5p %-60c %-60t %x - %m%n %ex"
{code}
Can you share how you pass the dynamic JVM args and deploy the job?
> When running Flink on Yarn, if the log file path contains a space, the
> startup will fail.
> -----------------------------------------------------------------------------------------
>
> Key: FLINK-35898
> URL: https://issues.apache.org/jira/browse/FLINK-35898
> Project: Flink
> Issue Type: Bug
> Components: Deployment / YARN
> Affects Versions: 1.20.0
> Reporter: yiheng tang
> Priority: Minor
> Attachments: image-2024-07-25-21-51-50-072.png,
> image-2024-07-25-21-52-26-973.png
>
>
> We use Yarn to launch Flink jobs and try to add custom parameters to
> configure the log output format in the YarnLogConfigUtil.getLog4jCommand
> method. However, when the parameter value contains spaces, it causes the
> startup to fail.
> The start command in the Yarn container is as follows, omitting some
> irrelevant parameters.
> ```bash
> /bin/bash -c "$JAVA_HOME/bin/java
> -Dlog.file='/data08/yarn/userlogs/application_1719804259110_16060/container_e43_1719804259110_16060_01_000001/jobmanager.log'
> -Dlog4j.configuration=file.properties
> -Dlog4j.configurationFile=file.properties
> -Dlog4j2.isThreadContextMapInheritable=true
> -Dlog.layout.pattern='%d\{yyyy-MM-dd HH:mm} %-5p %-60c %-60t %x - %m%n %ex'
> -Dlog.level=INFO"
> ```
> We discovered that when the value of log.layout.pattern contains spaces, the
> command is incorrectly truncated, causing the content after the space
> (`HH:mm} %-5p %-60c %-60t %x - %m%n %ex' -Dlog.level=INFO"`) to be
> unrecognized, and therefore the Flink job cannot be launched in the Yarn
> container.
> Therefore, we suggest using single quotes (') instead of double quotes (") to
> wrap the values of parameters in the `getLogBackCommand` method and
> `getLog4jCommand` method of the `YarnLogConfigUtil` class.
> !image-2024-07-25-21-52-26-973.png|width=843,height=506!!image-2024-07-25-21-51-50-072.png|width=417,height=218!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)