[
https://issues.apache.org/jira/browse/FLINK-17969?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Flink Jira Bot updated FLINK-17969:
-----------------------------------
Labels: pull-request-available stale-minor (was: pull-request-available)
I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] and I help
the community manage its development. I see this issues has been marked as
Minor but is unassigned and neither itself nor its Sub-Tasks have been updated
for 180 days. I have gone ahead and marked it "stale-minor". If this ticket is
still Minor, please either assign yourself or give an update. Afterwards,
please remove the label or in 7 days the issue will be deprioritized.
> Enhance Flink (Task) logging to include job name as context diagnostic
> information
> ----------------------------------------------------------------------------------
>
> Key: FLINK-17969
> URL: https://issues.apache.org/jira/browse/FLINK-17969
> Project: Flink
> Issue Type: Improvement
> Components: Runtime / Task
> Affects Versions: 1.10.0
> Reporter: Bhagavan
> Priority: Minor
> Labels: pull-request-available, stale-minor
>
> Problem statement:
> We use a shared session cluster (Standalone/Yarn) to execute jobs. All logs
> from the cluster are shipped using log aggregation framework
> (Logstash/Splunk) so that application diagnostic is easier.
> However, we are missing one vital information in the logline. i.e. Job name
> so that we can filter the logs for a single job.
> Background
> Currently, Flink logging uses SLF4J as API to abstract away from concrete
> logging implementation (log4j 1.x, Logback or log4j2) and configuration of
> logging pattern and implementation can be configured at deployment, However,
> there is no MDC info from framework indicating job context.
> Proposed improvement.
> Add jobName field to Task class so that we can add it as MDC when task thread
> starts executing.
> Change is trivial and uses SLF4J MDC API.
> With this change, user can customise logging pattern to include MDC (e.g. in
> Logback %X{jobName} )
> Change required.
> {code:java}
> @@ -319,6 +323,7 @@ public class Task implements Runnable, TaskSlotPayload,
> TaskActions, PartitionPr
>
> this.jobId = jobInformation.getJobId();
> + this.jobName = jobInformation.getJobName();
> this.vertexId = taskInformation.getJobVertexId();
> @@ -530,8 +535,10 @@ public class Task implements Runnable, TaskSlotPayload,
> TaskActions, PartitionPr
> @Override
> public void run() {
> try {
> + MDC.put("jobName", this.jobName);
> doRun();
> } finally {
> + MDC.remove("jobName");
> terminationFuture.complete(executionState);
> }
> }
> {code}
> if we are in agreement for this small change. Will raise PR.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)