Skip to main content

How Log Levels Work

ABV supports four log levels to categorize observations by severity:
  • DEBUG: Verbose internal details (tool calls, intermediate steps, debugging info)
  • DEFAULT: Standard operations (successful LLM calls, normal workflow steps)
  • WARNING: Degraded performance or unexpected behavior (slow responses, fallbacks, retries)
  • ERROR: Failures (API errors, timeouts, invalid outputs, exceptions)

Understand Log Level Hierarchy

Log levels follow a severity hierarchy from least to most critical:
When to use each level:DEBUG
  • Internal tool executions
  • Intermediate processing steps
  • Variable values for debugging
  • Cache hits/misses
  • Retry attempts before failure
DEFAULT (normal operations)
  • Successful LLM API calls
  • Standard workflow completions
  • User interactions without issues
  • Expected behavior
WARNING (concerning but non-fatal)
  • Slow LLM responses (>5 seconds)
  • Fallback to alternative model/prompt
  • Deprecated feature usage
  • Rate limit warnings (approaching threshold)
  • Validation warnings (non-blocking)
ERROR (failures)
  • LLM API errors (401, 500, timeouts)
  • Exceptions and crashes
  • Invalid outputs (failed parsing, guardrail violations)
  • Data processing failures
  • Critical validation failures

Set Log Levels on Observations

Assign log levels when creating spans or generations, or update them dynamically based on runtime conditions.Python (set on creation):
Python (update dynamically):
JavaScript/TypeScript:

Add Status Messages for Context

Include a statusMessage alongside the log level to provide human-readable context about why this observation has a particular severity.Good status messages:
  • "LLM timeout after 30 seconds" (ERROR)
  • "Fallback to gpt-3.5-turbo due to rate limit" (WARNING)
  • "Cache miss, fetching from API" (DEBUG)
  • "Retry 2/3 after transient error" (WARNING)
Bad status messages:
  • "Error" (too generic)
  • "Something went wrong" (not actionable)
  • "" (empty, provides no context)
Example:

Filter Traces by Log Level in Dashboard

In the ABV Dashboard, filter traces or observations by log level to focus on specific severity levels.Use cases:
  • Production debugging: Filter to ERROR only to see all failures
  • Performance optimization: Filter to WARNING to find slow or degraded operations
  • Development: Show DEBUG to see full execution details
Dashboard filters:
  • View single trace → Filter observations by level
  • Trace list view → Filter entire traces containing ERROR observations
  • Search queries: level = "ERROR" or level IN ["WARNING", "ERROR"]
This helps you quickly identify issues without scrolling through hundreds of DEBUG observations.

Set Minimum Log Level for Sampling

Configure your SDK to only send observations at or above a certain log level. This reduces ingestion costs while preserving critical error data.Example: Only log warnings and errors in production
Result:
  • Development: All DEBUG, DEFAULT, WARNING, ERROR observations logged
  • Production: Only WARNING and ERROR observations logged (70% cost reduction)
Note: Check your SDK documentation for exact parameter names (min_log_level, log_level, etc.).

Why Use Log Levels?

Production traces can contain hundreds of observations. Log levels let you filter to what matters.Filter examples:
  • level = "ERROR": See only failed observations
  • level >= "WARNING": See concerning behavior leading to failure
  • level = "ERROR" AND environment = "production": Production failures only
Benefits:
  • Find failures in seconds instead of scrolling through hundreds of successful operations
  • Eliminate noise from DEBUG logs in production
  • Focus on actionable errors
Ingesting every DEBUG observation from production is expensive and unnecessary. Filter to WARNING/ERROR levels to reduce ingestion costs by 70-90% while preserving critical error data.Example: Production app with 15 observations per trace (3 DEBUG, 10 DEFAULT, 2 ERROR/WARNING) can reduce log volume by 87% by filtering out DEBUG and DEFAULT levels.Implementation:
Best practice: Use DEBUG in development, WARNING in production. Errors are always critical, so always log ERROR.
Generic alerts (“LLM API returned 500”) fire constantly and get ignored. Log level-based alerts are precise and actionable.Alert strategies:1. Error rate threshold
  • Alert when ERROR observations exceed 1% of total traces
  • Catches systematic failures (API outage, bad prompt deployment)
2. Absolute error count
  • Alert when >100 ERROR observations in 5 minutes
  • Catches spikes in failures
3. Warning accumulation
  • Alert when WARNING observations exceed 10% of traces
  • Catches degraded performance (slow responses, frequent retries)
4. Zero errors expected
  • Alert on any ERROR in critical workflows (payment processing, compliance tasks)
  • Catches every failure immediately
Example: PagerDuty integration
Benefits:
  • Proactive issue detection (catch errors before users complain)
  • Reduced alert fatigue (only actionable alerts)
  • Faster incident response (trace URL in alert for instant debugging)
Multi-step LLM workflows (RAG, agents, chains) generate dozens of observations. Log levels let you control verbosity dynamically.Use case: Agent workflow with tool callsFull trace (DEBUG enabled):
Production trace (WARNING+ only):
Error case (ERROR level):
Benefits:
  • Development: See every step for debugging
  • Production: Only see issues (warnings, errors)
  • Selective detail: Enable DEBUG for specific users or traces when investigating issues
Not all issues are outright failures. Slow responses, fallbacks, and retries indicate degraded performance that should be monitored.Warning-worthy scenarios:1. Latency degradation
2. Fallback behavior
3. Retry patterns
4. Guardrail violations
Dashboard analysis:
  • Query for WARNING observations over time
  • Identify trends: Are latency warnings increasing?
  • Correlate warnings with deployments or traffic spikes

Implementation Guide

Set log levels when using the @observe() decorator to automatically trace functions.Setup:
Update log level dynamically:
Set level on creation:
Set log levels when creating spans or generations manually with context managers.Set on creation:
Update during execution:
Update without direct span reference:
Set and update log levels in JavaScript/TypeScript using the @abvdev/tracing package.Setup:
Update during execution:
Wrap existing functions with automatic tracing and log level updates.Example:
Create spans manually and set log levels explicitly.Example:

Next Steps

Sampling

Control trace volume and cost with rule-based or rate-based sampling strategies

Metadata

Attach structured context to traces for precise filtering and analysis

Tags

Add flexible labels to categorize and filter traces quickly

Environments

Separate development, staging, and production traces for clean comparisons