I’ve been trying to lower the log levels for Mopidy to INFO so that I can reduce the noise and debug an extension that I am working on.
I can’t figure out how to make it work. My mopidy.conf contains:
color = true
console_format = %(levelname)-8s %(message)s
debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n %(message)s
debug_file = mopidy.log
config_file = /Users/jcass/.config/mopidy/logging.conf
root = INFO
mopidy = INFO
mopidy_pandora.backend = DEBUG
…but it doesn’t have any effect and whatever is specified in
logging.conf (either higher or lower than the level I am looking for) will take precedence and end up in
Is anybody using this at the moment and are the fixes mentioned in https://github.com/mopidy/mopidy/issues/684 still effective?
Update: it does seem to reduce the log levels specified in
logging.conf, but only for messages displayed to the console if mopidy is started from the terminal.
When run as a service
mopidy.log still contains everything - is there perhaps another logging endpoint used for the log file that should be configured as well?
Looking at the code it seems that the verbosity filter is only applied to the
If we want to align what is logged to the console with what is logged to
mopidy.log (and make the
loglevels/* parameter effective for service users), then we would have to add
VerbosityFilter to the
FileHandler that is defined in
logging.conf- any objections to this idea?
The logging features have grown somewhat organically, so I’m not at all surprised that not all features works as orthonogally as they should.
Today, there’s four ways of logging that I can think of:
- to the console (run
- to the console and then into some logging service (run mopidy with systemd, and the console log ends up in the systemd journal),
- to a debug log (run
mopidy --save-debug-log), typically
- to anything defined in a logging config, as pointed to by the config value
loglevels/* works for cases 1 and 2, but not 3 or 4. Am I right?
One possible solution is to throw away the
--save-debug-log option and replace it with
mopidy -vvvv > mopidy.log or even
mopidy -vvvv | tee mopidy.log in the troubleshooting docs, and stop shipping a
logging.conf with the Debian package, as modern systems now run systemd and journald, so we shouldn’t need to take care of file logging ourselves. That way we only have the logging to stdout left, and the question is just in what format (e.g.
logging/debug_format), at what general verbosity level (e.g.
-vvvv), and with what specific filters (as defined by
loglevels/* only works for cases 1 and 2 as far as I can tell.
I’m not that familiar with systemd logging in Debian so can’t comment on which approach would be best, though what you are proposing sounds like it will consolidate things a lot and make it easier to maintain.
I’ve summarized the current state and proposed a set of changes in https://github.com/mopidy/mopidy/issues/1452