Skip to content

Logs

Everything your app writes with console.log, console.warn and console.error, and every exception it doesn’t catch, goes into its log. So does everything a container app writes to stdout and stderr. Lines show up a few seconds after they’re written.

When your app answers with a 500, or Cloudflare’s error 1101 (the Worker threw), this is where to look first.

Terminal window
jiayang logs acme/hello
10:04:30 LOG v3 GET /pay charging order 1182
10:04:31 ERROR v3 GET /pay TypeError: Cannot read properties of undefined (reading 'id')
at charge (index.js:42:17)

Each line has the time in UTC, the level, the version that was live, the request that set the app going, and what the app wrote. It shows the last hour, oldest first. --follow keeps printing new lines until you stop it:

Terminal window
jiayang logs acme/hello --follow
Flag Shows
--since 15m Lines from that far back: 30s, 15m, 2h, 1d, or an RFC 3339 time. The default is 1h.
--level warn Lines at that level or louder: debug, info, warn or error.
--version 3 Lines written while version 3 was live.
--search "order 1182" Lines with that text in them. Not case-sensitive.
--limit 500 Up to that many lines before following. The default is 100.

--json prints the page as JSON, or one line of JSON per log line with --follow.

In the dashboard, the app’s Logs tab shows the same lines and follows new ones while the tab is open. An agent reads them with the app_logs tool.

The app’s editors and owners, and the workspace’s owners and admins. Someone the app is shared with as a viewer, in the workspace or not, can open the app but not its logs, which can hold anything your code printed about the people using it:

error: acme/hello's logs are for its editors and owners, and the workspace's owners and admins: You don't have permission to do that.

Only what your app writes. The platform doesn’t log each request into your app’s log: jiayang watch and the audit log show those.

Before a line reaches you, the platform takes out:

  • anything shaped like a signed token, such as the identity token in X-Jiayang-Identity if your code prints its request headers
  • the platform’s own tokens (jyb_, jyu_ and the like)
  • query strings from the request line
  • terminal control codes

Everything else is what your app wrote, so keep secrets and personal data out of your own log lines.

Lines are kept for as long as your plan says, and can’t be read after that:

Plan Kept Lines a day
Free 1 day 20,000
Team 7 days 100,000
Business 7 days 500,000

Lines a day counts every app in the workspace, from midnight UTC. Once the workspace reaches it, logging stops until the next UTC day, and what the apps write meanwhile isn’t kept. jiayang logs and the dashboard say when that has happened. Your apps keep running either way.

  • Lines take a few seconds to arrive. Try again, or use --follow.
  • Check --since: the default is the last hour.
  • The workspace may have reached its lines for the day. jiayang logs says so.
  • jiayang logs says reading logs isn’t switched on for this platform yet: the platform can’t read them for now, and its operator has been told. Your apps’ lines are still kept, for 7 days, and show up once it can.
  • A container’s output only counts once the container has started. A container that never starts writes nothing: see Container apps.