LiteLLM debug and JSON logging in production

Pick the right LiteLLM log level for normal operation and incidents, ship structured JSON logs to your pipeline, and avoid the latency cost of detailed DEBUG output.

On this page

How LiteLLM debug logging fits production operations

When a LiteLLM gateway is slow or returning errors, the on-call engineer needs enough log detail to find the failing component without adding load to the traffic that is already struggling. The LiteLLM debugging documentation describes two verbosity levels. Starting the proxy with --debug or setting LITELLM_LOG=INFO enables info-level logs, which are the right first step for most incidents because they show request handling and routing decisions at a volume most teams can read. Starting it with --detailed_debug or setting LITELLM_LOG=DEBUG enables detailed debug logs, which record much more per request. Teams should treat the detailed level as a short, targeted tool rather than a default setting on a busy gateway.

The JSON log option matters as much as the level. Structured JSON output lets a log pipeline parse fields such as status, model and error type without custom rules, so the same query can run during an incident and afterward for trend review. Before the on-call shift, confirm in your own environment which format your pipeline expects, whether the setting is applied through the environment or the proxy command, and that log lines from every pod reach the same index. Test the change in a mirror environment first, because a format change can break existing parsing rules even when the gateway itself behaves correctly.

The main risk is leaving detailed debugging on after the incident ends. The LiteLLM latency troubleshooting guide names DEBUG logging as a leading cause of added latency when payloads are large, since every request writes large amounts of prompt and response data to the log stream. A practical runbook sets the level back to the normal production setting as soon as evidence is captured, records who changed it and when, and checks latency again after the change. Confirm with your own team what log retention applies to any prompts captured at debug level, because those logs may contain personal or confidential data.

Which LiteLLM log setting fits which situation

This table compares the --debug, --detailed_debug and JSON log options across steady-state production, active incidents and log pipeline ingestion. Read each row to see what the setting emits, how it affects latency when payloads are large, and who should approve turning it on.

EnvironmentSetting and what it emitsEffect on latency with large payloadsWho should decide to enable it
Steady-state productionKeep logging at the default or at INFO (--debug or LITELLM_LOG=INFO) for routine request summaries and startup messagesLow overhead for routine traffic, but confirm the effect with a load test on your own payload sizes before relying on itPlatform team lead, agreed with the security or compliance owner of the logs
Active incidentEnable DEBUG (--detailed_debug or LITELLM_LOG=DEBUG) for detailed request and routing output, scoped to one gateway instance where possibleDEBUG logging is named by LiteLLM as the top cause of latency with large payloads, so expect slower requests while it runsIncident commander, with a time limit set before enabling and a plan to revert
Active incident (narrow capture)Reproduce the failure in a mirror environment with DEBUG on, so production payload sizes are not slowedLatency impact stays outside live callers, but mirror payloads must match production closely to be usefulSupport or engineering owner who runs the reproduction
Log pipeline ingestionEnable JSON log output so a collector can parse fields such as level, message and request context without custom rulesStructured output adds formatting work, so measure it with your payload mix rather than assuming it is freeObservability or SIEM owner, together with the platform team that runs the gateway
Log pipeline ingestion (with DEBUG)Sending DEBUG output to a central pipeline multiplies volume and may capture prompt contentCombines the DEBUG latency cost with shipping and storage cost, so keep this combination rareData protection or privacy owner must approve, because logged content may include personal data
Verifying a new settingConfirm the exact flag or environment variable in the LiteLLM debugging documentation for your installed version before changing productionNo latency change until the setting is applied, so test in a non-production environment firstWhoever owns the deployment configuration, with a change record

Setting log levels and JSON output in production

