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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:22:50+00:00 2026-05-28T16:22:50+00:00

I have been trying to log a script output with syslog-ng , however, if

  • 0

I have been trying to log a script output with syslog-ng, however, if I use any time.sleep() function in my code, it breaks syslog-ng and stops logging the output of the script.

Here are the details.

// samplescript.py
import time

while True:
    print "hello world"
    time.sleep(5)

I use pipe to get it’s output to syslog-ng, and I use unix logger tool, so I’m calling the script like this;

$ python sampleoutput.py | logger

This is not generating any output to my log file. The code is simple, and working.

By the way,
I don’t thing anything wrong with syslog-ng conf file, since if i use the code below, it works as expected.

// samplescript.py    
while True:
    print "hello world"

Q: why time.sleep() is breaking syslog-ng? Is there any equivalence for sleep() function that I might use on my code?

thanks in advance.

  • 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-28T16:22:51+00:00Added an answer on May 28, 2026 at 4:22 pm

    You need to flush the buffered stdout-stream:

    import sys
    sys.stdout.flush()
    

    How to flush output of Python print?

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

Sidebar

Related Questions

Have been trying to write an awk script which processes a log file, but
I have been trying the code given in How to use YQL to retrieve
I have been trying to parse Java exceptions that appear in a log for
i have been trying to call a PHP script with the android system. i
I have been trying to set up facebook on a page via a function
I have been trying to use HG convert to migrate a local CVS repository
I have been dabbling around this morning trying to modify the jQuery cycle script
I have been trying to use the SAX parser on Android to display some
I have been trying everything I can to get this script to work and
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,

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.