Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6322089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:15:59+00:00 2026-05-24T16:15:59+00:00

The release notes say: Django 1.3 adds framework-level support for Python’s logging module. That’s

  • 0

The release notes say:

Django 1.3 adds framework-level
support for Python’s logging module.

That’s nice. I’d like to take advantage of that. Unfortunately the documentation doesn’t hand it all to me on a silver platter in the form of complete working example code which demonstrates how simple and valuable this is.

How do I set up this funky new feature such that I can pepper my code with

logging.debug('really awesome stuff dude: %s' % somevar)

and see the file “/tmp/application.log” fill up with

18:31:59 Apr 21 2011 awesome stuff dude: foobar
18:32:00 Apr 21 2011 awesome stuff dude: foobar
18:32:01 Apr 21 2011 awesome stuff dude: foobar

What’s the difference between the default Python logging and this ‘framework-level support’?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:15:59+00:00Added an answer on May 24, 2026 at 4:15 pm

    I truly love this so much here is your working example! Seriously this is awesome!

    Start by putting this in your settings.py

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': True,
        'formatters': {
            'standard': {
                'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
                'datefmt' : "%d/%b/%Y %H:%M:%S"
            },
        },
        'handlers': {
            'null': {
                'level':'DEBUG',
                'class':'django.utils.log.NullHandler',
            },
            'logfile': {
                'level':'DEBUG',
                'class':'logging.handlers.RotatingFileHandler',
                'filename': SITE_ROOT + "/logfile",
                'maxBytes': 50000,
                'backupCount': 2,
                'formatter': 'standard',
            },
            'console':{
                'level':'INFO',
                'class':'logging.StreamHandler',
                'formatter': 'standard'
            },
        },
        'loggers': {
            'django': {
                'handlers':['console'],
                'propagate': True,
                'level':'WARN',
            },
            'django.db.backends': {
                'handlers': ['console'],
                'level': 'DEBUG',
                'propagate': False,
            },
            'MYAPP': {
                'handlers': ['console', 'logfile'],
                'level': 'DEBUG',
            },
        }
    }
    

    Now what does all of this mean?

    1. Formaters I like it to come out as the same style as ./manage.py runserver
    2. Handlers – I want two logs – a debug text file, and an info console. This allows me to really dig in (if needed) and look at a text file to see what happens under the hood.
    3. Loggers – Here is where we nail down what we want to log. In general django gets WARN and above – the exception (hence propagate) is the backends where I love to see the SQL calls since they can get crazy.. Last is my app were I have two handlers and push everything to it.

    Now how do I enable MYAPP to use it…

    Per the documentation put this at the top of your files (views.py)..

    import logging
    log = logging.getLogger(__name__)
    

    Then to get something out do this.

    log.debug("Hey there it works!!")
    log.info("Hey there it works!!")
    log.warn("Hey there it works!!")
    log.error("Hey there it works!!")
    

    Log levels are explained here and for pure python here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The release notes for Java NIO (in Java 1.4+) state that support for direct
I have developed a maven plugin that downloads the release notes from JIRA. It's
Let's say I have a class that implements the IDisposable interface. Something like this:
In release notes of CouchDB 0.11 is stated, that it supports readers fields. I
According to the JQuery 1.5 release notes , the speed performance charts show that
Mono 2.10's release notes suggest support for ASP.NET MVC 3.0 and Razor using XSP
Apple have recently published Transitioning to ARC Release Notes , a document that explains
What are release notes for and who reads them? Should/could they be automated by
[Question] Does anyone product release notes via an automated process? If so how. Especially
According to the release notes of Eclipse 3.3 you can now join lines together

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.