mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-27 09:11:53 -05:00
Backport #26267 by @wxiaoguang
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: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit a758337046
)
This commit is contained in:
parent
bd416d0ba9
commit
b97dbf7a9e
2 changed files with 4 additions and 1 deletions
|
@ -102,8 +102,11 @@ MODE = file, file-error
|
||||||
|
|
||||||
; by default, the "file" mode will record logs to %(log.ROOT_PATH)/gitea.log, so we don't need to set it
|
; by default, the "file" mode will record logs to %(log.ROOT_PATH)/gitea.log, so we don't need to set it
|
||||||
; [log.file]
|
; [log.file]
|
||||||
|
; 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
|
||||||
|
; MODE = file
|
||||||
|
|
||||||
[log.file-error]
|
[log.file-error]
|
||||||
|
MODE = file
|
||||||
LEVEL = Error
|
LEVEL = Error
|
||||||
FILE_NAME = file-error.log
|
FILE_NAME = file-error.log
|
||||||
```
|
```
|
||||||
|
|
|
@ -165,7 +165,7 @@ func loadLogModeByName(rootCfg ConfigProvider, loggerName, modeName string) (wri
|
||||||
writerMode.WriterOption = writerOption
|
writerMode.WriterOption = writerOption
|
||||||
default:
|
default:
|
||||||
if !log.HasEventWriter(writerType) {
|
if !log.HasEventWriter(writerType) {
|
||||||
return "", "", writerMode, fmt.Errorf("invalid log writer type (mode): %s", writerType)
|
return "", "", writerMode, fmt.Errorf("invalid log writer type (mode): %s, maybe it needs something like 'MODE=file' in [log.%s] section", writerType, modeName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue