Skip to content

Commit

Permalink
Remove extra empty lines from vault.log - Debug command (#16714)
Browse files Browse the repository at this point in the history
* debug empty lines in vault.log

* minor grammar fix

* add changelog

* add fmt changes
  • Loading branch information
akshya96 authored Aug 15, 2022
1 parent 241947d commit 02dbcb6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions changelog/16714.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
debug: Remove extra empty lines from vault.log when debug command is run
```
16 changes: 9 additions & 7 deletions command/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion website/content/api-docs/system/monitor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 02dbcb6

Please sign in to comment.