Skip to main content

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

OptionDescriptionDefault
-w, --worktree <name>Worktree nameMain project deployment
-p, --project <name>Project nameAuto-detected from current directory
-f, --followStream logs in real-timefalse
--tail <n>Show last N lines100
--since <time>Show logs since timeAll logs
--timestampsInclude timestampsfalse

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