title: Why doesn't this Django logging work?
body: <p>I'm having trouble getting going with Django logging.  I've read both the Python and Django documentation on logging but I still don't see what I'm doing wrong.  To start, I'm just trying to log a message to the console where my Django development server is running when I execute this simple view:</p>
  
  <pre><code># demo/views.py
  import logging
  logger = logging.getLogger(__name__)
  
  def demo_logging(request, template):
      logger.error("Got some error")
      return render(request, template)
  </code></pre>
  
  <p>I'm using Django's default logging setting as specified in django/utils/log.py in my settings file so that I (hopefully) know exactly what's happening (which, clearly I don't):</p>
  
  <pre><code># settings.py
  DEBUG = True
  ...
  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',
          },
      },
      'handlers': {
          'console': {
              'level': 'INFO',
              'filters': ['require_debug_true'],
              'class': 'logging.StreamHandler',
          },
          'null': {
              'class': 'logging.NullHandler',
          },
          'mail_admins': {
              'level': 'ERROR',
              'filters': ['require_debug_false'],
              'class': 'django.utils.log.AdminEmailHandler'
          }
      },
      'loggers': {
          'django': {
              'handlers': ['console'],
          },
          'django.request': {
              'handlers': ['mail_admins'],
              'level': 'ERROR',
              'propagate': False,
          },
          'django.security': {
              'handlers': ['mail_admins'],
              'level': 'ERROR',
              'propagate': False,
          },
          'py.warnings': {
              'handlers': ['console'],
          },
      }
  }
  import logging.config
  logging.config.dictConfig(LOGGING)
  </code></pre>
  
  <p>When I execute the view, I don't see anything in the console except the message, </p>
  
  <pre><code>No handlers could be found for logger "demo.views"
  </code></pre>
  
  <p>I don't understand what I'm doing wrong.  I would think calling logger.error would hit the django logger which is linked to the console handler which is defined.</p>
  
  <p>Thanks.</p>
  
  <p><strong>FOLLOW UP</strong>
  I solved this problem by adding a default, "catch-all" logger that would be triggered when creating a logger using the "__name__" argument:</p>
  
  <pre><code>'loggers': {
      '': {
          'handlers': ['console'],
      },
      ...
  </code></pre>