DEV Community

Jeff
Jeff

Posted on Originally published at powerduck.com

Mockoon Request Logging for Debug: What the Logs Show

Quick answer: Mockoon records every request that reaches a running mock and the response it returned, including headers, params, raw bodies, the route that matched and proxy status. For a 404 or wrong body, read the request and response pair in the Logs tab; for CI or remote servers use the admin API, CLI or JSON file. Exported logs redact known credential headers, while the desktop tab shows them in full.

Read one record

Each entry shows the method, path, status and timestamp. The Request tab holds the URL, the route that caught it, headers, route and query params, and the raw body. The Response tab holds status, headers and body, with an editor for long payloads. A green tick means a local route answered; a shield means the request was forwarded through proxy mode. Everything on the port is intercepted, including the /favicon call a browser sends automatically.

The "caught by route" line splits failures in two. No matching route points to a method, path-parameter, prefix or trailing-slash mismatch. A matched route with the wrong body points to response selection, such as rule order or a disabled response.

Debug by symptom

Confirm the client symptom against the record before changing the mock.

Symptom on the client What the log shows Usually means
404 for a defined path No route caught it, or another method and path did Wrong method, parameter shape, API prefix or trailing slash
200 with the wrong body Expected route caught it, but another response was selected Response-rule order, first-match behavior or a disabled response
No entry for the failing call Nothing reached Mockoon on this port Wrong base URL or port, another process on the port, or a client-side failure
Response came from the real backend Shield icon and requestProxied true Proxy or fallback forwarded because no local response applied
Body fields missing or garbled Raw body and Content-Type differ from what the route expects Different JSON, form encoding or charset than assumed

A call with no log entry never arrived, so editing response rules will not fix it. Check the base URL, port and client interceptors first.

Logs outside the desktop UI

Every running mock exposes logs at <mock-url>/mockoon-admin/logs, and the API prefix is not applied to /mockoon-admin. Requests need an Authorization: Bearer <token> header or they return 401. The desktop generates a random token each launch and shows it in Settings; the CLI accepts --admin-api-token or MOCKOON_ADMIN_API_TOKEN. A server-sent-events endpoint supports a live tail, with the token passed as a query parameter for that stream.

The CLI prints requests to stdout and writes ~/.mockoon-cli/logs/{mock_name}.log unless file logging is disabled. Use --log-transactions to include full bodies; the Docker image disables file logging, so rely on stdout or the admin API there.

Desktop file logging is JSON. The default entry is a compact summary with method, path, status and requestProxied. Enabling "Log the full transactions" adds complete request and response objects, the same fields shown in the Logs tab, but it is verbose and can fill disk on a busy mock. On macOS the logs live under ~/Library/Logs/Mockoon/.

Redaction and limits

The desktop tab shows complete headers and bodies. Log files, admin API output and CLI transactions mask a fixed list of credential headers: authorization, proxy-authorization, cookie, set-cookie, x-api-key, api-key and x-auth-token. The auth scheme is preserved, so a bearer token renders as Bearer [REDACTED].

Masking is name-based and narrow. Bodies are not scanned, and a custom header such as X-Internal-Token stays visible, so review exports before sharing them and never paste a desktop record containing a live token into a public issue.

Logs describe the mock, not the real system. A proxied entry proves the forward happened but says nothing about the target service's internals, and a local 200 does not validate the body against an OpenAPI contract or prove a multi-step flow. Powerduck takes the same local-first approach: its mocks record received requests with an optional limit and clear action, while scenario runs assert status, headers and response fields in order and export an HTML report that redacts known credential fields and folds large payloads. The broader trade-off between a standalone mock server and scenario-based checks is in our comparison hub.

Frequently asked questions

Why is /favicon.ico logged when my app never calls it? Browsers request it automatically, and Mockoon intercepts every incoming request. It is normal browser traffic.

Can I collect logs in CI or on a remote server? Yes, through the admin API logs or SSE stream with the bearer token, or the CLI with --log-transactions on stdout. Protect the token; the admin API sends no CORS headers by default.

Are bodies redacted? No. Redaction covers the listed credential headers only. Bodies and unlisted custom headers remain in clear text.

The bottom line

Read the "caught by route" line and the tick-versus-shield marker before the status code. A routing miss, a wrong response selection and a proxy forward are different failures, and the record separates them. For automated runs, use the admin API or CLI and treat redaction as header-name-only. Debug the request that actually arrived, then decide whether the fix belongs in routing, response rules, the client's base URL or the real backend.

Top comments (0)