Local Logs & Debugging
Read program logs, compute unit consumption, and transaction errors on local validators without RPC rate limits.
Search across all documentation pages
Read program logs, compute unit consumption, and transaction errors on local validators without RPC rate limits.
Quick-reference recipe card - copy-paste ready.
solana-test-validator
solana logs
anchor test
solana confirm -v <SIGNATURE>When to reach for this:
msg! output during instruction development.# Terminal 1
solana-test-validator --reset
# Terminal 2
solana config set --url http://127.0.0.1:8899
solana logs
# Terminal 3
anchor test --skip-local-validator
# After failure, inspect signature from test output
solana confirm -v <SIG>What this demonstrates:
solana logs both surface program output.confirm -v follow-up.msg!, sol_log, and sol_log_compute_units.logMessages and computeUnitsConsumed.simulateTransaction calls.| Signal | Tool | Action |
|---|---|---|
| Program lines | solana logs | Trace instruction path |
| Error code | confirm -v | Map to program Error enum |
| CU usage | meta field | Tune compute budget ix |
| Account state | solana account | Verify owners and data |
# Anchor verbose test
anchor test -- --nocapture
# RUST_LOG for off-chain test harness
RUST_LOG=debug anchor testmsg! truncates logs and burns CU. Fix: log discriminators and summaries only.solana logs before sending transactions.msg! only in dev builds.| Alternative | Use When | Don't Use When |
|---|---|---|
| LiteSVM tests | Sub-second Rust unit loops | Wallet client debugging |
simulateTransaction | Client-side preflight | Streaming live traffic |
| Surfpool simulate | Mainnet-fork scenarios | Minimal program-only work |
devnet solana logs | Shared repro with teammates | Fast inner loop |
Test validator stdout and solana logs - enable -- --nocapture for Rust test println output.
Use sol_log_compute_units in program or read total computeUnitsConsumed in meta after optimize passes.
Solana caps log bytes per transaction - reduce verbosity.
solana logs supports mention filters - see solana logs --help.
Yes - inner invocations indent in logMessages order.
Map numeric codes to #[error_code] enums in Anchor or manual ProgramError variants.
Execution semantics align on Agave 4.1.1; congestion and priority fee paths differ.
Redirect solana logs or capture JSON meta from solana transaction.
LiteSVM 0.6.x captures logs in test assertions without WebSocket subscriptions.
Add ComputeBudgetInstruction::set_compute_unit_limit in client and compare consumed vs limit in meta.
Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.
Reviewed by Chris St. John·Last updated Jul 16, 2026