From a3a5ba5f212de5f9b7dc442492bdc6298bbc4a95 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 16 Dec 2018 15:55:25 +1030 Subject: [PATCH] options: set log-level and log-prefix early. Otherwise we potentially miss debug-level logs. Signed-off-by: Rusty Russell --- lightningd/log.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lightningd/log.c b/lightningd/log.c index c8bb4c956..1aa020392 100644 --- a/lightningd/log.c +++ b/lightningd/log.c @@ -520,11 +520,13 @@ char *arg_log_to_file(const char *arg, struct lightningd *ld) void opt_register_logging(struct lightningd *ld) { - opt_register_arg("--log-level", arg_log_level, show_log_level, ld->log, - "log level (io, debug, info, unusual, broken)"); - opt_register_arg("--log-prefix", arg_log_prefix, show_log_prefix, - ld->log, - "log prefix"); + opt_register_early_arg("--log-level", + arg_log_level, show_log_level, ld->log, + "log level (io, debug, info, unusual, broken)"); + opt_register_early_arg("--log-prefix", arg_log_prefix, show_log_prefix, + ld->log, + "log prefix"); + /* We want this opened later, once we have moved to lightning dir */ opt_register_arg("--log-file=", arg_log_to_file, NULL, ld, "log to file instead of stdout"); }