-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Bug Description
fiber/middleware/recover/recover.go
Line 12 in 1197a22
| _, _ = os.Stderr.WriteString(fmt.Sprintf("panic: %v\n%s\n", e, debug.Stack())) //nolint:errcheck // This will never fail |
Current output:
panic: ... goroutine ... ... ...
Real go panic output:
panic: ... goroutine ... ... ...
The missing empty line after panic: line cause a log parser to fail match stacktrace.
https://github.com/fluent/fluent-bit/blob/912b7d783a328c09c82aeb16bd26330a468f2005/src/multiline/flb_ml_parser_go.c#L59-L84
ret = rule(mlp, "start_state", "/\\bpanic: /", "go_after_panic", NULL); // ... ret = rule(mlp, "go_after_panic", "/^$/", "go_goroutine", NULL); // ... ret = rule(mlp, "go_goroutine", "/^goroutine \\d+ \\[[^\\]]+\\]:$/", "go_frame_1", NULL);
How to Reproduce
Steps to reproduce the behavior:
app.Use(recovr.New(recovr.Config{ EnableStackTrace: true }))- panic happened
- stderr parsed by a log parser and can successfully parse regular go panic output
- but
middleware/recoveroutput match only first line without stack trace
Expected Behavior
Adding missing \n will make output the same as regular go panic output, so log parser WILL gather stacktrace too.
-"panic: %v\n%s\n"
+"panic: %v\n\n%s\n"Fiber Version
v2.52.2
Code Snippet (optional)
Checklist:
- I agree to follow Fiber's Code of Conduct.
- I have checked for existing issues that describe my problem prior to opening this one.
- I understand that improperly formatted bug reports may be closed without explanation.
Reactions are currently unavailable