Tail the Right Worker in a Multi-Environment Setup

logs & debug

// what it does

Selects which Worker to tail when you run multiple environments or config files. `-e production` targets the `[env.production]` block; `-c` points at a specific Wrangler config when a project has several. Essential when staging and prod are separate scripts.

// shell

$ wrangler tail -e production
$ wrangler tail -c ./wrangler.staging.jsonc

// gotcha

Named environments deploy to a separate Worker called `<name>-<env>`. Without `-e`, tail attaches to the top-level `name`, so if your traffic runs under `[env.production]` you'll get an empty stream until you add `-e production`.