Skip to content

Logging configuration for LiveKit Agents: avoid JSON stdout in production mode #4339

@dhansmair

Description

@dhansmair

Feature Type

Would make my life easier

Feature Description

Hi there,

I’m exploring how logging in LiveKit Agents can be configured. In production mode, the worker outputs JSON-formatted logs to stdout. Our project would prefer plain-text (non-JSON) logging.

Context:

  • I inspected the source and found that LiveKit attaches a separate handler to the root logger.
  • To tailor logging for our needs, I would need to attach our own handler to the root logger and remove the JSON handler. However, the JSON handler is only attached when cli.run_app is called. This means it cannot be removed except from within the entrypoint function, in which case there will be a period during which logs are emitted in JSON format.

Questions:

  • What is the recommended, clean, and “unhacky” way to solve this?
  • The conventional approach for Python libraries is to maintain their own scoped loggers. What is the motivation for attaching the handler directly to the root logger, rather than to a library-specific logger such as "livekit" or "livekit.agents"?

Best regards,
David

Workarounds / Alternatives

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions