Sinar / popit_ng

Database and API implementation of Popolo standard
GNU Affero General Public License v3.0
22 stars 4 forks source link

Setting LOGGING in settings_local does not seem to have effect #129

Open leowmjw opened 8 years ago

leowmjw commented 8 years ago

When setting the LOGGING variable in settings_local; it does not seem to have any effect.

Exception encountered when running the "./manage.py clean_index" and "./manage.py reindex" commands:

"No handlers could be found for logger "elasticsearch.trace""

When the below is incorporated into settings.py directly; it works:

(virtualenv) vagrant@precise64:/vagrant$ vim popit_ng/settings_local.py

...
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,

    'handlers': {

        'default': {
            'level': 'INFO',
            'class': 'logging.FileHandler',
            #'filename': '/path/to/django/debug.log',
            'filename': os.path.join(LOG_PATH, "default.log"),
        },
        'file': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            #'filename': '/path/to/django/debug.log',
            'filename': os.path.join(LOG_PATH, "popit.log"),
        },

        'es': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            #'filename': '/path/to/django/debug.log',
            'filename': os.path.join(LOG_PATH, "elasticsearch.log"),
        },

        'estrace': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            #'filename': '/path/to/django/debug.log',
            'filename': os.path.join(LOG_PATH, "elasticsearch.trace.log"),
        },

    },
    'loggers': {

        '': {
            'handlers': ['default'],
            'propagate': True,
        },

        'django': {
            'handlers': ['file'],
            'level': 'DEBUG',
            'propagate': True,
        },

        'elasticsearch': {
            'handlers': ['es'],
            'level': 'DEBUG',
            'propagate': True,
        },

        'elasticsearch.trace': {
            'handlers': ['estrace'],
            'level': 'DEBUG',
            'propagate': True,
        },
    },

}
sweemeng commented 8 years ago

I think the handler need to be those defined in python logging module. Let me look at it deeper

leowmjw commented 8 years ago

@sweemeng Just to be clear; it works when placed in settings.py but does not when in settings_local.py; even when I copied the complete LOGGING; I started only with the bits I wanted to add/override (I am assuming the settings are merged; although it does not seem to be)