Issue
log flooding causing
- log rotation every 10 min
- high memory usage
- high disk usage
Reproduce
Hardware
- ZED Box with ZED X
Code
- run as a systemd service
import pyzed.sl as sl
// ... existing code ...
init = sl.InitParameters()
# NOTES: prevent log flooding
init.sdk_verbose = False
init.camera_resolution = sl.RESOLUTION.HD1200
init.depth_mode = sl.DEPTH_MODE.NONE
cam = sl.Camera()
status = cam.open(init)
if status != sl.ERROR_CODE.SUCCESS:
logger.error("Failed to open camera: {status}", status=repr(status))
exit(1)
else:
logger.info("Camera opened")
runtime = sl.RuntimeParameters()
stream = sl.StreamingParameters()
stream.codec = sl.STREAMING_CODEC.H264
stream.bitrate = 8000
status = cam.enable_streaming(stream)
if status != sl.ERROR_CODE.SUCCESS:
logger.error("Failed to enable streaming: {status}", status=repr(status))
exit(1)
else:
logger.info("Camera Streaming enabled")
logger.info("Started streaming")
logger.info("Press Ctrl+C to quit")
signal.alarm(100) # Set the timeout again
err = cam.grab(runtime)
signal.alarm(0) # Disable the timeout
// ... existing code ...
signal.alarm(TIMEOUT) # Set the timeout again
err = cam.grab(runtime)
signal.alarm(0) # Disable the timeout
if restart_signal:
cam.disable_streaming()
cam.close()
exit(0)
except Exception as e:
# Check if the exception was raised due to a timeout
cam.disable_streaming()
cam.close()
logger.exception("Exception occurred")
raise e
cam.disable_streaming()
cam.close()
// ... existing code ...
Asking for
how to mute log