In my python livekit agent worker process. the err...
# ask-ai
f
In my python livekit agent worker process. the error logs do not show me the stack trace. How can I enable stack trace of error logs!
t
Thanks for reaching out, Tushar. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! I understand you want to see full stack traces in your LiveKit agent worker error logs—let’s get that sorted out together. By default, LiveKit uses a custom exception handler that hides stack traces, but no worries, you can easily change this. Just add the following snippet early in your worker’s initialization:
Copy code
import sys

# Restore default traceback printing
sys.excepthook = sys.__excepthook__
It’s best to place this in your entrypoint function or right at the module-level initialization. This way, any uncaught exceptions will show the full stack traces in your logs, making debugging much smoother. Also, if you want even more detailed logs, you can increase the log level to
DEBUG
by starting your agent like this:
Copy code
python agent.py start --log-level=DEBUG
This will capture those stack traces and give you richer log details. If you run into any hiccups or have questions along the way, feel free to reach out—I’m here to help! Sources: Worker options | LiveKit Docs | Log collection | LiveKit Docs | livekit-agents/livekit/agents/ipc/inference_proc_lazy_main.py