diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-13 19:28:54 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-11-16 15:22:48 +0100 |
commit | 1cd81629e16d13ec1fd11c6588a2b4957bba4374 (patch) | |
tree | a01d01d24bf4605b3d6c8b24a3ac8ff115c4f1a4 /src/core/job.c | |
parent | a7891d203c5c8192ec16141c00a30d93e175a0cf (diff) | |
download | systemd-1cd81629e16d13ec1fd11c6588a2b4957bba4374.tar.gz |
job: include JOB_ID field in log message about jobs
Diffstat (limited to 'src/core/job.c')
-rw-r--r-- | src/core/job.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/job.c b/src/core/job.c index 2dc520389b..07846ca202 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -754,7 +754,7 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) { } } -static void job_log_status_message(Unit *u, JobType t, JobResult result) { +static void job_log_status_message(Unit *u, uint32_t job_id, JobType t, JobResult result) { const char *format, *mid; char buf[LINE_MAX]; static const int job_result_log_level[_JOB_RESULT_MAX] = { @@ -813,6 +813,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) { default: log_struct(job_result_log_level[result], LOG_MESSAGE("%s", buf), + "JOB_ID=%" PRIu32, job_id, "JOB_TYPE=%s", job_type_to_string(t), "JOB_RESULT=%s", job_result_to_string(result), LOG_UNIT_ID(u), @@ -822,6 +823,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) { log_struct(job_result_log_level[result], LOG_MESSAGE("%s", buf), + "JOB_ID=%" PRIu32, job_id, "JOB_TYPE=%s", job_type_to_string(t), "JOB_RESULT=%s", job_result_to_string(result), LOG_UNIT_ID(u), @@ -829,14 +831,14 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) { mid); } -static void job_emit_status_message(Unit *u, JobType t, JobResult result) { +static void job_emit_status_message(Unit *u, uint32_t job_id, JobType t, JobResult result) { assert(u); /* No message if the job did not actually do anything due to failed condition. */ if (t == JOB_START && result == JOB_DONE && !u->condition_result) return; - job_log_status_message(u, t, result); + job_log_status_message(u, job_id, t, result); job_print_status_message(u, t, result); } @@ -888,11 +890,11 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive, bool alr j->result = result; - log_unit_debug(u, "Job %s/%s finished, result=%s", u->id, job_type_to_string(t), job_result_to_string(result)); + log_unit_debug(u, "Job %" PRIu32 " %s/%s finished, result=%s", j->id, u->id, job_type_to_string(t), job_result_to_string(result)); /* If this job did nothing to respective unit we don't log the status message */ if (!already) - job_emit_status_message(u, t, result); + job_emit_status_message(u, j->id, t, result); /* Patch restart jobs so that they become normal start jobs */ if (result == JOB_DONE && t == JOB_RESTART) { |