|
|
879a45 |
diff --git a/scheduler/log.c b/scheduler/log.c
|
|
|
879a45 |
index 33cdac6..d66bbf9 100644
|
|
|
879a45 |
--- a/scheduler/log.c
|
|
|
879a45 |
+++ b/scheduler/log.c
|
|
|
879a45 |
@@ -597,51 +597,6 @@ cupsdLogJob(cupsd_job_t *job, /* I - Job */
|
|
|
879a45 |
if (level > LogLevel && LogDebugHistory <= 0)
|
|
|
879a45 |
return (1);
|
|
|
879a45 |
|
|
|
879a45 |
-#ifdef HAVE_SYSTEMD_SD_JOURNAL_H
|
|
|
879a45 |
- if (!strcmp(ErrorLog, "syslog"))
|
|
|
879a45 |
- {
|
|
|
879a45 |
- cupsd_printer_t *printer = job ? (job->printer ? job->printer : (job->dest ? cupsdFindDest(job->dest) : NULL)) : NULL;
|
|
|
879a45 |
- static const char * const job_states[] =
|
|
|
879a45 |
- { /* job-state strings */
|
|
|
879a45 |
- "Pending",
|
|
|
879a45 |
- "PendingHeld",
|
|
|
879a45 |
- "Processing",
|
|
|
879a45 |
- "ProcessingStopped",
|
|
|
879a45 |
- "Canceled",
|
|
|
879a45 |
- "Aborted",
|
|
|
879a45 |
- "Completed"
|
|
|
879a45 |
- };
|
|
|
879a45 |
-
|
|
|
879a45 |
- va_start(ap, message);
|
|
|
879a45 |
-
|
|
|
879a45 |
- do
|
|
|
879a45 |
- {
|
|
|
879a45 |
- va_copy(ap2, ap);
|
|
|
879a45 |
- status = format_log_line(message, ap2);
|
|
|
879a45 |
- va_end(ap2);
|
|
|
879a45 |
- }
|
|
|
879a45 |
- while (status == 0);
|
|
|
879a45 |
-
|
|
|
879a45 |
- va_end(ap);
|
|
|
879a45 |
-
|
|
|
879a45 |
- if (job)
|
|
|
879a45 |
- sd_journal_send("MESSAGE=%s", log_line,
|
|
|
879a45 |
- "PRIORITY=%i", log_levels[level],
|
|
|
879a45 |
- PWG_Event"=JobStateChanged",
|
|
|
879a45 |
- PWG_ServiceURI"=%s", printer ? printer->uri : "",
|
|
|
879a45 |
- PWG_JobID"=%d", job->id,
|
|
|
879a45 |
- PWG_JobState"=%s", job->state_value < IPP_JSTATE_PENDING ? "" : job_states[job->state_value - IPP_JSTATE_PENDING],
|
|
|
879a45 |
- PWG_JobImpressionsCompleted"=%d", ippGetInteger(job->impressions, 0),
|
|
|
879a45 |
- NULL);
|
|
|
879a45 |
- else
|
|
|
879a45 |
- sd_journal_send("MESSAGE=%s", log_line,
|
|
|
879a45 |
- "PRIORITY=%i", log_levels[level],
|
|
|
879a45 |
- NULL);
|
|
|
879a45 |
-
|
|
|
879a45 |
- return (1);
|
|
|
879a45 |
- }
|
|
|
879a45 |
-#endif /* HAVE_SYSTEMD_SD_JOURNAL_H */
|
|
|
879a45 |
-
|
|
|
879a45 |
/*
|
|
|
879a45 |
* Format and write the log message...
|
|
|
879a45 |
*/
|
|
|
879a45 |
@@ -705,7 +660,43 @@ cupsdLogJob(cupsd_job_t *job, /* I - Job */
|
|
|
879a45 |
return (1);
|
|
|
879a45 |
}
|
|
|
879a45 |
else if (level <= LogLevel)
|
|
|
879a45 |
+ {
|
|
|
879a45 |
+#ifdef HAVE_SYSTEMD_SD_JOURNAL_H
|
|
|
879a45 |
+ if (!strcmp(ErrorLog, "syslog"))
|
|
|
879a45 |
+ {
|
|
|
879a45 |
+ cupsd_printer_t *printer = job ? (job->printer ? job->printer : (job->dest ? cupsdFindDest(job->dest) : NULL)) : NULL;
|
|
|
879a45 |
+ static const char * const job_states[] =
|
|
|
879a45 |
+ { /* job-state strings */
|
|
|
879a45 |
+ "Pending",
|
|
|
879a45 |
+ "PendingHeld",
|
|
|
879a45 |
+ "Processing",
|
|
|
879a45 |
+ "ProcessingStopped",
|
|
|
879a45 |
+ "Canceled",
|
|
|
879a45 |
+ "Aborted",
|
|
|
879a45 |
+ "Completed"
|
|
|
879a45 |
+ };
|
|
|
879a45 |
+
|
|
|
879a45 |
+ if (job)
|
|
|
879a45 |
+ sd_journal_send("MESSAGE=%s", log_line,
|
|
|
879a45 |
+ "PRIORITY=%i", log_levels[level],
|
|
|
879a45 |
+ PWG_Event"=JobStateChanged",
|
|
|
879a45 |
+ PWG_ServiceURI"=%s", printer ? printer->uri : "",
|
|
|
879a45 |
+ PWG_JobID"=%d", job->id,
|
|
|
879a45 |
+ PWG_JobState"=%s", job->state_value < IPP_JSTATE_PENDING ? "" : job_states[job->state_value - IPP_JSTATE_PENDING],
|
|
|
879a45 |
+ PWG_JobImpressionsCompleted"=%d", ippGetInteger(job->impressions, 0),
|
|
|
879a45 |
+ NULL);
|
|
|
879a45 |
+ else
|
|
|
879a45 |
+ sd_journal_send("MESSAGE=%s", log_line,
|
|
|
879a45 |
+ "PRIORITY=%i", log_levels[level],
|
|
|
879a45 |
+ NULL);
|
|
|
879a45 |
+
|
|
|
879a45 |
+ return (1);
|
|
|
879a45 |
+ }
|
|
|
879a45 |
+ else
|
|
|
879a45 |
+#endif /* HAVE_SYSTEMD_SD_JOURNAL_H */
|
|
|
879a45 |
+
|
|
|
879a45 |
return (cupsdWriteErrorLog(level, log_line));
|
|
|
879a45 |
+ }
|
|
|
879a45 |
else
|
|
|
879a45 |
return (1);
|
|
|
879a45 |
}
|