Set logs to DEBUG in lms or cms

Hi, which is the proper way to setup debug logs on tutor instance? I’ve setup LOCAL_LOGLEVEL to “DEBUG” but is not taking any effect, also tried setting DEBUG = True to check logs but is not taking effects, am I missing one step or maybe this is specific to tutor?

Thanks a lot for your help.

Good catch! The level of the “local” logger is (mistakenly) undefined in Tutor: https://github.com/overhangio/tutor/blob/master/tutor/templates/apps/openedx/settings/partials/common_all.py#L27

LOGGING["handlers"]["local"] = {
    "class": "logging.handlers.WatchedFileHandler",
    "filename": os.path.join(LOG_DIR, "all.log"),
    "formatter": "standard",
}

Instead, we should have:

LOGGING["handlers"]["local"]["level"] = ENV_TOKENS.get('LOCAL_LOGLEVEL', 'INFO')

The fact that the logging level cannot be easily modified from the env.json files could be considered a bug – but these env.json files are going to change a lot in the next Open edX release (Juniper), so I’m not sure how I feel about that.

Meanwhile, it should be easy enough to write a tutor plugin that enables debug-level logging:

name: debuglogs
version: 0.1.0
patches:
    openedx-common-settings: |
      LOGGING["handlers"]["local"]["level"] = "DEBUG"
1 Like

Will try this solution, thanks a lot for the information!