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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:35:29+00:00 2026-06-02T17:35:29+00:00

I have a multi-threaded Python application that makes use of the built in logging

  • 0

I have a multi-threaded Python application that makes use of the built in logging module. To control the logging levels and make it easier to swap the StreamHandler with a FileHandler in the future, I have created a common helper function called by each module to create an identical logger (other than its name).

How should I go about trouble shooting this issue?

Key Points

  1. Each module in the project has its own logger instance.
  2. The sample output is generated by a single call to a logger (self._logger.info("Logger Setup"))
  3. I have tried including the current thread name (threading.Thread.getName()) and it confirms that the same thread is calling causing the multiple logs.

Logger Creation – Now working

import logging
import sys
def createSystemLogHandler(logger):
    # This is now called once at the logger's root 
    ch = logging.StreamHandler(sys.stdout) # Normal output is to stderr which doesn't show up on Window's CMD
    format = logging.Formatter('%(asctime)s - %(levelname)s - %(name)s - %(message)s')
    ch.setFormatter(format)
    logger.addHandler(ch)
    return logger

def configureSystemLogger(name='', level=logging.WARNING):
        logger = logging.getLogger(name)
        logger.setLevel(level)
        logger.info("Logger Setup")
        return logger

Sample Output

2012-04-25 21:59:40,720 - INFO - HW_MGR - Logger Setup
2012-04-25 21:59:40,720 - INFO - HW_MGR - Logger Setup
2012-04-25 21:59:40,720 - INFO - HW_MGR - Logger Setup
2012-04-25 21:59:40,720 - INFO - HW_MGR - Logger Setup
2012-04-25 21:59:40,720 - INFO - HW_MGR - Logger Setup
  • 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-02T17:35:30+00:00Added an answer on June 2, 2026 at 5:35 pm

    My guess is that you’ve got multiple handlers (ie, one message is being emitted multiple times; but on re-reading your question, it looks like you already knew that). To debug that, try:

    • Looking at logging.getLogger("").handlers (ie, the handlers on the root logger)
    • Checking your calls to addHandler()
    • Brandon Rhode’s logging_tree module
    • Use pdb to trace a log message’s lifecycle (ie, put a breakpoint just before a call to self._logger.info(…), then step into that function).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi threaded python application communicating with a separate service trough UDP.
This is the strangest thing! I have a multi-threaded client application written in Python.
I have a multithreaded application that makes heavy use of OpenSSL in C. It
I have a multi-threaded Java application that will output information about a message it
I have a multi-threaded application written in Python in which one thread takes care
I have a multi-threaded application that I'm debugging inside the IDE (Visual Studio 2008,
I have a multi threaded .NET app that uses async I/O and AsyncCallbacks to
I have a multi-threaded application in C# which tries to write to a TextBox
To access the properties of windows controls in multi threaded application, I have modified
I'm developing a long-running multi-threaded Python application for Windows, and I want the process

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.