Solved: Logging of extension does not work


#1

Hello,

while developing an extension I want to use the logging capabilities. From Mopidy Documentation I know about loglevels and my config looks like
mopidy.conf:

[logging]
config_file = /etc/mopidy/logging.conf
debug_file = /var/log/mopidy/mopidy-debug.log

logging.conf:

[loggers]
keys = root

[handlers]
keys = fileHandler

[formatters]
keys = simpleFormatter

[logger_root]
handlers = fileHandler

[handler_fileHandler]
class = FileHandler
formatter = simpleFormatter
level = INFO
args = ('/var/log/mopidy/mopidy.log',)

[formatter_simpleFormatter]
format = %(asctime)s %(levelname)s [%(process)d:%(threadName)s] %(name)s: %(message)s
datefmt =

[loglevels]
mopidy_tpa2016d2.talker=debug
mopidy_tpa2016d2=debug

However, I don’t get any debug output from my tpa2016d2 extension. Neither in console output nor in /var/log/mopidy/mopidy.log

I read the discussion at Is loglevels/* still working? but I’m not quite sure what the latest state is.
Any hints, what I’m doing wrong?


#2

[loglevels] is a Mopidy config setting which should be defined in your mopidy.conf. The logging.conf config_file is parsed by Python’s logging module, I’m pretty sure it doesn’t understand anything under [loglevels].

The state as described in the github issue will be accurate. Since you are developing an extension I am guessing you care about “case 1”. In which case if you define those loglevels in the right place (mopidy.conf) it should work.


#3

DOH!!
Stupid me, thanks for pointing it out. It works as expected.