mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-16 21:23:02 -05:00
How do I configure the ROUTER logger in 1.16? #8709
Closed
opened 2025-11-02 08:15:08 -06:00 by GiteaMirror
·
10 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1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4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
No Label
type/question
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#8709
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mjevans on GitHub (Mar 16, 2022).
Gitea Version
v1.16.4 built with GNU Make 4.1, go1.17.8 : bindata, sqlite, sqlite_unlock_notify
Git Version
n/a
Operating System
Arch Linux - gitea binary downloaded from gitea.io
How are you running Gitea?
The systemd unit provided with the archlinux install of gitea
Database
SQLite
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Description
Since I can't reopen #19105
I've skimmed https://docs.gitea.io/en-us/logging-configuration/ for any keywords that seem remotely relevant and tried every sort of logging configuration I can think of. Even when everything is set to Critical only the logs still needlessly record every get and put, twice.
I'd still like to capture any output that indicates a problem might exist, but to help me see if a problem exists I want the haystack to be smaller. The Started GET Completed GET status lines are surely supposed to be INFO level right? Or maybe there's some specific logging facility that isn't obvious?
++
The Archlinux package was already marked stale, and while I updated the git sha hash to checkout in the build script it doesn't produce a working package; probably missing or incorrect build dependencies.
So I grabbed a binary from the site and dropped it over the broken gitea that had been installed.
A new comment has been added to the old gist; the problem persists.
https://gist.github.com/mjevans/cee0ec30575b53e77668ba9fc1cf1be2
Mar 16 08:48:11 gitea gitea[39656]: 2022/03/16 08:48:11 ...dules/setting/log.go:283:newLogService() [I] Gitea v1.16.4 built with GNU Make 4.1, go1.17.8 : bindata, sqlite, sqlite_unlock_notify
It's also unclear what log facility is generating any of these lines. They're prefixed go logging timestamps, the pid, an additional timestamp, and then the message. No indication of the facility or log level like traditional syslog entries.
Screenshots
No response
@zeripath commented on GitHub (Mar 16, 2022):
The STARTED/COMPLETED lines are ROUTER lines.
https://docs.gitea.io/en-us/logging-configuration/#the-router-logger
@zeripath commented on GitHub (Mar 16, 2022):
When discussing Logging you need to show us your configuration too. So what is your logging configuration?
@mjevans commented on GitHub (Mar 16, 2022):
They even show up at Critical level, unless I'm setting that incorrectly. Which might be likely since the documentation appears to reflect v1.17 which I earlier incorrectly thought I was running given the shipped version of go (1.17.8).
I'm currently working around this by adding the DISABLE_ROUTER_LOG line, but I probably want to have it set to WARN instead of getting all of the spam from the TRACE and INFO levels which are exposed even with the current config absent the disable toggle.
@zeripath commented on GitHub (Mar 16, 2022):
I cannot understand from your comments what you want.
DISABLE_ROUTER_LOG: Disables the router logger and all of its subloggers so you will never get any router logsROUTER_LOG_LEVEL: Sets the level that the ROUTER log messages are logged at - not what level the logger will print. (I appreciate this may be somewhat counter-intuitive however, it had to be that way to keep it backwards compatible with the configuration from 1.7.)ROUTER = consoleyou have sent router messages to theconsolesublogger.consolesublogger of the router logger is determined by the following hierarchy:[log.console.router][log.console][log][log.console.router]or[log.console]the type of the logger will aconsolelogger.[log.console.router]or[log.console]the LEVEL it will log at will be the[log]LEVEL.Thus by setting the ROUTER_LOG_LEVEL to ERROR and the main log level to ERROR you've guaranteed that router messages will always appear.
Could you explain clearly what you want?
@zeripath commented on GitHub (Mar 16, 2022):
My suspicion is that you simply need:
@mjevans commented on GitHub (Mar 16, 2022):
I didn't realize what I wanted last night, the documentation is confusing and unclear if someone isn't familiar with the source code.
A) I do not want are the Router logger's TRACE and INFO level events.
B) I would, at least until I have real world data, find Router WARN level events desirable.
This suggestion clearly fulfills A, but seems unlikely to fulfill B.
Some of the configuration came from a template shipped with an older version of Gitea; I think it had a list of the log levels as well as some directives for the log section that are absent on the live documentation. https://docs.gitea.io/en-us/logging-configuration/
Will the above do B while avoiding A? It doesn't appear to accept WARNING (which is the RFC 5424 syntax) and appears to silently default to debug when given "WARNING" as it's level... which is how I know that it will fill my logs with the undesired 'TRACE' (debug?) and 'INFO' levels from the documentation.
The live documentation could be improved with:
An enumeration of log levels. They appear similar to RFC 5424 / syslog style levels https://en.wikipedia.org/wiki/Syslog#Severity_level
Log Groups are at the top, then expanded over the page. It would be more clearly reflected if it had the 'default' logger as the root of a tree, with the three other loggers bullet points beneath it.
"sublogger" needs it's own section and/or should be more clearly a stand-in such as OUTPUTSTREAM (which should be stylized differently than values / variables, and maybe hyperlink to the section describing the possible streams). In several spots log.sublogger.X are highlighted; but sublogger is never defined anywhere. Having slept on it, I happened to notice log.console in the Empty Configuration summary of the defaults.
@zeripath commented on GitHub (Mar 16, 2022):
There are no "WARN" router events.
The router simply logs request start and end.
@mjevans commented on GitHub (Mar 16, 2022):
The current documentation does mention slow and failed routers. (Should "failed" be at Error level instead?)
https://docs.gitea.io/en-us/logging-configuration/#the-router-logger
...
slow routers will be logged at WARN
failed routers will be logged at WARN
@zeripath commented on GitHub (Mar 16, 2022):
That is referring to changes made in 1.17
@mjevans commented on GitHub (Mar 16, 2022):
I'll re-iterate "The live documentation could be improved":
Configuration items that are invalid should be FATAL, possibly deferred until the end of configuration parse. (This is 'documentation' in the form of the program enforcing syntax and providing useful error messages.)
Enumerate accepted log levels. It would also be nice if accepted log levels included accepted values from RFC 5424 https://datatracker.ietf.org/doc/html/rfc5424#page-11 / syslog https://en.wikipedia.org/wiki/Syslog#Severity_level
In the "Log Groups" section the 'default' logger should be the root of a tree, with the three other loggers bullet points beneath it.
An OUTPUT STREAMS section or similar should be added. "sublogger" (E.G. log.sublogger.X ) and similar should be replaced with a hyperlink to that section and a more descriptive name.
The 'empty' configuration should be renamed Default configuration and expanded...
BTW is it intended to allow different log LEVELs across OUTPUTs?