diff --git a/libsystemd/sd-daemon.h b/libsystemd/sd-daemon.h index 672968f0..73389edd 100644 --- a/libsystemd/sd-daemon.h +++ b/libsystemd/sd-daemon.h @@ -6,6 +6,16 @@ #define SD_LISTEN_FDS_START 3 +/* systemd logging defines for stderr parsing by Finit */ +#define SD_EMERG "<0>" /* system is unusable */ +#define SD_ALERT "<1>" /* action must be taken immediately */ +#define SD_CRIT "<2>" /* critical conditions */ +#define SD_ERR "<3>" /* error conditions */ +#define SD_WARNING "<4>" /* warning conditions */ +#define SD_NOTICE "<5>" /* normal but significant condition */ +#define SD_INFO "<6>" /* informational */ +#define SD_DEBUG "<7>" /* debug-level messages */ + /* Basic notification function */ int sd_notify(int unset_environment, const char *state); diff --git a/src/service.c b/src/service.c index a8a9d60c..41bb4751 100644 --- a/src/service.c +++ b/src/service.c @@ -342,6 +342,7 @@ static int lredirect(svc_t *svc) if (svc->log.prio[0]) prio = svc->log.prio; + /* Neither sysklogd logger or native logit tool available */ if (!have_sysklogd && !whichp(_PATH_LOGIT)) { logit(LOG_INFO, _PATH_LOGIT " missing, using syslog for %s instead", svc->name); fallback_logger(tag, prio); @@ -367,7 +368,13 @@ static int lredirect(svc_t *svc) _exit(1); } - if (have_sysklogd) { + /* + * For now, let systemd programs go via our native logit + * tool. It supports systemd logging defines for stderr + * parsing. The only real downside is that it cannot do + * PID faking, like sysklogd's logger tool. + */ + if (have_sysklogd && svc->notify != SVC_NOTIFY_SYSTEMD) { char pid[16]; snprintf(pid, sizeof(pid), "%d", svc_pid);