X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Flog.c;h=2a075ffebab7953c81c905b6811fb719ed80bb44;hb=2d5bdf5bc0e4714d42e5999a4e37553a6bf83575;hp=268f0340a12416c32cf842c1e0d6d26deed5b0f7;hpb=4d89874af6a798744a32deb314001a13a28f0559;p=elogind.git diff --git a/src/shared/log.c b/src/shared/log.c index 268f0340a..2a075ffeb 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)