From a54121a7fe19060b31a8e9abe1d86d167345f2d4 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 12 Dec 2018 08:48:35 +0100 Subject: [PATCH 1/5] debug: add an empty line Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison (cherry picked from commit 2bc7e254a62cfc6a60ecff425fc71173c6d21a10) --- lib/util/debug_s3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/util/debug_s3.c b/lib/util/debug_s3.c index 99ba2e7188d..95f22938bc3 100644 --- a/lib/util/debug_s3.c +++ b/lib/util/debug_s3.c @@ -32,6 +32,7 @@ bool reopen_logs(void) { if (lp_loaded()) { struct debug_settings settings; + debug_set_logfile(lp_logfile(talloc_tos())); ZERO_STRUCT(settings); -- 2.17.0 From c1f9145f5468ada92ccfd3ce06aca967fdb4033d Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 12 Dec 2018 12:43:47 +0100 Subject: [PATCH 2/5] debug: add a call to debug_parse_levels() to reopen_logs() This allows correct refresh of the "log level" setting when reloading config. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison (cherry picked from commit 4341f24069f991dc7119093e418aac392e0a1b50) --- lib/util/debug_s3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/util/debug_s3.c b/lib/util/debug_s3.c index 95f22938bc3..479348a7310 100644 --- a/lib/util/debug_s3.c +++ b/lib/util/debug_s3.c @@ -34,6 +34,7 @@ bool reopen_logs(void) struct debug_settings settings; debug_set_logfile(lp_logfile(talloc_tos())); + debug_parse_levels(lp_log_level(talloc_tos())); ZERO_STRUCT(settings); settings.max_log_size = lp_max_log_size(); -- 2.17.0 From b9aace849673bb26b7caefdf558e9efe52372a6e Mon Sep 17 00:00:00 2001 From: Ralph Wuerthner Date: Thu, 11 Apr 2019 13:01:16 +0200 Subject: [PATCH 3/5] s3:debug: use struct initializer BUG: https://bugzilla.samba.org/show_bug.cgi?id=13904 Signed-off-by: Ralph Wuerthner Reviewed-by: Stefan Metzmacher Reviewed-by: Christof Schmitt (cherry picked from commit b9e1b4ad0033c211710da285c30d603ccb8b8d40) --- lib/util/debug_s3.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/util/debug_s3.c b/lib/util/debug_s3.c index 479348a7310..3792af51f0c 100644 --- a/lib/util/debug_s3.c +++ b/lib/util/debug_s3.c @@ -31,19 +31,18 @@ bool reopen_logs(void) { if (lp_loaded()) { - struct debug_settings settings; + struct debug_settings settings = { + .max_log_size = lp_max_log_size(), + .timestamp_logs = lp_timestamp_logs(), + .debug_prefix_timestamp = lp_debug_prefix_timestamp(), + .debug_hires_timestamp = lp_debug_hires_timestamp(), + .debug_pid = lp_debug_pid(), + .debug_uid = lp_debug_uid(), + .debug_class = lp_debug_class(), + }; debug_set_logfile(lp_logfile(talloc_tos())); debug_parse_levels(lp_log_level(talloc_tos())); - - ZERO_STRUCT(settings); - settings.max_log_size = lp_max_log_size(); - settings.timestamp_logs = lp_timestamp_logs(); - settings.debug_prefix_timestamp = lp_debug_prefix_timestamp(); - settings.debug_hires_timestamp = lp_debug_hires_timestamp(); - settings.debug_pid = lp_debug_pid(); - settings.debug_uid = lp_debug_uid(); - settings.debug_class = lp_debug_class(); debug_set_settings(&settings, lp_logging(talloc_tos()), lp_syslog(), lp_syslog_only()); } -- 2.17.0 From 0e8e7bf89a121a1ce208de61975133ee76baa2c7 Mon Sep 17 00:00:00 2001 From: Ralph Wuerthner Date: Thu, 11 Apr 2019 13:11:34 +0200 Subject: [PATCH 4/5] s3:debug: adjust indention BUG: https://bugzilla.samba.org/show_bug.cgi?id=13904 Signed-off-by: Ralph Wuerthner Reviewed-by: Stefan Metzmacher Reviewed-by: Christof Schmitt (cherry picked from commit a45675879ddcb43ab274d28496eedd6833466ae4) --- lib/util/debug_s3.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/util/debug_s3.c b/lib/util/debug_s3.c index 3792af51f0c..381b9d49102 100644 --- a/lib/util/debug_s3.c +++ b/lib/util/debug_s3.c @@ -43,8 +43,10 @@ bool reopen_logs(void) debug_set_logfile(lp_logfile(talloc_tos())); debug_parse_levels(lp_log_level(talloc_tos())); - debug_set_settings(&settings, lp_logging(talloc_tos()), - lp_syslog(), lp_syslog_only()); + debug_set_settings(&settings, + lp_logging(talloc_tos()), + lp_syslog(), + lp_syslog_only()); } return reopen_logs_internal(); } -- 2.17.0 From 853a117942f313038a5af284bca55c1d287c18a5 Mon Sep 17 00:00:00 2001 From: Ralph Wuerthner Date: Mon, 25 Mar 2019 15:17:07 +0100 Subject: [PATCH 5/5] s3:debug: enable logging for early startup failures Commit c89a33a07a 'debug: Use backends instead of explicitly logging to syslog or file' introduced a regression where early startup failures (e.g. unable to connect to CTDB) are no longer logged because the debug subsystem is not yet fully initialized. Enable logging again with reasonable defaults when reopen_logs() is called and the parameter file is not yet parsed. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13904 Signed-off-by: Ralph Wuerthner Reviewed-by: Stefan Metzmacher Reviewed-by: Christof Schmitt Autobuild-User(master): Christof Schmitt Autobuild-Date(master): Thu Apr 18 22:21:15 UTC 2019 on sn-devel-144 (cherry picked from commit 9b30fcda64080592d20de64b384fd6d3d0775cbf) --- lib/util/debug_s3.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/util/debug_s3.c b/lib/util/debug_s3.c index 381b9d49102..5384ac1718a 100644 --- a/lib/util/debug_s3.c +++ b/lib/util/debug_s3.c @@ -47,6 +47,25 @@ bool reopen_logs(void) lp_logging(talloc_tos()), lp_syslog(), lp_syslog_only()); + } else { + /* + * Parameters are not yet loaded - configure debugging with + * reasonable defaults to enable logging for early + * startup failures. + */ + struct debug_settings settings = { + .max_log_size = 5000, + .timestamp_logs = true, + .debug_prefix_timestamp = false, + .debug_hires_timestamp = true, + .debug_pid = false, + .debug_uid = false, + .debug_class = false, + }; + debug_set_settings(&settings, + "file", + 1, + false); } return reopen_logs_internal(); } -- 2.17.0