1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 03:25:27 +03:00

Log the job being merged

Makes it easier to understand what was merged (and easier to realize why).

Example is a start job running, and another unit triggering a verify-active job. It is not clear what job was it that from baz.service that merged into the installed job for bar.service in the debug logs. This makes it useful when debugging issues.

Jan 15 11:45:58 jupiter systemd[1218]: baz.service: Trying to enqueue job baz.service/start/replace
Jan 15 11:45:58 jupiter systemd[1218]: baz.service: Installed new job baz.service/start as 498
Jan 15 11:45:58 jupiter systemd[1218]: bar.service: Merged into installed job bar.service/start as 497
Jan 15 11:45:58 jupiter systemd[1218]: baz.service: Enqueued job baz.service/start as 498

It becomes:
Jan 15 11:45:58 jupiter systemd[1218]: bar.service: Merged bar.service/verify-active into installed job bar.service/start as 497
This commit is contained in:
bl33pbl0p 2019-01-16 00:03:22 +00:00 committed by Lennart Poettering
parent 2732587540
commit 28d78d0726

View File

@ -206,8 +206,9 @@ Job* job_install(Job *j) {
(job_type_allows_late_merge(j->type) && job_type_is_superset(uj->type, j->type))) {
job_merge_into_installed(uj, j);
log_unit_debug(uj->unit,
"Merged into installed job %s/%s as %u",
uj->unit->id, job_type_to_string(uj->type), (unsigned) uj->id);
"Merged %s/%s into installed job %s/%s as %"PRIu32,
j->unit->id, job_type_to_string(j->type), uj->unit->id,
job_type_to_string(uj->type), uj->id);
return uj;
} else {
/* already running and not safe to merge into */
@ -216,8 +217,8 @@ Job* job_install(Job *j) {
* not currently possible to have more than one installed job per unit. */
job_merge_into_installed(uj, j);
log_unit_debug(uj->unit,
"Merged into running job, re-running: %s/%s as %u",
uj->unit->id, job_type_to_string(uj->type), (unsigned) uj->id);
"Merged into running job, re-running: %s/%s as %"PRIu32,
uj->unit->id, job_type_to_string(uj->type), uj->id);
job_set_state(uj, JOB_WAITING);
return uj;