Django 1.8 Loggers settings are ignored
Question: I'm fighting with django logging since this morning and nothing... I've read
the [documentation](https://docs.djangoproject.com/en/1.8/topics/logging/)
then searched Google and found
[this](http://www.webforefront.com/django/setupdjangologging.html) and
[this](https://www.caktusgroup.com/blog/2015/01/27/Django-Logging-
Configuration-logging_config-default-settings-logger/) and I ended with
something like this:

    
    
    """ --------------------------------------------------------------------
    Django settings for uploader project.
    -------------------------------------------------------------------- """
    # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
    import os
    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    
    
    # ----------------------------------------------------------------------
    # Loggers
    # ----------------------------------------------------------------------
    LOGGING_CONFIG = None
    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'filters': {
            'require_debug_false': {
                '()': 'django.utils.log.RequireDebugFalse',
            },
            'require_debug_true': {
                '()': 'django.utils.log.RequireDebugTrue',
            },
        },
        'formatters': {
            'simple': {
                'format': '[%(asctime)s] %(levelname)s %(message)s',
                'datefmt': '%Y/%m/%d %H:%M:%S',
            },
            'verbose': {
                'format': '[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s.%(lineno)d] %(message)s',
                'datefmt': '%Y/%m/%d %H:%M:%S',
            },
        },
        'handlers': {
            'console': {
                'level': 'DEBUG',
                'filters': ['require_debug_true'],
                'class': 'logging.StreamHandler',
                'formatter': 'simple',
            },
            'development_log': {
                'level': 'DEBUG',
                'filters': ['require_debug_true'],
                'class': 'logging.FileHandler',
                'filename': os.path.join(BASE_DIR, 'logs/development.log'),
                'formatter': 'verbose',
            },
            'production_log': {
                'level': 'ERROR',
                'filters': ['require_debug_false'],
                'class': 'logging.FileHandler',
                'filename': os.path.join(BASE_DIR, 'logs/production.log'),
                'formatter': 'simple',
            },
        },
        'loggers': {
            'uploader': {
                'handlers': ['console', 'development_log', 'production_log'],
            },
            'django': {
                'handlers': ['console', 'development_log', 'production_log'],
            },
            'py.warnings': {
                'handlers': ['console', 'development_log'],
            },
        },
    }
    
    import logging.config
    logging.config.dictConfig(LOGGING)
    

and this how I log my own data:

    
    
    import logging
    from django.shortcuts import render
    from django.http import HttpResponse, HttpResponseRedirect
    from django.core.urlresolvers import reverse
    
    from .models import MFile
    from .forms import MFileForm
    
    
    # ----------------------------------------------------------------------
    def upload(request):
        logger = logging.getLogger(__name__)
        template = 'main/index.html'
        logger.debug('Executing upload() view')
        [...]
    

Files `development.log` and `production.log` are created but they're are empty
and console shows standard logging output like:

    
    
    Performing system checks...
    
    System check identified no issues (0 silenced).
    June 01, 2015 - 20:39:23
    Django version 1.8.2, using settings 'uploader.settings'
    Starting development server at http://127.0.0.1:8000/
    Quit the server with CONTROL-C.
    [01/Jun/2015 20:39:29]"GET / HTTP/1.0" 200 2195
    [01/Jun/2015 20:40:03]"POST /upload HTTP/1.0" 302 0
    [01/Jun/2015 20:40:03]"GET / HTTP/1.0" 200 2195
    

so am I misunderstanding something or django ignores those settings ?

Everything is run under virtualenv from python 3 which was created with

    
    
    python3 -m venv --without-pip venv
    source venv/bin/activate
    wget https://bootstrap.pypa.io/get-pip.py
    python get-pip.py
    pip install -r requirements.txt
    

and the requirements.txt:

    
    
    Django==1.8.2
    flake8==2.4.1
    gunicorn==19.3.0
    mccabe==0.3
    pep8==1.5.7
    Pillow==2.8.1
    pyflakes==0.8.1
    wheel==0.24.0
    


Answer: It looks like you are missing logger for your app name itself under `loggers`.
If your project name is `django_project` then change the following:

    
    
    'loggers': {
            'uploader': {
                'handlers': ['console', 'development_log', 'production_log'],
            },
    

to:

    
    
    'loggers': {
            'uploader': {
                'handlers': ['console', 'development_log', 'production_log'],
            },
            'django_project': {
                'handlers': ['console', 'development_log', 'production_log'],
            },
            [....]
    

I usually create an "applogger" as a `dict` instance for quick access before
this section.

    
    
    applogger = {
        'handlers': ['console', 'development_log', 'production_log'],
        'level': 'DEBUG',
        'propagate': True,
    }
    

And then finally modify the `loggers` section into something as follows:

    
    
    'loggers': {
           'uploader': {
                    'handlers': ['console', 'development_log', 'production_log'],
                },
            'django_project': applogger,
            'app_name_1': applogger,
            [....]
    

