Problems setting Loglevel

Issue #474 resolved
Tim de Wit
created an issue

I'm using the proposed LOGGING settings from local_settings.example, but setting the LOGGING['loggers']['remapp.netdicom.qrscu']['level'] to 'DEBUG' (or any of the other loggers) doesn't seem to work (in my case for qrscu.py in combination with openrem_qr.log).

What does seem to work is adding e.g. a line like this: LOGGING['handlers']['qr_file']['level'] = 'DEBUG'

However, all LOGGING['loggers'] lines seem to be ignored. Changing levels or even commenting them out doesn't do anything.

Comments (12)

  1. Tim de Wit reporter

    Correction, its seems like the following: handler-level = INFO (20), logger-level = DEBUG (10) --> logging at INFO level
    handler-level = DEBUG, logger-level = INFO --> logging at INFO level
    handler-level = DEBUG, logger-level = DEBUG --> logging at DEBUG level

    The handler-level is not set in the current situation, and keeps its default value of WARNING (30); therefore you'll never get DEBUG messages.
    The effective log level seems to be determined by the logger-level, with a minimum level determined by the handler-level.

  2. Ed McDonagh

    Thanks for going through this. I'm wondering how LOGGING['handlers']['file'] is supposed to relate to LOGGING['loggers']['remapp'] - should they not both be remapp?

  3. Tim de Wit reporter

    They are linked in settings.py::

        'remapp.netdicom.qrscu': {
            'handlers': ['qr_file'],
            'level': 'INFO',
            'propagate': False,
        },
    
    
        'remapp': {
            'handlers': ['file'],
            'level': 'INFO',
        },
    
  4. Tim de Wit reporter

    I guess you only have to change the current settings from INFO to DEBUG:

    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        },
        'file': {
            'level': 'INFO',
            'class': 'logging.FileHandler',
            'filename': 'openrem.log',
            'formatter': 'verbose'
        },
        'qr_file': {
            'level': 'INFO',
            'class': 'logging.FileHandler',
            'filename': 'openrem_qrscu.log',
            'formatter': 'verbose'
        },
        'store_file': {
            'level': 'INFO',
            'class': 'logging.FileHandler',
            'filename': 'openrem_storescp.log',
            'formatter': 'verbose'
        },
    },
    
  5. Ed McDonagh

    I've read the docs, and I agree. If the handler is set to debug, then it will 'handle' anything that is passed to it. Then the user can set the logging level to what they like and it will be honoured.

  6. Log in to comment