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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:48:05+00:00 2026-05-13T15:48:05+00:00

My web application runs on multpile apache instances and I am having multiprocess logging

  • 0

My web application runs on multpile apache instances and I am having multiprocess logging issues because of this. I am currently using a SocketHandler for logging to a daemon using SocketServer that then writes logs to a single log file (similar to this example).

Now that I am using a SocketHandler for logging I am having trouble discovering if/when the socket server crashes. For example, if I try creating a SocketHandler for a port that has no listening socket server, no exception arises. I would like to catch this type of error and log it to a file.

My question is, when logging using SocketHandler how can I discover when the socket being used is not currently being listened to?

  • 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-13T15:48:05+00:00Added an answer on May 13, 2026 at 3:48 pm

    When a socket creation operation fails (e.g. because there is no server listening), the default behaviour is to retry the next time an event is logged, with an exponential back-off algorithm. Here are some approaches you could try:

    1. Subclass SocketHandler, override the createSocket method and handle exceptions how you will in your implementation.
    2. Note that the sock attribute of the SocketHandler instance will be None if no socket has been created yet. If the value is None after you’ve logged an event, most likely the SocketHandler wouldn’t have sent it.
    3. Note that the makeSocket method of the handler is used to actually create and connect the socket. So, you could call makeSocket yourself before logging anything, and if it throws an exception, you know that your server is probably not listening. If it returns success, then you can just close the returned value.
    4. Subclass SocketHandler, override the emit method, and in your subclass, have a reference to an alternate handler instance (e.g. FileHandler or SMTPHandler) which you want to use. In your emit code, try to create the socket using

      if self.sock is None:
          self.createSocket()
      if self.sock is None:
          # creation failed: do self.alternate_handler.handle(record)
      else:
          # creation succeeded: defer to superclass implementation
      

    Of course, this may not catch any errors that occur if the server goes down in the middle of sending a message, but it should at least alert you to some problems with your servers.

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

Sidebar

Ask A Question

Stats

  • Questions 297k
  • Answers 297k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Colin Moock's Essential Actionscript 3.0 has a good explanation of… May 13, 2026 at 7:14 pm
  • Editorial Team
    Editorial Team added an answer To store video in the app, you can just add… May 13, 2026 at 7:14 pm
  • Editorial Team
    Editorial Team added an answer Have you tried: team2.setPlayers(team1.getPlayers(); team1.setPlayers(null); for (Player player : team2.getPlayers()… May 13, 2026 at 7:14 pm

Related Questions

I'm writing a reasonably complex web application. The Python backend runs an algorithm whose
I am having a similar issue to this person . The primary difference being
I am in the process of designing a build system and the directory structure
Here's the deal: I have an Android application that needs to call a web
I have a simple task. I have an existing project with a web service

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.