Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't clear subprocess's log #1228

Closed
potoo0 opened this issue Apr 12, 2019 · 2 comments
Closed

Can't clear subprocess's log #1228

potoo0 opened this issue Apr 12, 2019 · 2 comments
Labels

Comments

@potoo0
Copy link

potoo0 commented Apr 12, 2019

Web interface and supervisorctl command line cannot clear logs.

env:

  • os: Raspbian 9.8
  • python: 3.5.3
  • supervisor: 4.0.1

program:x

[program:test_cv]

directory = /home/pi/my_flask/monitor

command = /usr/bin/python3 /home/pi/my_flask/monitor/test_cv.py

user = root
# user = pi

priority = 50
autostart = false
autorestart = false
#startsecs = 5
#startretries = 3

redirect_stderr = true
stdout_logfile = /tmp/test_cv.log
stdout_logfile_maxbytes = 10MB
stdout_logfile_backups = 10

test_cv.py

#!/usr/bin/env python3
import cv2
import logging

logging.basicConfig(
    level=logging.INFO,
    format=r'%(asctime)s - %(filename)s[line:%(lineno)d]' +
    ' - %(levelname)s: %(message)s'
)

logging.info('cv2.__version__: {}'.format(cv2.__version__))

cam = cv2.VideoCapture(0 + cv2.CAP_V4L)
if not cam.isOpened():
    raise Exception('cam cannot open!')
ret3 = cam.set(3, 320)
ret4 = cam.set(4, 240)
ret, frame = cam.read()
logging.info('frame info: {}'.format(frame.shape))
logging.info('ret3: {}, ret4: {}'.format(ret3, ret4))
cam.release()
logging.info('released cam.')

Program cannot clear logs, so I changed user to root , changed log file mode to 777, but still didn't take affect.
Thank for your time and patience.

@mnaberez
Copy link
Member

Duplicate of #804

The title of #804 references XML-RPC but supervisorctl, the web interface, and XML-RPC all use the same mechanism under the hood. The issue is that supervisord can't clear the log when the process is stopped, but can when the process is running.

@potoo0
Copy link
Author

potoo0 commented Apr 13, 2019

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants