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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:12:47+00:00 2026-05-28T15:12:47+00:00

In some other technologies we occasionally used a log level below DEBUG that I

  • 0

In some other technologies we occasionally used a log level below DEBUG that I believe was called “verbose”. I realize that the need for such a level is very subjective. But in my mind “just” having INFO and DEBUG isn’t really enough. We had times where something very spammy (more spammy than debug) needed to be logged. In practice we’d produce builds without this turned on but in a few occasions we’d enable this level of logging after the product was all installed on some QA setup, while tracking down a bug, etc.

Is there any way (easy or otherwise) to log something below the DEBUG level using the standard python logging library?

In a temp.py file I can do the following:

logging.addLevelName(5,"verbose")
VERBOSE = 5

logger = logging.getLogger("foo")
logger.setLevel(VERBOSE)
logger.log(VERBOSE,"blah!")

This works when I run temp.py within my IDE (and logs to stdout) but our real daemons use the standard file/dictionary configuration syntax to setup logging and I don’t see any way to indicate that level 5 should be used for the daemon.

Am I chasing something that’s not really feasible?

For those who might wonder why I’d need anything lower than DEBUG, it’s for the occasional type of logging that might occur very frequently (maybe an inner loop) that I wouldn’t normally want to see even at DEBUG but on some production system it might be helpful to enable it once in awhile without needing to add more logging to the source code and re-deploy, etc.

EDIT1 – Clearly the logging library allows for custom levels. Since DEBUG is level 10, there’s room somewhere in the 1..9 range. If I define a custom level (such as in the sample code above), I guess my real question is how do I enable that level of logging from the json log configuration file?

EDIT2 – The following would work if it weren’t for the fact that we need/use json configuration files (a requirement that I cannot change):

import logging

logging.basicConfig(filename='example.log',level=5)
VERBOSE = 5
logging.addLevelName(5,"verbose")
logger = logging.getLogger("bar")
logger.log(VERBOSE,"blah!")

EDIT3 – Figured it out… The call to

logging.addLevelName(5,"VERBOSE")

is critical. I just didn’t have it in the right place. In my case I just needed to make the above call takes place before the call to the logging libraries dictConfig(…) call. After I did this I was then able to go into our log configuration file and bump things down (on both the file handler and the root) to VERBOSE and it worked.

Granted, the log statement itself isn’t exactly elegant because you call:

self.logger.log(VERBOSE,"Something very spammy")

rather than

self.logger.verbose("Something very spammy")

But I really didn’t want to modify any logger library code (been there, done that, have the t-shirt).

Thanks all!

And to those who think nothing lower than DEBUG is needed, more power to you 🙂

  • 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-28T15:12:48+00:00Added an answer on May 28, 2026 at 3:12 pm

    DEBUG is the lowest level out of the ones provided by the logging module: ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'). Their numeric values are here: http://docs.python.org/howto/logging.html#logging-levels

    You can create custom levels (though the docs say that that should rarely be necessary and may even be undesirable). If you want to add a level, the technique is simple:

    >>> logging.addLevelName(5, "VERBOSE")
    

    Eventhough you can add a custom level, it may be a better approach to add some filters that provide a finer level of control.

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

Sidebar

Related Questions

Background: JEdit (and some other text editors as well) support a feature called Multiple
I know that some other languages, such as PHP , support a concept of
I already know that it is possible to use other technologies than .NET, e.g.
Similar to technologies like ASP.NET, PHP, JSP and some other web languages which run
I've been given a problem that I need some assistance from the SO community
Coming from some other technologies, there have been string comparison assertions for use in
Looking around SO user profiles and other sites, I have noticed that some high
I've looked for some other articles on this problem and even tried some of
This is related to some other questions, such as: this , and some of
According to google and some other sources (e.g., http://www.enterprisedt.com/publications/oracle/result_set.html ), if I want to

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.