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

  • Home
  • SEARCH
  • 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 3314184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:12:07+00:00 2026-05-17T22:12:07+00:00

e.g. if you have code that does something like this somewhere in your codebase:

  • 0

e.g. if you have code that does something like this somewhere in your codebase:

>>> import logging
>>> logging.basicConfig()
>>> logger = logging.getLogger(__name__)
>>> logger.critical("foo: %s", 1, 2)
Traceback (most recent call last):
  File "/pluto/local/lib/python2.6/logging/__init__.py", line 768, in emit
    msg = self.format(record)
  File "/pluto/local/lib/python2.6/logging/__init__.py", line 648, in format
    return fmt.format(record)
  File "/pluto/local/lib/python2.6/logging/__init__.py", line 436, in format
    record.message = record.getMessage()
  File "/pluto/local/lib/python2.6/logging/__init__.py", line 306, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
>>> 

…you will just get that stack trace with no indication where the original bad logger statement is.

It seems like it wouldn’t be too hard to write something that uses the tokenize module or the ast module or something to process python source and detect these problems but I can’t imagine I’m the first person that’s wanted something like this.

Update: I was picturing more of a static-analysis type of tool rather than either a change to the logging code or a process change (e.g. code review). I specifically don’t consider code review as good enough because humans are never infallible. In my particular case we already have many tools that run over the code and catch common mistakes (e.g. you left a pdb in, pylint, etc)… I was really hoping to add tool to that toolbox.

  • 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-17T22:12:07+00:00Added an answer on May 17, 2026 at 10:12 pm

    I made a script that does what I needed. It doesn’t handle a lot of edge cases yet, but it got the job done for my situation (finding the needle (6 bad log lines) in my haystack (82,195 lines of python code)).

    http://github.com/lgastako/loglint

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

Sidebar

Related Questions

I have some code that effectively does this : File file = new File(C:\\Program
I have a code that looks something like: struct Data { int value; };
I've been trying to implement unit testing and currently have some code that does
I have the following bit of legacy C++ code that does not compile: #include
Does anybody have a short code sample that can be run in the VS
Does anyone have any code examples on how to create controllers that have parameters
Does anyone have an example (code or a link) that will allow me to
I have code that references a web service, and I'd like the address of
I have code that looks like the following, which works fine for displaying the
I have code that looks like: //System.Data.IDataRecord dr try { Consolidated = Utility.NullConvert.ToBool(dr[Constants.Data.Columns.cConsolidated], false);

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.