import logging
from mopidy import backend
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class CalmRadioPlayback(backend.PlaybackProvider):
def translate_uri(self, uri):
logger.info('Translate URI: %s' % uri)
logger.debug('Translate URI (debug): %s' % uri)
I would expect that, explicitly setting the logger level, I would get both info and debug logging … but I get only info. What am I missing? (new to mopidy and python … be kind )
Your code to set the level to DEBUG will execute when the module is imported. But then later, when Mopidy actually starts running, it’ll set the logging level to INFO as defined in your config.
I’d personally scrap all that logging.conf and use the loglevels/* section within your mopidy.conf. So if I wanted to have DEBUG logging for just Mopidy-Spotify’s playlists module and TRACE debugging for the web module: I’d do:
But when I am developing I’d always be using a develop environment and regular stdout logging, not systemd. Not that it makes much different here when it comes to logging, it’s just generally easier to work with.
Thank you for your response and advice. I tried using [loglevels] with no real success … but I’ll revisit that. One of the backends I’m working on has an intermittent failure … could be only once or twice a day. Thought the mopidy log file would be the best way to go.
If you want to share the config you tried and the name of your module we can try and work out why that is. Otherwise, I wish you luck with your debugging.