This sequence sets a documented baseline log level, confirms the proxy actually starts with it, turns on JSON output for the log pipeline, and defines a repeatable way to raise verbosity during an incident and return to the baseline afterward.

  1. Choose the baseline log level

    The platform owner decides the default verbosity for normal operation and records it in the deployment configuration or environment, using the LITELLM_LOG variable or the matching startup flag. LiteLLM's debugging documentation maps --debug and LITELLM_LOG=INFO to info logs, and --detailed_debug and LITELLM_LOG=DEBUG to detailed debug logs. Keep the baseline at info level unless there is a specific reason to keep detailed debug on. Done when the chosen value is committed in the same configuration-as-code repository that holds the rest of the gateway settings and a reviewer has approved it.

  2. Confirm the running proxy uses that level

    After the next rollout, the operator checks the startup output of one pod or process and compares the reported level with the value in the configuration. Mismatches usually mean a startup flag overrides the environment variable, or an older image still carries a hard-coded flag. Confirm the effective setting in the pod spec or service definition as well as in the logs. Done when the startup records show the intended level in every replica, not only in the first one that was checked.

  3. Enable JSON output for the pipeline

    The platform team turns on structured JSON output so the log shipper can parse fields without custom rules. Apply the JSON setting through the configuration path the team already uses for the proxy, then restart a single replica in a non-production environment first. Confirm the exact JSON field names, such as level, timestamp and message keys, in your LiteLLM version by reading a sample of the output, because field names can change between releases. Done when a sample of raw lines from the replica is valid JSON, one record per line.

  4. Verify records parse in the log tool

    The logging owner ships the non-production sample to the log platform in the same pipeline used for production and checks that each record is parsed into separate fields. Look for records that land as a single unparsed message, timestamps that are read as text, and level values that do not filter. Confirm that sensitive content is handled according to your data handling policy before the setting goes to production, because detailed debug output can include request content. Done when filters on level and a known field return expected results and no parse errors appear for a full sample window.

  5. Roll out the verified settings to production

    The operator applies the same configuration to production through the normal change process, one replica at a time where the deployment strategy allows it. Watch the log volume and the proxy's request latency during the rollout, since verbosity changes the amount of data written per request. Done when every production replica reports the baseline level at startup, the log platform receives parsed records from all of them, and the change record names who approved the level and the JSON setting.

  6. Document the temporary verbosity procedure

    The on-call lead writes a short runbook that names who may raise verbosity, the exact change to make, the maximum period the setting stays up, and the steps to revert it. The runbook should state that DEBUG logging is a known cause of added latency for large payloads, so it is raised only for a specific investigation and on as few replicas as the investigation allows. Confirm with your LiteLLM version whether the level can be changed without a full restart, and record the answer in the runbook. Done when the runbook is reviewed and linked from the incident process.

  7. Raise and revert verbosity under change control

    During an incident, the responder raises verbosity on a limited set of replicas, records the start time and the reason in the incident ticket, and collects the logs needed for the investigation. Once the evidence is captured, the responder reverts the setting using the documented steps and checks that the replicas report the baseline level again. Done when the revert is confirmed on every replica that was changed, the incident record shows both the raise and the revert, and the log platform shows the level returning to the baseline.

Why DEBUG logging slows large requests

LiteLLM's latency overhead troubleshooting guidance names DEBUG logging as the top cause of latency when payloads are large. The reason is that verbose logging does work on the request path. For each call, the gateway has to serialize the request and response bodies, format them into log records and write them to the log destination before the response can finish. A short chat prompt makes that cost small. A long prompt, a large tool-call payload or a big completion multiplies it on every request, and the cost grows with payload size rather than with traffic alone.

Treat verbosity as a performance setting, not only a diagnostic one. Before you enable --detailed_debug or set LITELLM_LOG to DEBUG on a production gateway, confirm where the logs go, how fast that destination accepts writes, and whether your typical request sizes reproduce the slowdown. The LiteLLM debugging docs describe the flags and the environment variable, but they do not give a throughput or latency figure for your setup, so the impact has to be measured in your own environment. Ask your platform team to confirm the log sink's write capacity and the size distribution of real prompts before you change the level.

Test every verbosity change in a mirror environment with representative payload sizes. Replay a sample of production-shaped traffic, including the largest prompts and tool outputs you see, at the level you plan to run, and compare latency percentiles and error rates against the baseline at the usual level. Include the JSON log format you intend to ship, since structured output changes record size. Record the result in your change ticket so that anyone who raises the level during an incident knows the expected cost and the rollback step.

Protecting prompts, keys and logs at debug level

Debug logging makes LiteLLM write more of what passes through the gateway, and that output is often copied into places with weaker controls than the gateway itself. The cards below cover the content risks, the storage and access risks, and the people who can change the level, along with the checks to run before enabling detailed output in production.

Prompts carrying personal data

Detailed logs can record request and response content, so a prompt containing a customer name, account number or health detail may end up in your log store. Before enabling detailed output, confirm with a test request in a non-production environment exactly which fields the version you run writes at each level. Treat any prompt-bearing log as personal data for retention and access purposes until you have verified otherwise.

Credentials leaking into output

