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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:20:41+00:00 2026-06-01T00:20:41+00:00

In the Python docs I found that logging messages are possible in python scripts

  • 0

In the Python docs I found that logging messages are possible in python scripts that use the multiprocessing module to spawn different processes.

import multiprocessing
import logging

logger = multiprocessing.log_to_stderr()
logger.setLevel(logging.INFO)

So logger.warning('doomed') would give me the message 'doomed', but only to the console.

How can I switch the log-messages to a file?

  • 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-01T00:20:42+00:00Added an answer on June 1, 2026 at 12:20 am

    Multiprocess logging isn’t trivial, but isn’t difficult either. You’ll need the logging module.

    The main point is to have a listener process that will receive all the logging records through multiprocessing queues. This listener process will then handle those records with whathever internal handlers you’ll decide to use. In your case you may want to use a FileHandler or similar.

    If you are in Python 3.2 or later version you’ll have both QueueHandler and QueueListener in the standard libary. Quelistener is the listener process that I was talking about before (yes, it does have a start() method).

    If you are on a previous Python version take a look at this link that basically shows how to rewrite them (and how to use them).


    If you want a references from the official doc, take a look at the Logging to a single file from multiple processes session from the Logging Cookbook.

    You may also be interested in this answer from the question How should I log while using multiprocessing in Python?

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

Sidebar

Related Questions

I'm speaking of this module: http://docs.python.org/library/operator.html From the article: The operator module exports a
I'm using the logging module in Python and I would like it to create
On a Google Search, I found this article: http://docs.python.org/release/1.4/lib/node201.html Which showed examples of using
Python docs states that uuid1 uses current time to form the uuid value. But
The Python docs say: re.MULTILINE: When specified, the pattern character '^' matches at the
Sorry for such a silly question but Python docs are confusing... Link 1: Queue
I'm working on a documentation API for Python I'm calling Python Docs , and
http://docs.python.org/3.0/whatsnew/3.0.html says it lists whats new , but in my opinion, it only lists
http://code.google.com/appengine/docs/python/tools/uploadingdata.html is not clearly understand. Where i should call the bulkloader.py or appcfg.py? Should
In Python 2.6, a new timeout parameter was added to the httplib.HTTPConnection class: http://docs.python.org/library/httplib.html#httplib.HTTPConnection

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.