Livekit server, what is the env variable to contro...
# ask-ai
p
Livekit server, what is the env variable to control the logging level
t
Thanks for reaching out, mithun. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks for reaching out! While the LiveKit server doesn’t have a specific environment variable clearly documented for adjusting the logging level, you can easily set this up in the server’s configuration file under the
logging
section. For example:
Copy code
logging:
  level: debug
If you’re working with LiveKit Agents, you also have the option to set the log level through command-line arguments like
--log-level=debug
, or even in a Dockerfile using:
Copy code
CMD ["python", "agent.py", "start", "--log-level=DEBUG"]
Please don’t hesitate to ask if you’d like me to walk you through this or if there’s anything else I can help with! Sources: docker-compose.yaml | Docs::Agents | Log collection | LiveKit Docs
p
can u give the full sample livekit config file with log level example
t
Here's a complete example of a LiveKit server configuration file, including how to set up the logging levels:
Copy code
# main TCP port for RoomService and RTC endpoint
port: 7880

# Redis configuration for distributed operation
redis:
  address: redis.host:6379

# WebRTC configuration
rtc:
  port_range_start: 50000
  port_range_end: 60000
  tcp_port: 7881
  use_external_ip: true

# API key/secret pairs for authentication
keys:
  key1: secret1
  key2: secret2

# Logging configuration
logging:
  level: debug
  pion_level: error
  json: true
  sample: true
  sample_initial: 100
  sample_interval: 5
  component_levels:
    rtc: debug
    sfu: info
    room: warn
  item_sample_seconds: 30
  item_sample_initial: 5
  item_sample_interval: 2

# Default room configuration
# room:
This setup covers detailed logging options like log levels, JSON formatting, sampling, and specific log levels for different components. If you have any questions or would like me to walk you through any part of this, just let me know—I’m here to help! Sources: Log collection | LiveKit Docs | logger/config.go | pkg/config/config.go | Log collection | LiveKit Docs
p
in livekit python agent how to set the logging to info
t
Just so you know, the logging level in LiveKit Python agents is set to
INFO
by default, so you usually don’t need to do anything extra unless you want to set it explicitly. Here are two simple ways you can do that: 1. Using the CLI when starting the agent:
python agent.py start --log-level=INFO
2. Configuring Python logging in your script (optional):
Copy code
import logging

logger = logging.getLogger("my-worker")
logger.setLevel(logging.INFO)
If you have any questions or want me to walk you through it, just let me know—I’m here to help! Sources: basics/echo_transcriber_agent.py | Log collection | LiveKit Docs | Docs::Agents | Worker options | LiveKit Docs | Log collection | LiveKit Docs