is there a way to enable debug logging for my sdk ...
# ask-ai
c
is there a way to enable debug logging for my sdk worker from an env var?
t
Thanks for reaching out, Bharath. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — yes, you can enable debug logging for your SDK worker via an environment variable. By default agents started with
start
run at INFO level, but you can set the
LOG_LEVEL
env var to
DEBUG
(or pass
--log-level=DEBUG
) to turn on debug logging. Examples: • Export env var (shell) ◦ LOG_LEVEL=DEBUG • Run with flag (example) ◦ uv run agent.py start --log-level=DEBUG During development modes like
dev
or
console
, the default log level is already
DEBUG
. If you want, tell me which agent you’re running (Python or Node.js) and how you start it (local, Docker, or a process manager) and I’ll give the exact command or Dockerfile snippet to set it. Sources: Where to find your Agent Logs | LiveKit | Server options | LiveKit Documentation
c
not seeing debug logs with env variable. suggest right ways
t
Thanks — sorry that setting
LOG_LEVEL=DEBUG
didn’t show debug output. I can help get this working. A couple quick clarifying questions so I give the exact commands you need: 1. Which agent are you running: Python or Node.js? 2. How do you start the worker: directly from the CLI (e.g.,
uv run agent.py start
), with `dev`/`console` mode, inside Docker, or under a process manager (systemd / PM2 / Docker Compose / Kubernetes)? 3. How did you set the env var previously? (example: exported in shell, added to Dockerfile, passed in docker run, set in systemd service file, etc.) While you reply, here are the most common causes and the right approaches depending on how you run the agent: • Starting from the CLI ◦ Ensure the env var is present in the same shell session that launches the process: ▪︎ Inline:
LOG_LEVEL=DEBUG uv run agent.py start
▪︎ Export then run: •
export LOG_LEVEL=DEBUG
•
uv run agent.py start
◦ Alternatively pass the CLI flag:
uv run agent.py start --log-level=DEBUG
• Docker ◦ Set the env var when running the container: ▪︎
docker run -e LOG_LEVEL=DEBUG your-image
◦ Or add to Dockerfile or compose: ▪︎ Dockerfile:
ENV LOG_LEVEL=DEBUG
▪︎ docker-compose.yml: • environment: ◦ LOG_LEVEL: "DEBUG" ◦ Make sure the container is restarted after changing env vars. • Process managers (systemd / PM2) ◦ systemd: add
Environment=LOG_LEVEL=DEBUG
in the service unit and
systemctl daemon-reload
+
systemctl restart your-service
. ◦ PM2:
pm2 start app.js --env LOG_LEVEL=DEBUG
or set in ecosystem file. • dev/console mode ◦ dev and console modes already default to DEBUG. If you still don’t see debug output, check that your logger configuration hasn’t been overridden in code or via a config file. Other things to check (common pitfalls) • Confirm the agent process actually restarted after you changed the env var. • Confirm there isn’t code that programmatically forces a higher log level (INFO or WARN). • If running multiple containers/instances, verify you changed the env var for the correct instance. • Check which logger library is used in your agent (some libraries read env at import time—set env before starting process). If you tell me the agent type and how you run it (answers to 1–3 above), I’ll provide the exact command or config snippet to set
LOG_LEVEL=DEBUG
for your setup and a short verification step to prove debug logs are being emitted.