manager: add log control via RT signals

This commit is contained in:
Lennart Poettering 2011-07-23 04:15:38 +02:00
parent c0576cd6d6
commit 253ee27a0c
3 changed files with 76 additions and 25 deletions

32
TODO
View File

@ -36,7 +36,7 @@ Features:
* logind: non-local X11 server handling
* logind: use sysfs path in device hash table instead of syname, as soon as fb driver is fixed
* logind: use sysfs path in device hash table instead of sysname, as soon as fb driver is fixed
* possibly apply systemd-sysctl per network device subtrees on hotplug
@ -59,7 +59,9 @@ Features:
* readahead: check whether a btrfs volume includes ssd by checking mount flag "ssd"
* support sd_notify() style notificatio when reload is finished (RELOADED=1)
* support sd_notify() style notification when reload is finished (RELOADED=1)
* support sf_notify() style notification when shutting down, to make auto-exit bus services work
* verify that the AF_UNIX sockets of a service in the fs still exist
when we start a service in order to avoid confusion when a user
@ -68,8 +70,6 @@ Features:
* Make it possible to set the keymap independently from the font on
the kernel cmdline. Right now setting one resets also the other.
* add dbus call to convert snapshot into target
* move nss-myhostname into systemd
* figure out a standard place to configure timezone name, inform myllynen@redhat.com
@ -84,14 +84,8 @@ Features:
* allow list of paths in config_parse_condition_path()
* introduce dbus calls for enabling/disabling a service
* support notifications for services being enabled/disabled
* show enablement status in systemctl status
* consider services with any kind of link in /etc/systemd/system enabled
* teach systemctl to enable unit files in arbitrary directories
* In systemctl make sure both is-enabled and is-active print a string, or neither.
@ -101,6 +95,8 @@ Features:
systemctl unmask <unit>
Also support --temp to make this temporary by placing mask links in /run.
* perhaps add "systemctl reenable" as combination of "systemctl disable" and "systemctl enable"
* add support for /bin/mount -s
* GC unreferenced jobs (such as .device jobs)
@ -120,8 +116,8 @@ Features:
* write blog stories about:
- enabling dbus services
- status update
- /etc/sysconfig and /etc/default
- how to make changes to sysctl and sysfs attributes
- remote access
* allow port=0 in .socket units
@ -189,12 +185,8 @@ Features:
* make sure timeouts are applied to Type=oneshot services.
* detect LXC environment
* investigate whether the gnome pty helper should be moved into systemd, to provide cgroup support.
* perhaps add "systemctl reenable" as combination of "systemctl disable" and "systemctl enable"
* need a way to apply mount options of api vfs from systemd unit files
(or some other modern source?) instead of fstab?
@ -218,16 +210,6 @@ Features:
* systemd --user
- get PR_SET_ANCHOR merged: http://lkml.org/lkml/2010/2/2/165
* add VT tracking:
- provide CK functionality
- start getty only when actual vt switch happens (same model as
socket on-demand activation). allocate the next free tty and
start a getty there. this way, pressing alt-f[1-12] will switch
through running X and getty sessions, and any unallocated
activated tty will start a new getty. the hardcoding of
getty[1-6] will entirely go away.
- http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fbc92a3455577ab17615cbcb91826399061bd789
* implicitly import "defaults" settings file into all types
* port over to LISTEN_FDS/LISTEN_PID:

View File

@ -800,6 +800,44 @@
on the kernel command
line.</para></listitem>
</varlistentry>
<varlistentry>
<term>SIGRTMIN+22</term>
<term>SIGRTMIN+23</term>
<listitem><para>Sets the log level to
<literal>debug</literal>
(resp. <literal>info</literal> on
<literal>SIGRTMIN+32</literal>), as
controlled via
<varname>systemd.log_level=debug</varname>
(resp. <varname>systemd.log_level=info</varname>
on <literal>SIGRTMIN+23</literal>) on
the kernel command
line.</para></listitem>
</varlistentry>
<varlistentry>
<term>SIGRTMIN+27</term>
<term>SIGRTMIN+28</term>
<term>SIGRTMIN+29</term>
<listitem><para>Sets the log level to
<literal>console</literal>
(resp. <literal>kmsg</literal> on
<literal>SIGRTMIN+28</literal>;
resp.<literal>syslog-or-kmsg</literal>
on <literal>SIGRTMIN+29</literal>), as
controlled via
<varname>systemd.log_target=console</varname>
(resp. <varname>systemd.log_target=kmsg</varname>
on <literal>SIGRTMIN+28</literal>;
resp
<varname>systemd.log_target=syslog-or-kmsg</varname>
on <literal>SIGRTMIN+29</literal>) on
the kernel command
line.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -186,6 +186,11 @@ static int manager_setup_signals(Manager *m) {
SIGRTMIN+16, /* systemd: Immediate kexec */
SIGRTMIN+20, /* systemd: enable status messages */
SIGRTMIN+21, /* systemd: disable status messages */
SIGRTMIN+22, /* systemd: set log level to LOG_DEBUG */
SIGRTMIN+23, /* systemd: set log level to LOG_INFO */
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 */
-1);
assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
@ -2200,6 +2205,7 @@ static int manager_process_signal_fd(Manager *m) {
break;
default: {
/* Starting SIGRTMIN+0 */
static const char * const target_table[] = {
[0] = SPECIAL_DEFAULT_TARGET,
@ -2244,6 +2250,31 @@ static int manager_process_signal_fd(Manager *m) {
m->show_status = false;
break;
case 22:
log_set_max_level(LOG_DEBUG);
log_notice("Setting log level to debug.");
break;
case 23:
log_set_max_level(LOG_INFO);
log_notice("Setting log level to info.");
break;
case 27:
log_set_target(LOG_TARGET_CONSOLE);
log_notice("Setting log target to console.");
break;
case 28:
log_set_target(LOG_TARGET_KMSG);
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>.", strna(signal_to_string(sfsi.ssi_signo)));
}