juanifioren/django-oidc-provider

Log level severity is set too low

sidagrawal opened this issue · 5 comments

This library is really great for integrating OAuth into a django app. Unfortuantely, I'm having a bit of trouble with my logs because the log severity on the authorize endpoint is set to DEBUG. These errors are ones that I would like to catch but turning on DEBUG level logs in a production environment will lead to way too many logs. I think it would make more sense to have these logs be at the error level or perhaps have some method to set the log severity level to different levels based on need. Please let me know what you think, thanks!

You could set the log level to DEBUG specifically for the oidc_provider app in your django settings.py file?

I'm not sure how to set the log level for a specific package in the settings.py file. Could you point me in the right direction?

You can follow the patterns here.

Something like the following:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'simple': {
            'format': '{levelname} {message}',
        },
    },
    'handlers': {
        'debug_console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'simple'
        },
    },
    'loggers': {
        'oidc_provider': {
            'handlers': ['debug_console'],
            'level': 'DEBUG',
            'propagate': True,
        },
    }
}

@sidagrawal can you close this if it solves your problem?

Thanks!

Thanks for solving this!