-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gitea serv, hooks, manager and the like should always display Fatals #13032
Gitea serv, hooks, manager and the like should always display Fatals #13032
Conversation
The gitea cmd/serv.go setup function deletes the console logger to prevent stdout interference with commands. However, the problem is that it then calls setting.NewContext which may cause an exit with log.Fatal - which will then not be shown. Now, log.Fatal is so disastrous that the interference that logging causes is wanted. However, we can avoid stdout interference by emitting on stderr. This PR forces the creation of a console logger on stderr listening on Fatal for these commands. Most commands have a `--debug` option now that will print more reasons too - however, defaulting to give the log for Fatal seems reasonable. Signed-off-by: Andrew Thornton <[email protected]>
Although this is an enhancement I think it should be 1.13 as it will significantly help with debugging problems in future. |
Codecov Report
@@ Coverage Diff @@
## master #13032 +/- ##
==========================================
+ Coverage 42.61% 42.62% +0.01%
==========================================
Files 672 672
Lines 73785 73787 +2
==========================================
+ Hits 31445 31454 +9
+ Misses 37247 37244 -3
+ Partials 5093 5089 -4
Continue to review full report at Codecov.
|
The gitea cmd/serv.go setup function deletes the console logger to
prevent stdout interference with commands. However, the problem is that
it then calls setting.NewContext which may cause an exit with log.Fatal - which will then not be shown.
Now, log.Fatal is so disastrous that the interference that logging
causes is wanted. However, we can avoid stdout interference by emitting
on stderr.
This PR forces the creation of a console logger on stderr listening on
Fatal for these commands. Most commands have a
--debug
option now thatwill print more reasons too - however, defaulting to give the log for
Fatal seems reasonable.
Signed-off-by: Andrew Thornton [email protected]