[PATCH] enable logging for early startup failures
Christof Schmitt
cs at samba.org
Thu Apr 11 17:57:40 UTC 2019
Reviewed-by: Christof Schmitt <cs at samba.org>
Ralph B, are you ok with this update? Feel free to push to autobuild.
Christof
On Thu, Apr 11, 2019 at 01:27:29PM +0200, Ralph Wuerthner via samba-technical wrote:
> On 11.04.19 01:30, Christof Schmitt wrote:
> >On Wed, Apr 10, 2019 at 10:30:40AM +0200, Ralph Böhme via samba-technical wrote:
> >>
> >>
> >>>Am 10.04.2019 um 10:10 schrieb Ralph Wuerthner via samba-technical <samba-technical at lists.samba.org>:
> >>>
> >>>Anybody?
> >>
> >>me! :)
> >>
> >>Lgtm. Second team reviewer please.
> >
> >Looks good to me. I don't see a much better way to initialize logging.
> >There is the special case of not having WITH_SYSLOG, but that is handled
> >in debug.c
> >
> >RB+
> >
> >The only other thought is that the newer struct initializers could be
> >used, but that is just a minor comment.:
> >
> > 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,
> > "syslog at 0",
> > 1,
> > false);
> >
> >
> >Christof
>
> Yes, you're right, this would be better. Please see the new version
> of the patch set which is using a struct initializer.
>
> --
> Regards
>
> Ralph Wuerthner
> From 8c48fb4e2f27e8653bdf109ee1e95ca921ec8920 Mon Sep 17 00:00:00 2001
> From: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
> Date: Thu, 11 Apr 2019 13:01:16 +0200
> Subject: [PATCH 1/3] s3:debug: use struct initializer
>
> Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
> ---
> 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 479348a..3792af5 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.7.4
>
>
> From 84e20d4d58b1f30d05864808124947bb4146b6f9 Mon Sep 17 00:00:00 2001
> From: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
> Date: Thu, 11 Apr 2019 13:11:34 +0200
> Subject: [PATCH 2/3] s3:debug: adjust indention
>
> Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
> ---
> 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 3792af5..381b9d4 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.7.4
>
>
> From 43d245277c2a813e939bc59ccbf2f8436bbe93d5 Mon Sep 17 00:00:00 2001
> From: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
> Date: Mon, 25 Mar 2019 15:17:07 +0100
> Subject: [PATCH 3/3] s3:debug: enable logging for early startup failures
>
> Early startup failures (e.g. unable to connect to CTDB) are currently
> not logged because the debug subsystem is not yet fully initialized.
> Enable logging with reasonable defaults when reopen_logs() is called and
> the parameter file is not yet parsed.
>
> Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
> ---
> 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 381b9d4..4ab7074 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,
> + "syslog at 0",
> + 1,
> + false);
> }
> return reopen_logs_internal();
> }
> --
> 2.7.4
>
More information about the samba-technical
mailing list