Logs Command

View and monitor kodezi-cli logs for debugging and analysis

The logs command allows you to view, monitor, and analyze logs generated by Kodezi CLI.
Logs capture everything the CLI does, including:

  • AI interactions
  • Tool executions (edit, view, bash, search, etc.)
  • LSP & MCP communications
  • Errors and warnings
  • Session lifecycle events
  • Permission prompts
  • Configuration loads

This command is essential for debugging issues, auditing changes, and understanding how the CLI interacts with your project.

Command Purpose

Use this command to view kodezi cli activity logs for debugging issues, monitoring AI interactions, and tracking command execution. Logs include tool usage, API calls, errors, and system events.

Usage

kodezi logs

Running this command displays the most recent 1000 log lines by default.

Example output:

[2025-01-14 10:45:22] INFO  Loaded config from ~/.config/kodezi-cli/kodezi-cli.json
[2025-01-14 10:45:23] INFO  Session started
[2025-01-14 10:45:23] TOOL  Using 'grep' tool on /src
[2025-01-14 10:45:24] ERROR LSP: Unexpected response, retrying...

Flags

The logs command provides two optional flags:

FlagShortDescriptionDefault
--follow-fFollow log output in real timefalse
--tail-tNumber of lines to show1000

--follow, -f

Stream real-time log output as new events occur.

kodezi logs --follow
kodezi logs -f

Real Time Monitoring

Use follow mode to watch logs as they're written. This is particularly useful when debugging active sessions or monitoring long-running tasks.

--tail, -t

Show only the last N lines (default: 1000):

# Show last 100 lines
kodezi logs --tail 100
kodezi logs -t 100

# Show last 500 lines
kodezi logs --tail 500

Combine with --follow:

kodezi logs -f -t 200

Log file Location

Logs are stored inside your Kodezi data directory in:

logs/kodezi-cli.log

To find the exact path on your system:

kodezi dirs data

Output Examples:

# View recent logs
kodezi logs

# Follow logs in real-time
kodezi logs --follow

# Show last 50 lines
kodezi logs --tail 50

# Follow with custom tail
kodezi logs --follow --tail 200

Common Use Cases

Debugging Issues

Use the logs command to find recent errors or watch for new ones as they happen.

# View recent errors
kodezi logs --tail 200

# Watch for errors in real-time
kodezi logs --follow

Monitoring AI Activity

Check which tools the AI used or inspect API calls for troubleshooting.

# Check what tools were used
kodezi logs | grep "tool_use"

# View API interactions
kodezi logs | grep "api_call"

Auditing Sessions

Export logs or filter by specific dates to review what happened in past sessions.

# Export logs for review
kodezi logs > session-logs.txt

# Check specific time period (combined with grep)
kodezi logs | grep "2024-10-25"

Log Rotation

Logs are rotated automatically when they reach a certain size. Older logs are archived with timestamps. Check your data directory for historical log files if you need to review past sessions.

Global Flags

You can also use global flags with the logs command:

# Use custom data directory
kodezi --data-dir /path/to/dir logs

Run:

kodezi --help

to see all available global flags.