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
- Successful LLM API calls
- Standard workflow completions
- User interactions without issues
- Expected behavior
- Slow LLM responses (>5 seconds)
- Fallback to alternative model/prompt
- Deprecated feature usage
- Rate limit warnings (approaching threshold)
- Validation warnings (non-blocking)
- 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)
"Error"(too generic)"Something went wrong"(not actionable)""(empty, provides no context)
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
- View single trace → Filter observations by level
- Trace list view → Filter entire traces containing ERROR observations
- Search queries:
level = "ERROR"orlevel IN ["WARNING", "ERROR"]
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 productionResult:
- Development: All DEBUG, DEFAULT, WARNING, ERROR observations logged
- Production: Only WARNING and ERROR observations logged (70% cost reduction)
min_log_level, log_level, etc.).Why Use Log Levels?
Prioritize Signal Over Noise in Production
Prioritize Signal Over Noise in Production
Production traces can contain hundreds of observations. Log levels let you filter to what matters.Filter examples:
level = "ERROR": See only failed observationslevel >= "WARNING": See concerning behavior leading to failurelevel = "ERROR" AND environment = "production": Production failures only
- Find failures in seconds instead of scrolling through hundreds of successful operations
- Eliminate noise from DEBUG logs in production
- Focus on actionable errors
Reduce Ingestion Costs by Filtering Debug Logs
Reduce Ingestion Costs by Filtering Debug Logs
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.
Enable Smart Alerting and Monitoring
Enable Smart Alerting and Monitoring
Generic alerts (“LLM API returned 500”) fire constantly and get ignored. Log level-based alerts are precise and actionable.Alert strategies:1. Error rate thresholdBenefits:
- Alert when ERROR observations exceed 1% of total traces
- Catches systematic failures (API outage, bad prompt deployment)
- Alert when >100 ERROR observations in 5 minutes
- Catches spikes in failures
- Alert when WARNING observations exceed 10% of traces
- Catches degraded performance (slow responses, frequent retries)
- Alert on any ERROR in critical workflows (payment processing, compliance tasks)
- Catches every failure immediately
- Proactive issue detection (catch errors before users complain)
- Reduced alert fatigue (only actionable alerts)
- Faster incident response (trace URL in alert for instant debugging)
Debug Complex Workflows with Progressive Detail
Debug Complex Workflows with Progressive Detail
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
Track Degraded Performance with Warnings
Track Degraded Performance with Warnings
Not all issues are outright failures. Slow responses, fallbacks, and retries indicate degraded performance that should be monitored.Warning-worthy scenarios:1. Latency degradation2. Fallback behavior3. Retry patterns4. Guardrail violationsDashboard analysis:
- Query for WARNING observations over time
- Identify trends: Are latency warnings increasing?
- Correlate warnings with deployments or traffic spikes
Implementation Guide
Python: Using the @observe() Decorator
Python: Using the @observe() Decorator
Set log levels when using the Update log level dynamically:Set level on creation:
@observe() decorator to automatically trace functions.Setup:Python: Manual Span Creation
Python: Manual Span Creation
Set log levels when creating spans or generations manually with context managers.Set on creation:Update during execution:Update without direct span reference:
JavaScript/TypeScript: Using Context Managers
JavaScript/TypeScript: Using Context Managers
Set and update log levels in JavaScript/TypeScript using the Update during execution:
@abvdev/tracing package.Setup:JavaScript/TypeScript: Using the observe Wrapper
JavaScript/TypeScript: Using the observe Wrapper
Wrap existing functions with automatic tracing and log level updates.Example:
JavaScript/TypeScript: Manual Span Creation
JavaScript/TypeScript: Manual Span Creation
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