-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow log.xxx.default to set logging settings for the default logger only #11292
Allow log.xxx.default to set logging settings for the default logger only #11292
Conversation
…only Signed-off-by: Andrew Thornton <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #11292 +/- ##
=======================================
Coverage 43.96% 43.96%
=======================================
Files 614 614
Lines 87426 87428 +2
=======================================
+ Hits 38437 38438 +1
- Misses 44251 44253 +2
+ Partials 4738 4737 -1
Continue to review full report at Codecov.
|
Maybe add some info about this to |
Signed-off-by: Andrew Thornton <[email protected]>
…a into allow-default-log-settings
Logging config still feels like black magic to me (for example, I'm still not sure how to get everything logged to stdout only), but I guess this is fine. |
@silverwind it's really not difficult: [log]
MODE = console
LEVEL = debug
ROOT_PATH = /home/andrew/src/go/gitea/log
REDIRECT_MACARON_LOG = true
MACARON = console
ROUTER = console
XORM = console If, as is sensible, you don't want the SQL being logged - then set: [database]
LOG_SQL=false (I agree it's silly that this isn't the default and that the logging of SQL should only occur at DEBUG level but that's a breaking change which we need to discuss and propose on a PR.) Say you want to have a specific TRACE level logging for a particular file or area: [log]
MODE = console, traceconsole
...
[log.traceconsole]
MODE=console
LEVEL=trace
EXPRESSION=compare The expression will attempt a match against the filename:line:caller, or against the message itself The difficulties come from if you want logging at level WARN or above only - in which case the additional comments I've put in to the document explain why. [database]
LOG_SQL=false
...
[log]
MODE = console
LEVEL = info
ROOT_PATH = /home/andrew/src/go/gitea/log
REDIRECT_MACARON_LOG = true
MACARON = console
ROUTER = console
XORM = console
[log.console.default]
LEVEL=warn Then you will only get main gitea logs at WARN but still get ROUTER, MACARON, and XORM info logs. |
…only (go-gitea#11292) * Allow log.xxx.default to set logging settings for the default logger only Signed-off-by: Andrew Thornton <[email protected]> * Update modules/setting/log.go * as per @silverwind add some documentation Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: techknowlogick <[email protected]>
In #11269 a user wanted to set the default logger to WARN level but leave the rest of the loggers at Info. The current settings require that in order to set this the user would have to add:
for each different type logger they want.
This PR allows the user to set
[log.file.default]
for settings for the default logger onlySigned-off-by: Andrew Thornton [email protected]