-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement enhanced logging using journald/asld #4474
Comments
CUPS.org User: twaugh.redhat Is this meant to be private? |
CUPS.org User: mike Nope, should be public... |
CUPS.org User: thx1138 On Arch Linux, cups 2.0.0-2, in the testing repository, as patched: running "systemctl -n status org.cups.cupsd.service", the last lines of the cupsd entries in the journal do not show in the status output. This, despite the systemctl man page status command description, promising "followed by most recent log data from the journal". Is this a "systemctl status" problem? Or could this be caused by the way cupsd is logging to the journal? |
CUPS.org User: twaugh.redhat Here's an updated patch against master. It includes accurate CODE_FILE, CODE_LINE, and CODE_FUNC fields, as well as additional fields CUPS_DEST and CUPS_PRINTER. |
CUPS.org User: mike OK, just finished the ASL stuff. Next up is the journald support, followed by some cleanup. |
CUPS.org User: mike Fixed in Subversion repository. |
"cups-journal.patch": diff -up cups-1.7.1/config.h.in.journal cups-1.7.1/config.h.in /*
diff -up cups-1.7.1/config-scripts/cups-systemd.m4.journal cups-1.7.1/config-scripts/cups-systemd.m4 +SDJLIBS=""
AC_SUBST(SYSTEMD_UNITS) dnl Description@@ -36,6 +37,9 @@ server activity. The special name "syslog" can be used to send the access information to the system log instead of a plain file. + The special name "journal" can be used to send the access + The default access log file is /var/log/access_log. @@ -108,6 +112,7 @@ language needed. ErrorLog /var/log/cups/error_log ErrorLog /var/log/cups/error_log-%s ErrorLog syslog +ErrorLog journal Description@@ -124,6 +129,11 @@ default error log file is /var/log/The special name "syslog" can be used to send the error information to the system log instead of a plain file. + The special name "journal" can be used to send the error + CUPS 1.4/OS X 10.6FatalErrors@@ -266,6 +276,7 @@ is 644. PageLog /var/log/cups/page_log PageLog /var/log/cups/page_log-%s PageLog syslog +PageLog journal Description@@ -282,6 +293,11 @@ default page log file is /var/log/cThe special name "syslog" can be used to send the page information to the system log instead of a plain file. + The special name "journal" can be used to send the page information + Printcapdiff -up cups-1.7.1/Makedefs.in.journal cups-1.7.1/Makedefs.in #ifdef HAVE_VSYSLOG
@@ -960,13 +960,13 @@ cupsdReadConfiguration(void)
/*
diff -up cups-1.7.1/scheduler/log.c.journal cups-1.7.1/scheduler/log.c
/*
*bufptr = '\0'; +#ifdef HAVE_JOURNAL
int /* O - 1 on success, 0 on failure /
+#ifdef HAVE_JOURNAL
+/*
/*
--- cups-1.7.1/conf/cups-files.conf.in.journal 2014-04-04 13:12:13.923185140 +0100 -# Location of the file logging all access to the scheduler; may be the name Location of cache files used by the scheduler...@@ -44,10 +45,10 @@ AccessLog @CUPS_LOGDIR@/access_log Location of the static web content served by the scheduler...#DocumentRoot @CUPS_DOCROOT@ -# Location of the file logging all messages produced by the scheduler and any Location of fonts used by older print filters...@@ -56,10 +57,10 @@ ErrorLog @CUPS_LOGDIR@/error_log Location of LPD configuration#LPDConfigFile @CUPS_DEFAULT_LPD_CONFIG_FILE@ -# Location of the file logging all pages printed by the scheduler and any Location of the file listing all of the local printers... |
"0001-Support-for-logging-to-the-systemd-journal-STR-4474.patch": From c42e823114ca7bf3e9ff24e32c5940541213b4f4 Mon Sep 17 00:00:00 2001 conf/cups-files.conf.in | 23 +++-- diff --git a/conf/cups-files.conf.in b/conf/cups-files.conf.in -# Location of the file logging all access to the scheduler; may be the name Location of cache files used by the scheduler...@@ -43,10 +44,10 @@ AccessLog @CUPS_LOGDIR@/access_log Location of the static web content served by the scheduler...#DocumentRoot @CUPS_DOCROOT@ -# Location of the file logging all messages produced by the scheduler and any Location of fonts used by older print filters...@@ -55,10 +56,10 @@ ErrorLog @CUPS_LOGDIR@/error_log Location of LPD configuration#LPDConfigFile @CUPS_DEFAULT_LPD_CONFIG_FILE@ -# Location of the file logging all pages printed by the scheduler and any Location of the file listing all of the local printers...diff --git a/config-scripts/cups-startup.m4 b/config-scripts/cups-startup.m4
@@ -65,9 +69,13 @@ The default is usually "/usr/share/doc/cups". @@ -125,8 +133,12 @@ The default is "0644". #ifdef HAVE_VSYSLOG
@@ -959,13 +959,13 @@ cupsdReadConfiguration(void)
/*
+#ifndef _CUPSD_STRINGIFY
+#ifdef HAVE_SYSTEMD
+/*
/_
-int /* O - 1 on success, 0 on error /
-int /* O - 1 on success, 0 on error /
@@ -831,6 +966,17 @@ cupsdLogPage(cupsd_job_t job, / I - Job being printed */ *bufptr = '\0'; +#ifdef HAVE_SYSTEMD
int /* O - 1 on success, 0 on failure /
+#ifdef HAVE_SYSTEMD
/*
|
"str4474.patch": Index: config-scripts/cups-common.m4--- config-scripts/cups-common.m4 (revision 12685) dnl Checks for iconv.h and iconv_open Index: config-scripts/cups-startup.m4--- config-scripts/cups-startup.m4 (revision 12685)
Index: scheduler/log.c--- scheduler/log.c (revision 12685)
@@ -31,9 +65,23 @@ -#ifdef HAVE_VSYSLOG
+#elif defined(HAVE_SYSTEMD_SD_JOURNAL_H)
@@ -211,9 +271,21 @@
+#elif defined(HAVE_SYSTEMD_SD_JOURNAL_H)
@@ -507,6 +579,86 @@ +#ifdef HAVE_ASL_H
+#elif defined(HAVE_SYSTEMD_SD_JOURNAL_H)
+#endif /* HAVE_ASL_H /
+#ifdef HAVE_ASL_H
+#elif defined(HAVE_SYSTEMD_SD_JOURNAL_H)
+#elif defined(HAVE_VSYSLOG)
#else return (1); +#ifdef HAVE_ASL_H
+#elif defined(HAVE_SYSTEMD_SD_JOURNAL_H)
+#endif /* HAVE_ASL_H /
*bufptr = '\0'; -#ifdef HAVE_VSYSLOG
+#elif defined(HAVE_SYSTEMD_SD_JOURNAL_H)
+#elif defined(HAVE_VSYSLOG)
/*
-#ifdef HAVE_VSYSLOG
+#elif defined(HAVE_SYSTEMD_SD_JOURNAL_H)
+#elif defined(HAVE_VSYSLOG)
/*
-#ifdef HAVE_VSYSLOG
+#elif defined(HAVE_SYSTEMD_SD_JOURNAL_H)
+#elif defined(HAVE_VSYSLOG)
if (!strcmp(ErrorLog, "syslog"))
/*
/*
|
"0001-Fix-crash-when-logging-via-journald.patch": From 667091959e964bb6a1a7e4e8a6cc29b0dfd726b2 Mon Sep 17 00:00:00 2001 Signed-off-by: Jiri Popelka jpopelka@redhat.comscheduler/log.c | 2 ++ diff --git a/scheduler/log.c b/scheduler/log.c
|
CUPS.org User: jpopelka Trying 2.1b1 results in crash, patch attached. |
CUPS.org User: mike Please file a new bug (this one is closed) |
Version: 2.1-feature
CUPS.org User: mike
OS X supports an enhanced logging API that replaces syslogd. Linux has journald. We should adopt support for enhanced logging using the PWG Common Log Format (PWG5110.3) syslog attributes.
From Tim Waugh:
Hi,
I've attached the patch I've been using for CUPS 1.7.x to get it to log
to the systemd journal, so you can see the approach I've taken. As I
mentioned last week we could get better logging if we used a macro for
cupsdLog*, as that way the source module and line number would also be
logged accurately.
The meat of it is this bit:
Logs that result from this end up with these fields:
Fri 2014-08-22 16:51:59.000990 BST [s=0b751e71c5ee4016aca9741c09de1025;i=136c1;b=0881631c8e944c36b324de9a54962491;m=207b0832a;t=50139d140d09b;x=bf1d64cb10934e6a]
PRIORITY=6
_UID=0
_GID=0
_SYSTEMD_SLICE=system.slice
_MACHINE_ID=971a1791404d4754ba16b87fa6db358e
_HOSTNAME=localhost.localdomain
_TRANSPORT=journal
_CAP_EFFECTIVE=3fffffffff
CODE_FILE=log.c
SYSLOG_IDENTIFIER=cupsd
_COMM=cupsd
_EXE=/usr/sbin/cupsd
_CMDLINE=/usr/sbin/cupsd -f
_SYSTEMD_CGROUP=/system.slice/cups.service
_SYSTEMD_UNIT=cups.service
_SELINUX_CONTEXT=system_u:system_r:cupsd_t:s0-s0:c0.c1023
_PID=687
_BOOT_ID=0881631c8e944c36b324de9a54962491
CODE_LINE=572
CODE_FUNC=cupsdLogJob
MESSAGE=[Job 2] Adding start banner page "none".
CUPS_JOB_ID=2
_SOURCE_REALTIME_TIMESTAMP=1408722719000990
Fields beginning with "_" are put in by journald (and so can be trusted
to be reliable). Other fields are provided by the application logging
the message. There is more information about them here:
http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html
The only one I've added is CUPS_JOB_ID, but even the default set of
fields gives some useful information for pinpointing/diagnosing
interesting log messages.
Another potentially interesting one is MESSAGE_ID.
I see from developments since 1.7.x that you've got separate functions
for logging messages related to different objects, so that's great.
I'd love to bring the journal support into line with identifiers you are
using for OS X logging.
Tim.
*/
The text was updated successfully, but these errors were encountered: