1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

systemd: reconnect to syslog as soon as the journal is fully up

This commit is contained in:
Lennart Poettering 2012-01-11 03:16:24 +01:00
parent 3ebcdf8cd9
commit 731a676c20
4 changed files with 13 additions and 30 deletions

View File

@ -178,6 +178,7 @@ static int output_short(sd_journal *j, unsigned line, bool show_all, bool monoto
uint64_t x; uint64_t x;
time_t t; time_t t;
struct tm tm; struct tm tm;
r = -ENOENT; r = -ENOENT;
if (realtime) if (realtime)

View File

@ -3129,36 +3129,20 @@ void manager_recheck_syslog(Manager *m) {
if (m->running_as != MANAGER_SYSTEM) if (m->running_as != MANAGER_SYSTEM)
return; return;
if ((u = manager_get_unit(m, SPECIAL_SYSLOG_SOCKET))) { u = manager_get_unit(m, SPECIAL_JOURNALD_SOCKET);
SocketState state; if (u && SOCKET(u)->state != SOCKET_RUNNING) {
log_close_syslog();
state = SOCKET(u)->state; return;
if (state != SOCKET_DEAD &&
state != SOCKET_FAILED &&
state != SOCKET_RUNNING) {
/* Hmm, the socket is not set up, or is still
* listening, let's better not try to use
* it. Note that we have no problem if the
* socket is completely down, since there
* might be a foreign /dev/log socket around
* and we want to make use of that.
*/
log_close_syslog();
return;
}
} }
if ((u = manager_get_unit(m, SPECIAL_SYSLOG_TARGET))) u = manager_get_unit(m, SPECIAL_JOURNALD_SERVICE);
if (TARGET(u)->state != TARGET_ACTIVE) { if (u && SERVICE(u)->state != SERVICE_RUNNING) {
log_close_syslog(); log_close_syslog();
return; return;
} }
/* Hmm, OK, so the socket is either fully up, or fully down, /* Hmm, OK, so the socket is fully up and the service is up
* and the target is up, then let's make use of the socket */ * too, then let's make use of the thing. */
log_open(); log_open();
} }

View File

@ -71,7 +71,7 @@
#define SPECIAL_DBUS_SERVICE "dbus.service" #define SPECIAL_DBUS_SERVICE "dbus.service"
#define SPECIAL_DBUS_SOCKET "dbus.socket" #define SPECIAL_DBUS_SOCKET "dbus.socket"
#define SPECIAL_JOURNALD_SOCKET "systemd-journald.socket" #define SPECIAL_JOURNALD_SOCKET "systemd-journald.socket"
#define SPECIAL_SYSLOG_SOCKET "syslog.socket" #define SPECIAL_JOURNALD_SERVICE "systemd-journald.service"
/* Magic init signals */ /* Magic init signals */
#define SPECIAL_KBREQUEST_TARGET "kbrequest.target" #define SPECIAL_KBREQUEST_TARGET "kbrequest.target"

View File

@ -37,8 +37,6 @@
* - handle incomplete header * - handle incomplete header
* *
* - kann NTP nicht finden? * - kann NTP nicht finden?
* - in unit.c check ob syslog.socket wegen logging reconnect is kaputt
*
* *
* - local deserializer * - local deserializer
* - http server * - http server