summaryrefslogtreecommitdiff
path: root/src/shared/log.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-23 17:56:44 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-23 17:56:44 +0100
commitb8d0ffc21f9c237cdeef49b1873b47df1a0a1543 (patch)
tree1e834ae889e94b56ca715fc12fb723c2bdbb006d /src/shared/log.c
parent46525bfc020e06609a44670f277aaf23954e7d85 (diff)
log: als turn on debug logging in non-PID1 if /proc/cmdline contains "debug"
Diffstat (limited to 'src/shared/log.c')
-rw-r--r--src/shared/log.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/shared/log.c b/src/shared/log.c
index 268f0340a1..2a075ffeba 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -879,7 +879,24 @@ int log_set_max_level_from_string(const char *e) {
}
void log_parse_environment(void) {
+ _cleanup_free_ char *line = NULL;
const char *e;
+ int r;
+
+ r = proc_cmdline(&line);
+ if (r < 0)
+ log_warning("Failed to read /proc/cmdline. Ignoring: %s", strerror(-r));
+ else if (r > 0) {
+ char *w, *state;
+ size_t l;
+
+ FOREACH_WORD_QUOTED(w, l, line, state) {
+ if (l == 5 && startswith(w, "debug")) {
+ log_set_max_level(LOG_DEBUG);
+ break;
+ }
+ }
+ }
e = secure_getenv("SYSTEMD_LOG_TARGET");
if (e && log_set_target_from_string(e) < 0)