Workers Logs and wrangler tail: see what a live Worker is doing
Workers Logs and wrangler tail (logging and debugging a live Worker)
What it is
When a Worker runs on Cloudflare, you cannot put a breakpoint in it or watch it the way you watch an app on your own computer. Logs are how you see inside. Every time the Worker answers a request, Cloudflare can record an invocation log (the address asked for, the status code, how long it took, and whether it ended in an error), plus anything your code writes with console.log, console.warn, or console.error.
There are two ways to read them. Workers Logs keeps a history: it stores the logs on your account so you can open a Worker in the dashboard, choose Logs or Observability (the wording may differ slightly), and search or filter past requests, for example every request that threw an error yesterday. It is switched on with an [observability] block in wrangler.toml with enabled = true, and newly created Workers have it on by default. Logs are kept for a limited number of days and there is a sampling setting, head_sampling_rate, from 0 to 1, where 1 means every request is logged.
The second way is live: wrangler tail. Running npx wrangler tail followed by the Worker's name opens a stream in your terminal, and each request to that Worker appears a moment after it happens. Adding --format pretty makes it easy to read, and --status error shows only failed requests. Nothing is stored; when you press Ctrl+C the stream stops. The dashboard has the same live view under the Worker's real-time logs.
Why it matters
When one of your apps shows a blank page or an "Error 1101" screen, the logs usually tell you why in one line, such as a missing secret, a typo in a KV binding name, or a database call that timed out. Without them you are guessing.
wrangler tail is the quickest check after a deploy. Open the tail, load the page once in your browser, and you can confirm the new version answered with a 200 status rather than an error. It needs no settings changed and stores nothing.
Logs record whatever your code prints, so be careful what you print. Never console.log a secret, a password, a full form submission, or anything with patient details, because it will sit in the log history where anyone with access to your Cloudflare account can read it. Cloudflare has announced new Observability pricing for stored logs from 1 December 2026, so on busy Workers a lower head_sampling_rate keeps volume sensible.
On your account
From your own setup: this tutor is the Worker cloudflare-tutor, deployed from /workspace/cloudflare-tutor with Wrangler (lesson 4). If you run npx wrangler tail cloudflare-tutor --format pretty and then open cloudflare.kosan.xyz, you should see a line for GET https://cloudflare.kosan.xyz/ with status Ok, and another for any lesson page you click. Asking for a lesson date that does not exist, such as /lesson/2000-01-01, would show the 404 the Worker returns on purpose.
The same command works for any of your other Workers, such as the ones behind your drkotha.com and kosan.xyz subdomains, by swapping in that Worker's name. Tailing only reads; it never changes the Worker, its routes, or DNS.
This lesson does not change any logging settings. cloudflare-tutor's wrangler.toml was left as it is, and nothing here touches ainews, aiweekly, the AI News root redirect rule, or any other Worker or DNS record.
Do this yourself
These stay in the dashboard, on your side. This site does not change DNS, routes, or other Workers.
- In a terminal on your own computer, from a folder where Wrangler is logged in to your Cloudflare account, run npx wrangler tail cloudflare-tutor --format pretty, then open https://cloudflare.kosan.xyz and one lesson page in your browser, write down the status and the path shown for each request, and press Ctrl+C to stop the stream. Only watch; do not add console.log lines, change the [observability] settings, or redeploy anything.