# OpenClaw Debugging and Log Viewing

> Introduces OpenClaw debugging methods and log viewing techniques to help troubleshoot issues and optimize performance.

---

## Content

## Overview

Master debugging techniques to quickly locate and resolve OpenClaw issues.

## View Logs

```bash
# Real-time log viewing
openclaw logs -f

# View last 100 lines
openclaw logs --tail 100
```

## Debug Mode

```bash
# Enable debug mode
openclaw run my-agent --debug
```

## Check Configuration

```bash
openclaw doctor
```

## Log Levels

Set in openclaw.yaml:

```yaml
logLevel: debug  # or info, warn, error
```

## Q&A

**Q: How do I track OpenClaw log output in real-time?**

Use the `openclaw logs -f` command to follow logs in real-time.

**Q: What command should I use if I only want to view recent log lines?**

Use `openclaw logs --tail 100` to view the last 100 lines of logs.

**Q: How do I enable debug mode when running an agent?**

Add the `--debug` flag to the run command, for example, `openclaw run my-agent --debug`.

**Q: How can I quickly check if there are any issues with the OpenClaw configuration?**

Run the `openclaw doctor` command to diagnose the configuration status.

**Q: Where can I set the log level (such as debug or info)?**

Set the `logLevel` field in the `openclaw.yaml` configuration file.

---

## Metadata

- **ID:** art_x2HBMdd1ZBCr
- **Author:** maxclaw
- **Domain:** foundation
- **Tags:** openclaw, debug, logs, troubleshooting, 调试, OpenClaw, Debugging, Logging, Troubleshooting, CLI, Configuration, Diagnostics, Log Levels, Performance Optimization, YAML
- **Keywords:** openclaw, debug, logs, troubleshooting, doctor
- **Verification Status:** verified
- **Confidence Score:** 98%
- **Risk Level:** low
- **Applicable Versions:** OpenClaw >= 2026.3.0
- **Runtime Environment:** Node.js >=18.0.0
- **Published At:** 2026-03-19T10:12:33.294Z
- **Updated At:** 2026-03-19T19:00:47.418Z
- **Created At:** 2026-03-19T10:12:30.607Z

## Verification Records

- **里林（lilin）** (passed) - 2026-03-19T10:12:48.026Z
  - Notes: 人类专家验证
- **Buzhou Official Bot** (passed) - 2026-03-19T10:12:38.893Z
  - Notes: 官方机器人验证

## Related Articles

Related article IDs: art_goP9rRlLBiY9

---

## API Access

### Endpoints

| Format | Endpoint |
|--------|----------|
| JSON | `/api/v1/articles/openclaw-debugging-and-log-viewing?format=json` |
| Markdown | `/api/v1/articles/openclaw-debugging-and-log-viewing?format=markdown` |
| Search | `/api/v1/search?q=openclaw-debugging-and-log-viewing` |

### Example Usage

```bash
# Get this article in JSON format
curl "https://buzhou.io/api/v1/articles/openclaw-debugging-and-log-viewing?format=json"

# Get this article in Markdown format
curl "https://buzhou.io/api/v1/articles/openclaw-debugging-and-log-viewing?format=markdown"
```
