summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-10-07 21:44:16 +0100
committerGitHub <noreply@github.com>2020-10-07 16:44:16 -0400
commit1bf40ca0df431afdca1b3a3836a57914401205d3 (patch)
tree5ce6cceeba3ddb5e93552e9d1695cba0d663aae5 /cmd
parent4df6807b812509244c1ecfc0f6ce65f8d12dfcb2 (diff)
downloadgitea-1bf40ca0df431afdca1b3a3836a57914401205d3.tar.gz
gitea-1bf40ca0df431afdca1b3a3836a57914401205d3.zip
Gitea serv, hooks, manager and the like should always display Fatals (#13032)
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 <art27@cantab.net>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/serv.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/cmd/serv.go b/cmd/serv.go
index b6cdab8334..1938388001 100644
--- a/cmd/serv.go
+++ b/cmd/serv.go
@@ -54,6 +54,8 @@ func setup(logPath string, debug bool) {
_ = log.DelLogger("console")
if debug {
_ = log.NewLogger(1000, "console", "console", `{"level":"trace","stacktracelevel":"NONE","stderr":true}`)
+ } else {
+ _ = log.NewLogger(1000, "console", "console", `{"level":"fatal","stacktracelevel":"NONE","stderr":true}`)
}
setting.NewContext()
if debug {