Skip to content

Commit 54c28fd

Browse files
wxiaoguangGiteaBot
andauthored
Clarify the logger's MODE config option (go-gitea#26267)
1. Fix the wrong document (add the missing `MODE=`) 2. Add a more friendly log message to tell users to add `MODE=` in their config Co-authored-by: Giteabot <teabot@gitea.io>
1 parent b1089bd commit 54c28fd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

docs/content/administration/logging-config.en-us.md

+3
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ MODE = file, file-error
102102

103103
; by default, the "file" mode will record logs to %(log.ROOT_PATH)/gitea.log, so we don't need to set it
104104
; [log.file]
105+
; by default, the MODE (actually it's the output writer of this logger) is taken from the section name, so we don't need to set it either
106+
; MODE = file
105107

106108
[log.file-error]
109+
MODE = file
107110
LEVEL = Error
108111
FILE_NAME = file-error.log
109112
```

modules/setting/log.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func loadLogModeByName(rootCfg ConfigProvider, loggerName, modeName string) (wri
165165
writerMode.WriterOption = writerOption
166166
default:
167167
if !log.HasEventWriter(writerType) {
168-
return "", "", writerMode, fmt.Errorf("invalid log writer type (mode): %s", writerType)
168+
return "", "", writerMode, fmt.Errorf("invalid log writer type (mode): %s, maybe it needs something like 'MODE=file' in [log.%s] section", writerType, modeName)
169169
}
170170
}
171171

0 commit comments

Comments
 (0)