Skip to main content
Send application logs to Braintrust to inspect events such as retries and payment failures alongside your AI traces. A log doesn’t require an LLM call, an agent, or an active trace. When a failure occurs during an agent run, you can inspect both the message and the surrounding model behavior. Get logs into Braintrust in two ways:
Application logs are in public preview and can change before reaching general availability.
Application logs Messages share the fields, queries, filters, and IDs used by spans. A message:
  • Records a point in time, with zero duration.
  • Has no children.
  • Carries a severity level.
Emit a message to record an event. Open a span to time an operation or nest other rows under it.

Send logs from the Python SDK

To send logs from Python, emit messages with a project logger’s severity methods, such as info() and error(), or forward existing records from the standard-library logging module with BraintrustLogHandler. The guide covers stored fields, message templates, and associating logs with a trace.

Send OpenTelemetry logs

To forward OpenTelemetry logs, configure your exporter or Collector.

Inspect logs

The Logs row type shows SDK messages, OTLP log records, and OpenTelemetry span events. The Traces and Spans row types exclude these rows. Log rows don’t offer scoring or human review actions.
  1. Go to Logs in your project. In the toolbar’s row type selector, choose Logs. This loads All logs view, with Dense rows and an all-time range.
  2. Choose a time range and use the search field to filter messages.
  3. Select a message to inspect its contents:
    • Output: The full message.
    • Details: Log level, timestamp, span ID, and log ID.
    • Metadata and Context: Additional fields, when present.
    Application logs

Filter by severity

In the Logs row type, select the empty search field. It suggests a filter for each severity level, such as span_attributes.log_level = 'warn' or span_attributes.log_level = 'error'. Choose one to apply it.Application logs filter by severityTo filter on a message’s own level, open the menu beside Log level in Details and select Filter by this value.Application logs filter by value
Messages without a span_attributes.log_level value don’t match a severity filter.

View logs in a trace

To inspect a message in context, select it in its trace’s hierarchy or Timeline. Log icons and timeline markers reflect the recorded severity, when present.Older messages can lack a preview in the trace hierarchy until you open them. The full message remains available in Output.Application log in trace

Next steps