[systemd-commits] 4 commits - man/sd-daemon.xml man/systemd.xml src/core src/libudev src/shared src/test src/udev
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Aug 11 11:16:00 PDT 2014
man/sd-daemon.xml | 8 +++++---
man/systemd.xml | 23 ++++++++---------------
src/core/main.c | 3 ++-
src/core/manager.c | 8 ++------
src/libudev/libudev-private.h | 1 -
src/shared/log.c | 13 +++++++++++++
src/shared/log.h | 2 ++
src/test/test-libudev.c | 1 -
src/test/test-udev.c | 1 -
src/udev/accelerometer/Makefile | 1 +
src/udev/accelerometer/accelerometer.c | 16 ++++++----------
src/udev/ata_id/Makefile | 1 +
src/udev/ata_id/ata_id.c | 6 ++++--
src/udev/cdrom_id/Makefile | 1 +
src/udev/cdrom_id/cdrom_id.c | 16 ++++++----------
src/udev/scsi_id/Makefile | 1 +
src/udev/scsi_id/scsi_id.c | 13 ++++++++-----
src/udev/scsi_id/scsi_serial.c | 1 -
src/udev/udevadm-settle.c | 1 -
src/udev/udevadm-test-builtin.c | 1 -
src/udev/udevadm-test.c | 1 -
src/udev/udevadm-trigger.c | 1 -
22 files changed, 60 insertions(+), 60 deletions(-)
New commits:
commit 17fdb7661b7564bc97201fa6fd30a11cba03201c
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 11 20:15:14 2014 +0200
build-sys: add missing makefile symlinks
diff --git a/src/udev/accelerometer/Makefile b/src/udev/accelerometer/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/udev/accelerometer/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/udev/ata_id/Makefile b/src/udev/ata_id/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/udev/ata_id/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/udev/cdrom_id/Makefile b/src/udev/cdrom_id/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/udev/cdrom_id/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/udev/scsi_id/Makefile b/src/udev/scsi_id/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/udev/scsi_id/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
commit ee0e998e1ccb07cc90748e5edcb312f13e8a06f4
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 11 20:14:27 2014 +0200
man: drop any reference to "syslog" as log target
diff --git a/man/sd-daemon.xml b/man/sd-daemon.xml
index 374dac6..d78a115 100644
--- a/man/sd-daemon.xml
+++ b/man/sd-daemon.xml
@@ -98,9 +98,11 @@
<para>These prefixes are intended to be used in
conjunction with stderr-based logging as implemented
by systemd. If a systemd service definition file is
- configured with <varname>StandardError=syslog</varname>
- or <varname>StandardError=kmsg</varname>, these
- prefixes can be used to encode a log level in lines
+ configured with
+ <varname>StandardError=journal</varname>,
+ <varname>StandardError=syslog</varname> or
+ <varname>StandardError=kmsg</varname>, these prefixes
+ can be used to encode a log level in lines
printed. This is similar to the kernel
<function>printk()</function>-style logging. See
<citerefentry><refentrytitle>klogctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>
diff --git a/man/systemd.xml b/man/systemd.xml
index bcbfa02..0d01757 100644
--- a/man/systemd.xml
+++ b/man/systemd.xml
@@ -180,10 +180,8 @@
target. Argument must be one of
<option>console</option>,
<option>journal</option>,
- <option>syslog</option>,
<option>kmsg</option>,
<option>journal-or-kmsg</option>,
- <option>syslog-or-kmsg</option>,
<option>null</option>.</para></listitem>
</varlistentry>
<varlistentry>
@@ -844,26 +842,21 @@
<term><constant>SIGRTMIN+26</constant></term>
<term><constant>SIGRTMIN+27</constant></term>
<term><constant>SIGRTMIN+28</constant></term>
- <term><constant>SIGRTMIN+29</constant></term>
<listitem><para>Sets the log level to
- <literal>journal-or-kmsg</literal>
- (or <literal>console</literal> on
+ <literal>journal-or-kmsg</literal> (or
+ <literal>console</literal> on
<constant>SIGRTMIN+27</constant>,
<literal>kmsg</literal> on
- <constant>SIGRTMIN+28</constant>,
- or <literal>syslog-or-kmsg</literal>
- on <constant>SIGRTMIN+29</constant>), as
+ <constant>SIGRTMIN+28</constant>), as
controlled via
<varname>systemd.log_target=journal-or-kmsg</varname>
- (or <varname>systemd.log_target=console</varname>
- on <constant>SIGRTMIN+27</constant>,
+ (or
+ <varname>systemd.log_target=console</varname>
+ on <constant>SIGRTMIN+27</constant> or
<varname>systemd.log_target=kmsg</varname>
- on <constant>SIGRTMIN+28</constant>,
- or
- <varname>systemd.log_target=syslog-or-kmsg</varname>
- on <constant>SIGRTMIN+29</constant>) on
- the kernel command
+ on <constant>SIGRTMIN+28</constant>)
+ on the kernel command
line.</para></listitem>
</varlistentry>
</variablelist>
commit 5168f84a29b9f0002c9d44133cc9830046bb0619
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 11 20:13:38 2014 +0200
udev: never bypass our own logging framework and call vsyslog() directly from udev tools
diff --git a/src/libudev/libudev-private.h b/src/libudev/libudev-private.h
index af0f125..ae97557 100644
--- a/src/libudev/libudev-private.h
+++ b/src/libudev/libudev-private.h
@@ -20,7 +20,6 @@
#ifndef _LIBUDEV_PRIVATE_H_
#define _LIBUDEV_PRIVATE_H_
-#include <syslog.h>
#include <signal.h>
#include <stdint.h>
#include <stdbool.h>
diff --git a/src/test/test-libudev.c b/src/test/test-libudev.c
index 912b613..ea19099 100644
--- a/src/test/test-libudev.c
+++ b/src/test/test-libudev.c
@@ -25,7 +25,6 @@
#include <errno.h>
#include <string.h>
#include <getopt.h>
-#include <syslog.h>
#include <fcntl.h>
#include <sys/epoll.h>
diff --git a/src/test/test-udev.c b/src/test/test-udev.c
index 26d6537..566a73a 100644
--- a/src/test/test-udev.c
+++ b/src/test/test-udev.c
@@ -26,7 +26,6 @@
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
-#include <syslog.h>
#include <grp.h>
#include <sched.h>
#include <sys/mount.h>
diff --git a/src/udev/accelerometer/accelerometer.c b/src/udev/accelerometer/accelerometer.c
index 32adf27..4513bc6 100644
--- a/src/udev/accelerometer/accelerometer.c
+++ b/src/udev/accelerometer/accelerometer.c
@@ -69,19 +69,12 @@
#define LONG(x) ((x)/BITS_PER_LONG)
#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
-static int debug = 0;
-
_printf_(6,0)
static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
const char *format, va_list args)
{
- if (debug) {
- fprintf(stderr, "%s: ", fn);
- vfprintf(stderr, format, args);
- } else {
- vsyslog(priority, format, args);
- }
+ log_metav(priority, file, line, fn, format, args);
}
typedef enum {
@@ -233,11 +226,13 @@ int main (int argc, char** argv)
struct udev_enumerate *enumerate;
struct udev_list_entry *list_entry;
+ log_parse_environment();
+ log_open();
+
udev = udev_new();
if (udev == NULL)
return 1;
- log_open();
udev_set_log_fn(udev, log_fn);
/* CLI argument parsing */
@@ -250,9 +245,10 @@ int main (int argc, char** argv)
switch (option) {
case 'd':
- debug = 1;
+ log_set_target(LOG_TARGET_CONSOLE);
log_set_max_level(LOG_DEBUG);
udev_set_log_priority(udev, LOG_DEBUG);
+ log_open();
break;
case 'h':
help();
diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c
index f84281d..bfde572 100644
--- a/src/udev/ata_id/ata_id.c
+++ b/src/udev/ata_id/ata_id.c
@@ -410,7 +410,7 @@ static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
const char *format, va_list args)
{
- vsyslog(priority, format, args);
+ log_metav(priority, file, line, fn, format, args);
}
int main(int argc, char *argv[])
@@ -435,11 +435,13 @@ int main(int argc, char *argv[])
{}
};
+ log_parse_environment();
+ log_open();
+
udev = udev_new();
if (udev == NULL)
goto exit;
- log_open();
udev_set_log_fn(udev, log_fn);
while (1) {
diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c
index 33b2bc3..c93a7bf 100644
--- a/src/udev/cdrom_id/cdrom_id.c
+++ b/src/udev/cdrom_id/cdrom_id.c
@@ -37,19 +37,12 @@
#include "libudev.h"
#include "libudev-private.h"
-static bool debug;
-
_printf_(6,0)
static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
const char *format, va_list args)
{
- if (debug) {
- fprintf(stderr, "%s: ", fn);
- vfprintf(stderr, format, args);
- } else {
- vsyslog(priority, format, args);
- }
+ log_metav(priority, file, line, fn, format, args);
}
/* device info */
@@ -875,11 +868,13 @@ int main(int argc, char *argv[])
int cnt;
int rc = 0;
+ log_parse_environment();
+ log_open();
+
udev = udev_new();
if (udev == NULL)
goto exit;
- log_open();
udev_set_log_fn(udev, log_fn);
while (1) {
@@ -900,9 +895,10 @@ int main(int argc, char *argv[])
eject = true;
break;
case 'd':
- debug = true;
+ log_set_target(LOG_TARGET_CONSOLE);
log_set_max_level(LOG_DEBUG);
udev_set_log_priority(udev, LOG_DEBUG);
+ log_open();
break;
case 'h':
printf("Usage: cdrom_id [options] <device>\n"
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
index 5511df8..4d9378a 100644
--- a/src/udev/scsi_id/scsi_id.c
+++ b/src/udev/scsi_id/scsi_id.c
@@ -25,7 +25,6 @@
#include <fcntl.h>
#include <errno.h>
#include <string.h>
-#include <syslog.h>
#include <ctype.h>
#include <getopt.h>
#include <sys/stat.h>
@@ -55,7 +54,6 @@ static bool dev_specified = false;
static char config_file[MAX_PATH_LEN] = "/etc/scsi_id.config";
static enum page_code default_page_code = PAGE_UNSPECIFIED;
static int sg_version = 4;
-static int debug = 0;
static bool reformat_serial = false;
static bool export = false;
static char vendor_str[64];
@@ -70,7 +68,7 @@ static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
const char *format, va_list args)
{
- vsyslog(priority, format, args);
+ log_metav(priority, file, line, fn, format, args);
}
static void set_type(const char *from, char *to, size_t len)
@@ -390,7 +388,10 @@ static int set_options(struct udev *udev,
break;
case 'v':
- debug++;
+ log_set_target(LOG_TARGET_CONSOLE);
+ log_set_max_level(LOG_DEBUG);
+ udev_set_log_priority(udev, LOG_DEBUG);
+ log_open();
break;
case 'V':
@@ -583,11 +584,13 @@ int main(int argc, char **argv)
int newargc;
char **newargv = NULL;
+ log_parse_environment();
+ log_open();
+
udev = udev_new();
if (udev == NULL)
goto exit;
- log_open();
udev_set_log_fn(udev, log_fn);
/*
diff --git a/src/udev/scsi_id/scsi_serial.c b/src/udev/scsi_id/scsi_serial.c
index 378a73d..b3d20a3 100644
--- a/src/udev/scsi_id/scsi_serial.c
+++ b/src/udev/scsi_id/scsi_serial.c
@@ -26,7 +26,6 @@
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
-#include <syslog.h>
#include <time.h>
#include <inttypes.h>
#include <scsi/scsi.h>
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index fae8b4c..ddcf1dd 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -25,7 +25,6 @@
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
-#include <syslog.h>
#include <getopt.h>
#include <signal.h>
#include <time.h>
diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c
index 179f269..a300e1e 100644
--- a/src/udev/udevadm-test-builtin.c
+++ b/src/udev/udevadm-test-builtin.c
@@ -23,7 +23,6 @@
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
-#include <syslog.h>
#include <getopt.h>
#include <signal.h>
#include <time.h>
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index 0f6cccf..8486049 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -25,7 +25,6 @@
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
-#include <syslog.h>
#include <getopt.h>
#include <sys/signalfd.h>
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
index 668791b..a52d1b5 100644
--- a/src/udev/udevadm-trigger.c
+++ b/src/udev/udevadm-trigger.c
@@ -24,7 +24,6 @@
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
-#include <syslog.h>
#include <fnmatch.h>
#include <sys/stat.h>
#include <sys/types.h>
commit c1dc6153c9426d98ddbcd8b5077f397f18ff1da7
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 11 20:08:08 2014 +0200
log: never ever log to syslog from PID 1, log to the journal again
We don't support journal-less systems anyway, so let's avoid the
confusion.
diff --git a/src/core/main.c b/src/core/main.c
index d2104cb..f33b78d 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1018,7 +1018,7 @@ static int help(void) {
" --crash-shell[=0|1] Run shell on crash\n"
" --confirm-spawn[=0|1] Ask for confirmation when spawning processes\n"
" --show-status[=0|1] Show status updates on the console during bootup\n"
- " --log-target=TARGET Set log target (console, journal, syslog, kmsg, journal-or-kmsg, syslog-or-kmsg, null)\n"
+ " --log-target=TARGET Set log target (console, journal, kmsg, journal-or-kmsg, null)\n"
" --log-level=LEVEL Set log level (debug, info, notice, warning, err, crit, alert, emerg)\n"
" --log-color[=0|1] Highlight important log messages\n"
" --log-location[=0|1] Include code location in log messages\n"
@@ -1328,6 +1328,7 @@ int main(int argc, char *argv[]) {
saved_argc = argc;
log_show_color(isatty(STDERR_FILENO) > 0);
+ log_set_upgrade_syslog_to_journal(true);
/* Disable the umask logic */
if (getpid() == 1)
diff --git a/src/core/manager.c b/src/core/manager.c
index 32c0565..445461b 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -341,7 +341,7 @@ static int manager_setup_signals(Manager *m) {
SIGRTMIN+26, /* systemd: set log target to journal-or-kmsg */
SIGRTMIN+27, /* systemd: set log target to console */
SIGRTMIN+28, /* systemd: set log target to kmsg */
- SIGRTMIN+29, /* systemd: set log target to syslog-or-kmsg */
+ SIGRTMIN+29, /* systemd: set log target to syslog-or-kmsg (obsolete)*/
-1);
assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
@@ -1731,6 +1731,7 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
break;
case 26:
+ case 29: /* compatibility: used to be mapped to LOG_TARGET_SYSLOG_OR_KMSG */
log_set_target(LOG_TARGET_JOURNAL_OR_KMSG);
log_notice("Setting log target to journal-or-kmsg.");
break;
@@ -1745,11 +1746,6 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
log_notice("Setting log target to kmsg.");
break;
- case 29:
- log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
- log_notice("Setting log target to syslog-or-kmsg.");
- break;
-
default:
log_warning("Got unhandled signal <%s>.", signal_to_string(sfsi.ssi_signo));
}
diff --git a/src/shared/log.c b/src/shared/log.c
index 078ccdc..2bac998 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -51,6 +51,8 @@ static bool syslog_is_stream = false;
static bool show_color = false;
static bool show_location = false;
+static bool upgrade_syslog_to_journal = false;
+
/* Akin to glibc's __abort_msg; which is private and we hence cannot
* use here. */
static char *log_abort_msg = NULL;
@@ -267,6 +269,13 @@ void log_set_target(LogTarget target) {
assert(target >= 0);
assert(target < _LOG_TARGET_MAX);
+ if (upgrade_syslog_to_journal) {
+ if (target == LOG_TARGET_SYSLOG)
+ target = LOG_TARGET_JOURNAL;
+ else if (target == LOG_TARGET_SYSLOG_OR_KMSG)
+ target = LOG_TARGET_JOURNAL_OR_KMSG;
+ }
+
log_target = target;
}
@@ -984,3 +993,7 @@ void log_received_signal(int level, const struct signalfd_siginfo *si) {
signal_to_string(si->ssi_signo));
}
+
+void log_set_upgrade_syslog_to_journal(bool b) {
+ upgrade_syslog_to_journal = b;
+}
diff --git a/src/shared/log.h b/src/shared/log.h
index 794af7b..9918381 100644
--- a/src/shared/log.h
+++ b/src/shared/log.h
@@ -172,3 +172,5 @@ LogTarget log_target_from_string(const char *s) _pure_;
#define MESSAGE_ID(x) "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(x)
void log_received_signal(int level, const struct signalfd_siginfo *si);
+
+void log_set_upgrade_syslog_to_journal(bool b);
More information about the systemd-commits
mailing list