gws logs
View logs from services running in worktrees.
Usage
gws logs [service] [options]
Output:
[2024-01-15T10:30:45.123Z] [INFO] Server started on port 3000
[2024-01-15T10:30:46.456Z] [INFO] Connected to database
[2024-01-15T10:30:47.789Z] [INFO] Listening on https://api.myapp.local.getwebstack.dev
Note: This command can be run from anywhere using the
-p [project]option.
Arguments
[service]- Name of the service. If omitted, shows logs from all services.
Options
| Option | Description | Default |
|---|---|---|
-w, --worktree <name> | Worktree name | Main project deployment |
-p, --project <name> | Project name | Auto-detected from current directory |
-f, --follow | Stream logs in real-time | false |
--tail <n> | Show last N lines | 100 |
--since <time> | Show logs since time | All logs |
--timestamps | Include timestamps | false |
Examples:
# Stream logs in real-time
gws logs api -w feature-auth -f
# View logs from all services
gws logs -w feature-auth
# Last 500 lines
gws logs api -w feature-auth --tail 500
# Recent logs only
gws logs api -w feature-auth --since 10m
# With timestamps
gws logs api -w feature-auth --timestamps
Typical Use Cases
Debug startup issues
# Check if service started correctly
gws logs api -w feature-auth --tail 50
Monitor API requests
# Watch API logs in real-time
gws logs api -w feature-auth -f
Check recent errors
# View last 5 minutes of logs
gws logs api -w feature-auth --since 5m | grep ERROR
Compare behavior across worktrees
# Check logs from different environments
gws logs api --tail 20
gws logs api -w feature-auth --tail 20
See Also
- gws status - Check service status
- gws up - Start services
- gws down - Stop services