logging to shell on dev server

1
2
3
4
5
6
7
8
9
from django.shortcuts import render
import logging

logging_format = '%(asctime)s - %(levelname)s - %(filename)s:%(lineno)d - %(message)s'
logging.basicConfig(level=logging.DEBUG, format=logging_format)

def some_view(request):
    logging.debug('This is a debugging message')
    return render(request, 'some_template.html', {})

More like this

  1. Inspect object debugging tag by dballanc 5 years, 10 months ago
  2. Format transition middleware by limodou 6 years, 2 months ago
  3. MODPYTHON logging by adroffner 5 years, 2 months ago
  4. DRY custom ModelAdmin.list_display methods with a decorator by exogen 4 years, 8 months ago
  5. Improved Pickled Object Field by taavi223 3 years, 9 months ago

Comments

(Forgotten your password?)