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 8070103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:17:07+00:00 2026-06-05T13:17:07+00:00

This is what i tried . In my view.py file , import logging logger

  • 0

This is what i tried .
In my view.py file ,

import logging
logger = logging.getLogger("mylog")
logging.basicConfig(format='%(name)s:%(levelname)s:%(message)s',level=logging.INFO,datefmt='%d/%m/%y %I:%M:%S')

Then inside a function ,

logger.debug("this is an error")
logger.warning("This is a warning")
print "This is a test line '

I have not touched the settings.py file .its pretty much the same.

LOGGING = {

    'version': 1,

    'disable_existing_loggers': False,

    'handlers': {

        'mail_admins': {

            'level': 'ERROR',

            'class': 'django.utils.log.AdminEmailHandler'

        }

    },

    'loggers': {

        'django.request': {

            'handlers': ['mail_admins'],

            'level': 'ERROR',

            'propagate': True,

        },

    }

When i run the server , and call the function , nothing happens . no error , nothing .

I just want to see a log line on the console .

  • 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-06-05T13:17:10+00:00Added an answer on June 5, 2026 at 1:17 pm

    Try adding this to handlers:

    'console':{
                'level':'DEBUG',
                'class':'logging.StreamHandler',
                'formatter': 'simple'
               }
    

    and in loggers:

        'django': {
            'handlers':['console'],
            'propagate': True,
            'level':'INFO',
        },
    

    The log level could be the same or different – In fact the handler defines the minimum level it will log, while the logger defines the minimum level it will send to handler. If one handler is used by two or more loggers – it should ideally has the lowest level from both loggers.

    EDIT: Thanks to @jpic for pointing the loggers section.

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

Sidebar

Related Questions

I have a root view controller with no nib file, I tried adding this
I tried to read a file in a view like this: def foo(request): f
I tried to start an AlphaAnimation for a ImageView with this code: ImageView view;
I tried to implement this: UICRouteOverlayMapView .h file @protocol DrawingDataDelegate <NSObject> @required -(void) drawingSuccessful:(BOOL)done;
I tried this tutorial http://tech.cibul.net/install-maxminds-geoip-ip-database-on-ubuntu-for-php/ and did everything from it. Compiled the geoip module
I tried this phpunit --debug --filter /^complete/ feed.php; For some reason it says 0
I tried this code in my custom user control in a C# Windows application:
I tried this for pulling out the data from xml to php in session
I tried this small code to use compound literals in IF statement: #include<stdio.h> struct
I tried this example from Android: The method OnClickListener() is undefined for the type

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.