chiark / gitweb /
log: als turn on debug logging in non-PID1 if /proc/cmdline contains "debug"
[elogind.git] / src / core / main.c
index eb5413ef3d38f18d9419388c987de17c3c5bb026..064445d17e00f30887240c1b159af3d0fae262df 100644 (file)
@@ -417,7 +417,7 @@ static int parse_proc_cmdline_word(const char *word) {
                  * will block with every log message for for 60 seconds,
                  * before they give up. */
                 log_set_max_level(LOG_DEBUG);
-                log_set_target(LOG_TARGET_KMSG);
+                log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_KMSG);
         } else if (!in_initrd()) {
                 unsigned i;
 
@@ -462,7 +462,6 @@ DEFINE_SETTER(config_parse_target, log_set_target_from_string, "target")
 DEFINE_SETTER(config_parse_color, log_show_color_from_string, "color" )
 DEFINE_SETTER(config_parse_location, log_show_location_from_string, "location")
 
-
 static int config_parse_cpu_affinity2(const char *unit,
                                       const char *filename,
                                       unsigned line,
@@ -1328,6 +1327,7 @@ int main(int argc, char *argv[]) {
                 /* Running inside a container, as PID 1 */
                 arg_running_as = SYSTEMD_SYSTEM;
                 log_set_target(LOG_TARGET_CONSOLE);
+                log_close_console(); /* force reopen of /dev/console */
                 log_open();
 
                 /* For the later on, see above... */
@@ -1488,7 +1488,8 @@ int main(int argc, char *argv[]) {
                         status_welcome();
 
 #ifdef HAVE_KMOD
-                kmod_setup();
+                if (detect_container(NULL) <= 0)
+                        kmod_setup();
 #endif
                 hostname_setup();
                 machine_id_setup();