Skip to content
Latchkey

wrangler tail and wrangler dev: Logs and Local Runs

wrangler tail streams a deployed Worker's logs in real time, and wrangler dev runs the Worker on a local server for testing.

tail is for watching a live Worker after deploy; dev is for running it during tests. Both have flags that matter when scripted in CI.

What it does

wrangler tail connects to a running Worker and streams its console logs and exceptions, optionally filtered by --status or --method and formatted as JSON. wrangler dev starts a local server that runs the Worker, by default against the Cloudflare edge, or fully on the machine with --local.

Common usage

Terminal
# stream only errors as JSON for log processing
wrangler tail my-worker --status error --format json
# run the worker locally on a fixed port for integration tests
wrangler dev --local --port 8787 &

Options

Command / flagWhat it does
tail <worker>Stream live logs for a Worker
--format json|prettyOutput format for tail
--status <s>Filter tail by ok | error | canceled
devRun the Worker on a local dev server
--localRun fully locally (workerd), no edge connection
--port <n>Port for the dev server

In CI

wrangler dev runs until killed, so start it in the background (append &), wait for the port, run tests, then kill it. wrangler tail also runs indefinitely; use it for post-deploy smoke checks with a timeout wrapper, not as a blocking step.

Common errors in CI

"Authentication error [code: 10000]" on tail means a missing CLOUDFLARE_API_TOKEN. A job that hangs is usually dev or tail left in the foreground; background them. "Address already in use" from dev means the --port is taken by a prior run.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →