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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:47:56+00:00 2026-06-12T04:47:56+00:00

I am using QtCore.QThread (from PyQt4 ). To log, I am also using the

  • 0

I am using QtCore.QThread (from PyQt4).

To log, I am also using the following formatter :

logging.Formatter('%(levelname)-8s %(asctime)s %(threadName)-15s %(message)s')

The resulting log is :

DEBUG 2012-10-01 03:59:31,479 Dummy-3 my_message

My problem is that I want to know more explicitly which thread is logging… Dummy-3 is not the most explicit name to me….

Is there a way to set a name to a QtCore.QThread that will be usable by the logging module (as a LogRecord attribute) in order to have a log more meaningful ?

Thanks !

  • 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-12T04:47:57+00:00Added an answer on June 12, 2026 at 4:47 am

    If the threading module is available, the logging module will use threading.current_thread().name to set the threadName LogRecord attribute.

    But the docs for threading.current_thread say that a dummy thread object will be used if the current thread was not created by the threading module (hence the “Dummy-x” name).

    I suppose it would be possible to monkey-patch threading.current_thread to reset the name to something more appropriate. But surely a much better approach would be to make use of the extra dictionary when logging a message:

    logging.Formatter('%(levelname)-8s %(asctime)s %(qthreadname)-15s %(message)s')
    ...
    extras = {'qthreadname': get_qthreadname()}
    logging.warning(message, extra=extras)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the file I generated using qt-designer. from PyQt4 import QtCore, QtGui try:
I am trying the following in PyQt4, using SQLAlchemy as the backend for a
I'm trying to compile my first .ui file using PyQt4 on a mac with
I am currently using the following PyQt code to create a simple browser: import
I want to try using QML ShaderEffectItem on QGraphicsView I have cloned files from
I am using a QTableView and QSqlTableModel to show data from a sqlite DB.
I'm using Python 2.6.6 and PyQt4. I have a start QDateTime object and I
Ive created a program using pyqt4 as GUI Ive used resource file or .qrc
I'm creating a Qt application using PyQt4 in Python. I have chosen the Dialog
I've noticed that QML can receive a signal emitted from Python by using the

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.