You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, there are four logging output modes that I can think of:
Log to stdout (run mopidy),
Log to stdout and then into some logging service (start mopidy with systemd, and the stdout output ends up in the systemd journal),
Log to a debug log (run mopidy --save-debug-log), typically ./mopidy.log,
Log to anything defined in a logging config, as pointed to by the config value logging/config_file, typically /var/log/mopidy/mopidy.log.
The loglevels config section affects logging in cases 1 and 2, but not 3 or 4.
There are six global verbosity levels:
-q: warnings from mopidy, errors from everything else
default: info from mopidy, errors from everything else
-v: debug from mopidy, warnings from everything else
-vv: debug from mopidy, info from everything else
-vvv: debug from everything
-vvvv: no filter at all, even custom levels lower than debug will be included
The global verbosity level cannot be controlled from the config file.
We have two configs for logging format:
logging/console_format is used when no filter (verbosity level and loglevels/*) is at debug level (in other words: -q and default verbosity level, when no loglevels/* config is set to debug level). This is a conventional log format, just containing log level and message.
logging/debug_format is used when any filter (verbosity level and loglevels/*) is at debug level. This use multiple lines per log statement for better readability, and includes log level, time, PID, thread name, logger name, and message.
In addition the Debian package configures a log format for /var/log/mopidy/mopidy.log which has the same elements as logging/debug_format, just without newlines and with two items reordered.
Proposal
Log output:
Remove the --save-debug-log command line option and the logging/debug_file config value. Replace it with mopidy -vvvv | tee mopidy.log in the troubleshooting docs.
Stop shipping a logging.conf with the Debian and Arch packages, as modern systems now run systemd and journald, so we shouldn't need to take care of file logging ourselves.
Add examples to troubleshooting docs on how to access your Mopidy log using sudo journalctl -u mopidy, etc.
loglevels config section: Output mode 3 and 4 from the current situation is gone, so this now applies to all output modes.
Verbosity levels:
Add a logging/verbosity config which is a number between -1 and 4 (-q and -vvvv), defaulting to 0, for controlling default logging verbosity level. Any use of -q or -v will override this, like any command line options always do.
Log formats:
Remove logging/console_format.
Rename logging/debug_format to logging/format, keeping the current default log format.
Make distribution packages override logging/format in /etc/mopidy/mopidy.conf to not include timestamp and PID, as that is redundant in the systemd journal.
Test how journalctl behaves when getting multiline log messages. We have multiline log messages both because of the log format and because some log messages contains newlines, like MPD protocol messages.
Make distribution packages set logging/color to false, as I've seen the systemd journal print the color codes, so it becomes plain noise.
End result
All logging goes to stdout, any redirection to syslog or file must be handled outside Mopidy.
We still have six global verbosity levels, but they can be set from config.
We no longer have a variance in logging format. A single config controls it all.
The loglevels/* config section affects all log output, making debugging something without knowing the internals of mopidy.internal.logging possible.
The text was updated successfully, but these errors were encountered:
Oh, and we should make sure that setting just say -o loglevels/mopidy.audio=debug works without having to change the verbosity level of other things. Don't remember the current state of this.
Following up on @jcass77 and my discussion about logging a few weeks ago...
Current situation
Today, there are four logging output modes that I can think of:
mopidy
),mopidy --save-debug-log
), typically./mopidy.log
,logging/config_file
, typically/var/log/mopidy/mopidy.log
.The loglevels config section affects logging in cases 1 and 2, but not 3 or 4.
There are six global verbosity levels:
-q
: warnings from mopidy, errors from everything else-v
: debug from mopidy, warnings from everything else-vv
: debug from mopidy, info from everything else-vvv
: debug from everything-vvvv
: no filter at all, even custom levels lower than debug will be includedThe global verbosity level cannot be controlled from the config file.
We have two configs for logging format:
logging/console_format
is used when no filter (verbosity level andloglevels/*
) is at debug level (in other words:-q
and default verbosity level, when nologlevels/*
config is set to debug level). This is a conventional log format, just containing log level and message.logging/debug_format
is used when any filter (verbosity level andloglevels/*
) is at debug level. This use multiple lines per log statement for better readability, and includes log level, time, PID, thread name, logger name, and message.In addition the Debian package configures a log format for
/var/log/mopidy/mopidy.log
which has the same elements aslogging/debug_format
, just without newlines and with two items reordered.Proposal
Log output:
--save-debug-log
command line option and thelogging/debug_file
config value. Replace it withmopidy -vvvv | tee mopidy.log
in the troubleshooting docs.logging.conf
with the Debian and Arch packages, as modern systems now run systemd and journald, so we shouldn't need to take care of file logging ourselves.sudo journalctl -u mopidy
, etc.loglevels config section: Output mode 3 and 4 from the current situation is gone, so this now applies to all output modes.
Verbosity levels:
logging/verbosity
config which is a number between -1 and 4 (-q
and-vvvv
), defaulting to 0, for controlling default logging verbosity level. Any use of-q
or-v
will override this, like any command line options always do.Log formats:
logging/console_format
.logging/debug_format
tologging/format
, keeping the current default log format.logging/format
in/etc/mopidy/mopidy.conf
to not include timestamp and PID, as that is redundant in the systemd journal.logging/color
tofalse
, as I've seen the systemd journal print the color codes, so it becomes plain noise.End result
loglevels/*
config section affects all log output, making debugging something without knowing the internals ofmopidy.internal.logging
possible.The text was updated successfully, but these errors were encountered: