1589593 - cupsd LogLevel ignored when logging to journald (syslog)

This commit is contained in:
Zdenek Dohnal 2018-06-12 12:12:20 +02:00
parent bdf6254e5b
commit 370473678b
2 changed files with 121 additions and 1 deletions

111
cups-journal-history.patch Normal file
View File

@ -0,0 +1,111 @@
diff -up cups-2.2.6/scheduler/log.c.journal-history cups-2.2.6/scheduler/log.c
--- cups-2.2.6/scheduler/log.c.journal-history 2018-06-11 16:39:09.323688006 +0200
+++ cups-2.2.6/scheduler/log.c 2018-06-11 17:08:17.393764901 +0200
@@ -598,48 +598,17 @@ cupsdLogJob(cupsd_job_t *job, /* I - Jo
return (1);
#ifdef HAVE_SYSTEMD_SD_JOURNAL_H
- if (!strcmp(ErrorLog, "syslog"))
- {
- cupsd_printer_t *printer = job ? (job->printer ? job->printer : (job->dest ? cupsdFindDest(job->dest) : NULL)) : NULL;
- static const char * const job_states[] =
- { /* job-state strings */
- "Pending",
- "PendingHeld",
- "Processing",
- "ProcessingStopped",
- "Canceled",
- "Aborted",
- "Completed"
- };
-
- va_start(ap, message);
-
- do
- {
- va_copy(ap2, ap);
- status = format_log_line(message, ap2);
- va_end(ap2);
- }
- while (status == 0);
-
- va_end(ap);
-
- if (job)
- sd_journal_send("MESSAGE=%s", log_line,
- "PRIORITY=%i", log_levels[level],
- PWG_Event"=JobStateChanged",
- PWG_ServiceURI"=%s", printer ? printer->uri : "",
- PWG_JobID"=%d", job->id,
- PWG_JobState"=%s", job->state_value < IPP_JSTATE_PENDING ? "" : job_states[job->state_value - IPP_JSTATE_PENDING],
- PWG_JobImpressionsCompleted"=%d", ippGetInteger(job->impressions, 0),
- NULL);
- else
- sd_journal_send("MESSAGE=%s", log_line,
- "PRIORITY=%i", log_levels[level],
- NULL);
-
- return (1);
- }
+ cupsd_printer_t *printer = job ? (job->printer ? job->printer : (job->dest ? cupsdFindDest(job->dest) : NULL)) : NULL;
+ static const char * const job_states[] =
+ { /* job-state strings */
+ "Pending",
+ "PendingHeld",
+ "Processing",
+ "ProcessingStopped",
+ "Canceled",
+ "Aborted",
+ "Completed"
+ };
#endif /* HAVE_SYSTEMD_SD_JOURNAL_H */
/*
@@ -705,7 +674,29 @@ cupsdLogJob(cupsd_job_t *job, /* I - Jo
return (1);
}
else if (level <= LogLevel)
+ {
+#ifdef HAVE_SYSTEMD_SD_JOURNAL_H
+ if (!strcmp(ErrorLog, "syslog"))
+ {
+ if (job)
+ sd_journal_send("MESSAGE=%s", log_line,
+ "PRIORITY=%i", log_levels[level],
+ PWG_Event"=JobStateChanged",
+ PWG_ServiceURI"=%s", printer ? printer->uri : "",
+ PWG_JobID"=%d", job->id,
+ PWG_JobState"=%s", job->state_value < IPP_JSTATE_PENDING ? "" : job_states[job->state_value - IPP_JSTATE_PENDING],
+ PWG_JobImpressionsCompleted"=%d", ippGetInteger(job->impressions, 0),
+ NULL);
+ else
+ sd_journal_send("MESSAGE=%s", log_line,
+ "PRIORITY=%i", log_levels[level],
+ NULL);
+
+ return (1);
+ }
+#endif /* HAVE_SYSTEMD_SD_JOURNAL_H */
return (cupsdWriteErrorLog(level, log_line));
+ }
else
return (1);
}
@@ -989,7 +980,7 @@ cupsdLogPage(cupsd_job_t *job, /* I - J
*bufptr = '\0';
#ifdef HAVE_SYSTEMD_SD_JOURNAL_H
- if (!strcmp(ErrorLog, "syslog"))
+ if (!strcmp(PageLog, "syslog"))
{
static const char * const job_states[] =
{ /* job-state strings */
@@ -1186,7 +1177,7 @@ cupsdLogRequest(cupsd_client_t *con, /*
}
#ifdef HAVE_SYSTEMD_SD_JOURNAL_H
- if (!strcmp(ErrorLog, "syslog"))
+ if (!strcmp(AccessLog, "syslog"))
{
sd_journal_print(LOG_INFO, "REQUEST %s - %s \"%s %s HTTP/%d.%d\" %d " CUPS_LLFMT " %s %s", con->http->hostname, con->username[0] != '\0' ? con->username : "-", states[con->operation], _httpEncodeURI(temp, con->uri, sizeof(temp)), con->http->version / 100, con->http->version % 100, code, CUPS_LLCAST con->bytes, con->request ? ippOpString(con->request->request.op.operation_id) : "-", con->response ? ippErrorString(con->response->request.status.status_code) : "-");
return (1);

View File

@ -15,7 +15,7 @@ Summary: CUPS printing system
Name: cups Name: cups
Epoch: 1 Epoch: 1
Version: 2.2.7 Version: 2.2.7
Release: 1%{?dist} Release: 2%{?dist}
License: GPLv2 License: GPLv2
Url: http://www.cups.org/ Url: http://www.cups.org/
Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz
@ -62,6 +62,10 @@ Patch36: cups-web-devices-timeout.patch
Patch37: cups-synconclose.patch Patch37: cups-synconclose.patch
Patch38: cups-ypbind.patch Patch38: cups-ypbind.patch
Patch39: cups-substitute-bad-attrs.patch Patch39: cups-substitute-bad-attrs.patch
# cupsd LogLevel ignored when logging to journald (syslog) (#1589593) -
# cups logging ignored log level when logging was set to syslog and
# it did not support job logging history
Patch40: cups-journal-history.patch
Patch100: cups-lspp.patch Patch100: cups-lspp.patch
@ -265,6 +269,8 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
# substitute default values for invalid job attributes (upstream issues #5229 and #5186) # substitute default values for invalid job attributes (upstream issues #5229 and #5186)
%patch39 -p1 -b .substitute-bad-attrs %patch39 -p1 -b .substitute-bad-attrs
# cupsd LogLevel ignored when logging to journald (syslog) (bug #1589593)
%patch40 -p1 -b .journal-history
sed -i -e '1iMaxLogSize 0' conf/cupsd.conf.in sed -i -e '1iMaxLogSize 0' conf/cupsd.conf.in
@ -656,6 +662,9 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man5/ipptoolfile.5.gz %{_mandir}/man5/ipptoolfile.5.gz
%changelog %changelog
* Tue Jun 12 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.2.7-2
- 1589593 - cupsd LogLevel ignored when logging to journald (syslog)
* Tue Apr 03 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.2.7-1 * Tue Apr 03 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.2.7-1
- rebase to 2.2.7 - rebase to 2.2.7
- substitute default values for invalid job attributes (upstream issues #5229 and #5186) - substitute default values for invalid job attributes (upstream issues #5229 and #5186)