From 979f08053f1947ab09410216bcc0bc6020ef7ac9 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 24 May 2023 08:09:33 +0800 Subject: [PATCH] Fix logger refactoring regression: manager logging add (#24847) The `rotate` option is optional. Test result: ![image](https://github.com/go-gitea/gitea/assets/2114189/7cff8207-dcf3-4988-adef-247f1c9316e7) --- routers/private/manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/private/manager.go b/routers/private/manager.go index 26096c403b..397e6fac7b 100644 --- a/routers/private/manager.go +++ b/routers/private/manager.go @@ -155,7 +155,7 @@ func AddLogger(ctx *context.PrivateContext) { writerOption := log.WriterFileOption{} fileName, _ := opts.Config["filename"].(string) writerOption.FileName = setting.LogPrepareFilenameForWriter(fileName, opts.Writer+".log") - writerOption.LogRotate = opts.Config["rotate"].(bool) + writerOption.LogRotate, _ = opts.Config["rotate"].(bool) maxSizeShift, _ := opts.Config["maxsize"].(int) if maxSizeShift == 0 { maxSizeShift = 28