From ba15b1f8227190cd3b4d04687028c7a0acc1ab07 Mon Sep 17 00:00:00 2001 From: akshya96 <87045294+akshya96@users.noreply.github.com> Date: Mon, 15 Aug 2022 14:16:57 -0700 Subject: [PATCH] Remove extra empty lines from vault.log - Debug command (#16714) * debug empty lines in vault.log * minor grammar fix * add changelog * add fmt changes --- changelog/16714.txt | 3 +++ command/debug.go | 16 +++++++++------- website/content/api-docs/system/monitor.mdx | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 changelog/16714.txt diff --git a/changelog/16714.txt b/changelog/16714.txt new file mode 100644 index 000000000..a13610699 --- /dev/null +++ b/changelog/16714.txt @@ -0,0 +1,3 @@ +```release-note:bug +debug: Remove extra empty lines from vault.log when debug command is run +``` \ No newline at end of file diff --git a/command/debug.go b/command/debug.go index 631ec9b41..8213507cd 100644 --- a/command/debug.go +++ b/command/debug.go @@ -1080,13 +1080,15 @@ func (c *DebugCommand) writeLogs(ctx context.Context) { for { select { case log := <-logCh: - if !strings.HasSuffix(log, "\n") { - log += "\n" - } - _, err = out.WriteString(log) - if err != nil { - c.captureError("log", err) - return + if len(log) > 0 { + if !strings.HasSuffix(log, "\n") { + log += "\n" + } + _, err = out.WriteString(log) + if err != nil { + c.captureError("log", err) + return + } } case <-ctx.Done(): return diff --git a/website/content/api-docs/system/monitor.mdx b/website/content/api-docs/system/monitor.mdx index e29f2cb46..377c22cac 100644 --- a/website/content/api-docs/system/monitor.mdx +++ b/website/content/api-docs/system/monitor.mdx @@ -26,7 +26,7 @@ default, this is text. - `log_level` `(string: "info")` – Specifies the log level to use when streaming logs. This defaults to `info` if not specified. -- `log_format` `(string: "standard")` – Specifies the log format to emit when streaming logs. Supported values are "standard" and "json". The default is `standard`. +- `log_format` `(string: "standard")` – Specifies the log format to emit when streaming logs. Supported values are "standard" and "json". The default is `standard`, if not specified. ### Sample Request