Authorization headers, provider API keys and the LITELLM_MASTER_KEY can appear in verbose output if they are included in a traced request or configuration dump. Search a debug capture for sk- and provider key patterns before sharing it. Confirm in your own environment whether the version you run masks these values, and do not assume built-in redaction covers every field.

Retention in the log pipeline

Once debug output leaves the gateway, it is copied into shippers, indexes, object storage and backups, each with its own retention rule. A short incident window can become a long-lived copy of prompts. Set a separate retention period for debug-level streams, make sure it is shorter than your standard request logs, and confirm that deletion also reaches backups and replicas.

Access to the log stores

Anyone who can query the log platform can often read the prompts in it, including engineers who have no need to see customer content. Restrict read access to the debug index or stream to a named incident group, and record who exports or downloads log data. Check that your SSO groups and log platform roles match this model before the first incident needs it.

Who can change log levels

Log level is set by a startup flag or the LITELLM_LOG environment variable, so changing it usually means a deployment change or a restart of pods. Limit who can edit the deployment manifests, Helm values or secrets that hold these settings, and require review for any change that enables debug output. Record each change with a reason and a removal date so verbose logging does not stay on after the incident closes.

LiteLLM debugging docs

Reviewing what each level captures

Info and detailed debug levels capture different amounts of data, and the exact contents depend on the LiteLLM release you run. Before setting a production policy, test each level against a sample request, read the output and record which fields appear. Repeat this review after each upgrade, because logging behavior can change between versions.

How LiteLLM log output reaches your pipeline

The flow starts with a client request handled by a LiteLLM proxy worker, which writes log lines to stdout. A container log collector picks them up and forwards them to the log pipeline, which parses the JSON output and sends it to storage or a SIEM. An operator can raise the level with --debug or --detailed_debug during an incident, then must revert it afterward, because DEBUG logging slows requests with large payloads. Check that the chosen level and format reach the collector unchanged.

Log path from a gateway request to storage, with the incident level change.

Questions teams ask before changing LiteLLM log levels

How much effort does it take to change LiteLLM log levels in-house?

For a single gateway, changing the log level is a configuration change, so the direct effort is small. The real effort sits around it: confirming which level your incident process needs, checking what the logs contain before they reach a pipeline, and testing that latency and log volume stay acceptable under real traffic. Your team pays for that review time, any pipeline changes, and the verification cycle. Ask any partner to split their quote into the configuration change, the pipeline work, and the testing, so you can see which parts you could handle yourselves.

How long does a verification cycle take for a log level change?

The length depends on your environment: how many gateway replicas you run, how your log pipeline ingests and indexes data, how much traffic you can replay in a mirror environment, and how your change control process approves production changes. Teams with a mirror that matches production and an existing pipeline usually move faster than teams that must build either one first. Ask for the verification steps and the approval points in writing before you agree on a schedule.

What does the work need from our team?

You need access to the gateway configuration and deployment pipeline, access to the log pipeline or SIEM where JSON logs will land, a change window that your change control process accepts, and a mirror environment where you can send realistic traffic at higher log levels. Someone must also own the decision about which fields may be logged, since prompts and responses can contain personal data. Without a mirror, you will be testing the latency impact in production, which most change processes will not allow.

Can we do this ourselves using the LiteLLM docs?

Yes, many teams can. The LiteLLM debugging docs describe the flags and environment variables for info and detailed debug logging, and JSON log support. The latency overhead troubleshooting guide names DEBUG logging as a top cause of latency with large payloads. Where teams struggle is the surrounding work: deciding what to keep out of logs, wiring the JSON output into their pipeline, and proving the setting holds under load. Your own engineers can do this if they have the time and a mirror to test in.

What drives the cost of this work up or down?

The main drivers are the number of gateway deployments and replicas, how many log pipelines and retention rules you must change, how mature your mirror environment is, whether your team already runs a log platform that accepts JSON, and how much compliance review the logged content requires. Fewer deployments, an existing pipeline, and a mirror that matches production usually reduce effort. Recurring cost appears when log levels change again after upgrades or when new teams need pipeline onboarding.

What should we ask for in a fixed-scope quote?

Ask for the written scope to name the gateways covered, the log levels to be set for production and for incidents, the JSON log format and destination, the pipeline changes included, the mirror testing and the latency checks, the handover documentation, and the change steps with rollback. Also ask which items are one-time and which are retained support or retainers. DeployOpen agrees most engagements as fixed scope in writing before work starts, and the quote follows from that scope, so a clear scope document makes comparison with your in-house estimate straightforward.

