> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agenticenv.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Logs

> Control stdout and stderr output routing with LOG_ENABLE and LOG_LEVEL across any example

All examples route user-facing output to **stdout** and SDK internal logs to **stderr**. SDK logging is off by default (`LOG_ENABLE=false`); set `LOG_ENABLE=true` and `LOG_LEVEL` when debugging.

Source: [`examples/logs/`](https://github.com/agenticenv/agent-sdk-go/tree/main/examples/logs)

## Output routing

| Output | Destination |
| - | - |
| User prompt and assistant reply | stdout |
| SDK internal logs | stderr (when `LOG_ENABLE=true`) |

## Usage

From `examples/`:

```bash theme={null}
go run ./simple_agent "Hello"                                    # default: no SDK logs
LOG_ENABLE=true LOG_LEVEL=debug go run ./simple_agent "Hello"    # enable for debugging
LOG_ENABLE=true LOG_LEVEL=info go run ./simple_agent "Hello" 2>debug.log
```

| Variable | Default | Description |
| - | - | - |
| `LOG_ENABLE` | `false` | `false` → `NoopLogger` (no SDK logs); `true` → real logger at `LOG_LEVEL` |
| `LOG_LEVEL` | `error` | `debug`, `info`, `warn`, `error` — ignored when `LOG_ENABLE=false` |

Optional run footers: `SHOW_LLM_USAGE=true`, `SHOW_TELEMETRY=true` — see [Running Examples](/examples/running-examples).

For OTLP log export, see [Observability](/examples/observability). For file logging in the REPL, see [CLI](/getting-started/cli).

## Learn more

<CardGroup cols={2}>
  <Card title="Logs" icon="file-lines" href="/observability/logs" horizontal>
    SDK logging and OTLP export
  </Card>

  <Card title="Telemetry" icon="gauge" href="/observability/telemetry" horizontal>
    Per-run telemetry footers
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.