Login

logging to shell on dev server

Author:
chachan
Posted:
July 15, 2012
Language:
Python
Version:
Not specified
Tags:
debug debugging logging
Score:
1 (after 1 ratings)

You can customize the format. Also you can display variable values that support str or another object-to-string method.

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. Logging solution for mod_python/FCGI by mikeivanov 7 years, 6 months ago
  2. Super User Conditional Page Exception Reporting by zbyte64 6 years, 8 months ago
  3. create_logger helper by amitu 6 years ago
  4. Log to syslog by fylb 5 years, 1 month ago
  5. Request time logging middleware by mpasternacki 5 years, 3 months ago

Comments

Please login first before commenting.