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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:20:33+00:00 2026-05-25T12:20:33+00:00

My Twisted-based client sends UDP packets in a loop. Therefore I’m using the class

  • 0

My Twisted-based client sends UDP packets in a loop.
Therefore I’m using the class DatagramProtocol.
This is the source:

#!/usr/bin/python
# -*- coding: utf-8 -*-
from twisted.application.service import Service
from twisted.internet import reactor
from twisted.internet.task import LoopingCall
from twisted.internet.protocol import DatagramProtocol
from twisted.python import log
import logging

class HeartbeatClient(Service):
    def __init__(self, host, port, data, beat_period):
        self.ip = host
        self.port = int(port)
        self.data = data
        self.beat = int(beat_period)

    def startService(self):
        self._call = LoopingCall(self._heartbeat)
        self._call.start(self.beat)

    def stopService(self):
        self._call.stop()

    def _heartbeat(self):
        protocol = DatagramProtocol()
        protocol.noisy = False
        port = reactor.listenUDP(0, protocol)
        port.write(self.data, (self.ip, self.port))
        port.stopListening()

now when I run this client with twistd, I permanently get log messages from the Twisted classes, namely from the class DatagramProtocol:

2011-09-11 18:39:25+0200 [-] (Port 55681 Closed)
2011-09-11 18:39:30+0200 [-] twisted.internet.protocol.DatagramProtocol starting on 44903
2011-09-11 18:39:30+0200 [-] (Port 44903 Closed)
2011-09-11 18:39:35+0200 [-] twisted.internet.protocol.DatagramProtocol starting on 50044
2011-09-11 18:39:35+0200 [-] (Port 50044 Closed)
2011-09-11 18:39:40+0200 [-] twisted.internet.protocol.DatagramProtocol starting on 37450

Since these log messages are polluting my “own” logs, I wonder if I can disable these log messages.
As you can see I already reduced the amount of logs by calling protocol.noisy = False, but I’m still getting other Log messages. Also the command g = protocol.ClientFactory().noisy = False does not help.

Is it possible to disable logging of all Twisted-internal classes, in a generic way – for ALL modules? Maybe by using some Twisted-logging configuration?

  • 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-25T12:20:33+00:00Added an answer on May 25, 2026 at 12:20 pm

    Twisted’s logging is all very naive. However, there is no reason this needs to be the case, since twisted.python.log is very featureful, and capable of the kind of selective reporting that you (and others) are interested in.

    A log event is just a dictionary of arbitrary keys and values. The default observer knows about dictionaries with a 'message' key. Perhaps because of this, most log messages emitted by Twisted itself don’t try to do anything except provide a human-readable string associated with this key (also, many of the emitted messages were added prior to the current Twisted logging system, and so had the older, more primitive system as a consumer).

    Not too long ago, this problem bothered someone who was prompted to file a ticket and start working on a resolution to the UDP part of the problem in particular. The issue is mostly resolved, but a few things remain to be done.

    The solution attempted is to log a structured message which conveys the same information, but has no message and so isn’t recorded by the default observer. This avoids the messages appearing in the log by default, but allows an observer that’s specifically interested in these events to observe them and handle them as desired.

    The ticket has been sitting untouched for some time now. It would probably be easy for someone to pick up the patch and get it the last bit of the way to completion.

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

Sidebar

Related Questions

I'm implementing a Twisted-based Heartbeat Client/Server combo, based on this example . It is
I've made a simple http server using Twisted, which sends the Content-Type: multipart/x-mixed-replace header.
I've written a Twisted based server and I'd like to test it using twisted
I am running an app using twisted and tkinter that sends the result to
I have created a simple Twisted based TCP server and Android client. I have
I have a simple TCP client which is connected to twisted using: reactor.connectTCP(host, port,
I'm using twisted to implement a client and a server. I've set up RPC
I have a problem with using Twisted for simple concurrency in python. The problem
I want to put together simple TCP server using Python and Twisted. The server
Code first: '''this is main structure of my program''' from twisted.web import http from

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.