Skip to content

Commit 0d19c48

Browse files
committed
log tailing
1 parent c855110 commit 0d19c48

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

docs/cli/mrt.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Commands for managing Managed Runtime (MRT) projects, environments, and bundles
1919
| `mrt env redirect` | `list`, `create`, `delete`, `clone` | Manage URL redirects |
2020
| `mrt env access-control` | `list` | Manage access control headers |
2121
| `mrt bundle` | `deploy`, `list`, `history`, `download` | Manage bundles and deployments |
22+
| `mrt tail-logs` | | Tail real-time application logs |
2223
| `mrt user` | `profile`, `api-key`, `email-prefs` | Manage user settings |
2324

2425
## Global MRT Flags
@@ -506,6 +507,38 @@ b2c mrt bundle download 12345 -p my-storefront --url-only
506507

507508
---
508509

510+
## Tail Logs
511+
512+
### b2c mrt tail-logs
513+
514+
Tail application logs from a Managed Runtime environment in real time. Connects via WebSocket and streams log entries until interrupted with Ctrl+C.
515+
516+
```bash
517+
# Tail all logs
518+
b2c mrt tail-logs -p my-storefront -e staging
519+
520+
# Filter by log level
521+
b2c mrt tail-logs -p my-storefront -e production --level ERROR --level WARN
522+
523+
# Search with regex pattern
524+
b2c mrt tail-logs -p my-storefront -e staging --search "timeout"
525+
526+
# Search with OR pattern
527+
b2c mrt tail-logs -p my-storefront -e staging --search "GET|POST"
528+
529+
# Output as JSON
530+
b2c mrt tail-logs -p my-storefront -e staging --json
531+
```
532+
533+
**Flags:**
534+
| Flag | Description |
535+
|------|-------------|
536+
| `--level` | Filter by log level (ERROR, WARN, INFO, DEBUG, etc.). Repeatable for multiple levels. |
537+
| `--search`, `-g` | Filter entries matching a regex pattern (case-insensitive) |
538+
| `--no-color` | Disable colored output |
539+
540+
---
541+
509542
## User Commands
510543

511544
### b2c mrt user profile

docs/guide/storefront-next.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,23 @@ b2c mrt bundle deploy -p <PROJECT> -e <ENVIRONMENT> \
158158

159159
These patterns match the defaults used by `pnpm sfnext push`. The `--ssr-only` and `--ssr-shared` flags accept either a JSON array (for patterns with brace expansion) or a comma-separated string, and can be overridden if your project structure differs.
160160

161+
## Step 6: Debugging with Log Tailing
162+
163+
After deploying, you can tail application logs in real time to debug runtime issues.
164+
165+
```bash
166+
# Tail all logs from your environment
167+
b2c mrt tail-logs -p <PROJECT> -e <ENVIRONMENT>
168+
169+
# Show only errors and warnings
170+
b2c mrt tail-logs -p <PROJECT> -e <ENVIRONMENT> --level ERROR --level WARN
171+
172+
# Search for specific patterns
173+
b2c mrt tail-logs -p <PROJECT> -e <ENVIRONMENT> --search "timeout|500"
174+
```
175+
176+
This is useful for diagnosing deployment failures, SSR errors, and API connectivity issues. See [MRT Commands](/cli/mrt#tail-logs) for all options.
177+
161178
## Summary
162179

163180
| Step | Command | Required? |
@@ -167,6 +184,7 @@ These patterns match the defaults used by `pnpm sfnext push`. The `--ssr-only` a
167184
| 3. Create MRT Environment | `b2c mrt env create` | Yes |
168185
| 4. Set Environment Variables | `b2c mrt env var set` | Yes |
169186
| 5. Deploy | `pnpm sfnext push` or `b2c mrt bundle deploy` | Yes |
187+
| 6. Debug with Log Tailing | `b2c mrt tail-logs` | Optional |
170188

171189
## Next Steps
172190

0 commit comments

Comments
 (0)