Should logs at DEBUG level stay enabled in production?

Generally no, not as a standing setting. DEBUG logging is named as a top cause of added latency with large payloads, so it is best treated as a time-limited incident setting. Many teams run at a lower level in production, raise it during an investigation in a controlled window, and return it afterward. Confirm the right default for your traffic profile in the mirror before deciding, and document who may raise the level and how long it may stay raised.

How each log destination changes the setup

When LiteLLM runs on Kubernetes or another container platform, the simplest path is to write JSON logs to standard output and let the cluster's node-level collector pick them up. The platform team owns the collector, so the first questions concern its parsing rules, buffering and what it does when a log line is too large. Debug output from a large request can produce long lines, and a collector with a small line limit may truncate or drop them mid-incident.

  • Parsing: Confirm the collector parses each line as JSON and does not wrap it in a second string field, which breaks field-level searches.
  • Line size and buffering: Check the maximum line length and buffer limits, especially when detailed debug is enabled for a short window.
  • Retention: Pod logs are usually rotated quickly on the node, so decide where the copy you need for investigations is kept.
  • Access: Cluster log viewers are often broader than the gateway team. Restrict who can read entries that may contain prompt content.
  • Ownership: Name the team that changes the collector configuration and the team that answers when logs stop arriving.

Before relying on this path, confirm the collector configuration in a staging cluster by sending a large test request at the debug level you plan to use in production.

A runbook for raising log detail during an incident

Raise log detail only when a named incident owner has a question that the current logs cannot answer, and record that decision in the incident ticket before changing anything. The incident commander or on-call lead should approve it, with the platform owner confirming the change on the gateway. Start with --debug or LITELLM_LOG=INFO for a moderate increase in detail. Reserve --detailed_debug or LITELLM_LOG=DEBUG for a narrow question, because LiteLLM's latency troubleshooting guidance names DEBUG logging as a top cause of added latency with large payloads. Confirm with your own load test whether the gateway still meets its latency targets at the chosen level, and do not apply DEBUG to a busy production fleet without that check.

Set a time limit when you turn the setting on. Write the start time, the level, the pods or workers affected and the planned end time in the ticket, and check the ticket at each handover. Collect evidence while the setting is active: the relevant log excerpts with their timestamps, the request IDs from the failing calls, the key alias or team involved (never the key value), and the configuration version or commit that was live. The configuration version matters because a level change can coincide with a config rollout, and the outage and error triage runbooks in this group expect the same fields. Compare those excerpts with the provider's error payloads before concluding that the gateway is at fault.

Revert as soon as the question is answered, not when the incident closes. Restore the previous LITELLM_LOG value or remove the --debug flag in the deployment manifest, roll the change through your normal configuration pipeline so that the rollback is recorded, and confirm in the logs that the verbose lines have stopped. Store the collected excerpts in the incident record with the level and dates used, so reviewers can see what was captured and when. Ask your platform team to confirm where log retention applies to debug output, because verbose logs can capture more prompt content than standard logs.

How DeployOpen configures and supports LiteLLM logging

DeployOpen plans the log levels, JSON output and log pipeline for a self-hosted LiteLLM gateway inside your own infrastructure, so routine operation stays quiet and incident detail is available when needed. Each step is written down, tested and handed over to the team that runs the gateway.

How we scope

  • Agree in writing which log level runs in normal operation and which levels are allowed during an incident.
  • Map which log destinations, pipelines and retention rules the gateway must feed, using your existing logging tools.
  • Confirm the LiteLLM version and deployment method first, since logging settings are checked against that release.

How we build

  • Configure log level through the documented flags or environment variable, and set JSON output for your log pipeline.
  • Test that a DEBUG session on a large request is time-limited and that it is turned off again afterward.
  • Verify that logged fields do not expose virtual keys, master keys or prompt content beyond what your policy allows.

How we hand over

  • Deliver a written runbook covering who may raise the log level, how to do it, and how to revert it.
  • Document the JSON field layout your pipeline parses, with sample events from a test environment.
  • Walk your operations and security teams through the runbook and record the decisions taken during the build.

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer when your logging needs change over time.
  • Re-check log settings after each LiteLLM upgrade, since log output can change between releases.
  • Engagements are fixed-scope, so scope and deliverables are agreed in writing before any work starts.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.