> ## Documentation Index
> Fetch the complete documentation index at: https://moeck.io/llms.txt
> Use this file to discover all available pages before exploring further.

# MockServer UI

> Use the built-in dashboard to inspect logs, active expectations, received requests, and proxied requests in real time.

MockServer includes a browser-based dashboard for inspecting its internal state. The UI is read-only — use the REST API or a client SDK to create or modify expectations.

## Open the dashboard

Navigate to the dashboard in any browser:

```
http://localhost:1080/mockserver/dashboard
```

Replace `localhost:1080` with the host and port where your MockServer is running.

You can also open the UI programmatically from Java using `MockServerClient` or `ClientAndServer`:

```java theme={null}
mockServerClient.openUI();
```

The `openUI()` method pauses for one second after launching the browser to give the UI time to load before MockServer shuts down. Use `openUI(TimeUnit timeUnit, long pause)` to customize the pause duration.

<Tip>
  If you set `logLevel` to `DEBUG` and enable `mockserver.launchUIForLogLevelDebug=true`, MockServer will open the dashboard automatically each time a `ClientAndServer` instance starts. This is useful when debugging multiple concurrent MockServer instances.
</Tip>

## Dashboard sections

### Logs

The **Logs** section shows all events recorded by MockServer, including:

* Incoming requests received
* Expectation matches and failures
* Expectations created and deleted
* Errors and exceptions

All log events for a single incoming request are grouped together, making it easy to trace how MockServer handled it end to end.

When an expectation is not matched, MockServer shows a **because** block explaining which fields did or did not match. Expand it to see the full comparison between the incoming request and the expectation matcher.

At `DEBUG` log level, the **because** block includes a detailed human-readable reason for each non-matching field. Additionally at `DEBUG` level, clearing state does not remove log events from the display — they are marked as deleted but remain visible so you can continue debugging.

### Active expectations

The **Active Expectations** section lists all current expectations in the order they are evaluated. The display takes into account:

* The order expectations were created
* Each expectation's `priority`
* Time-to-live (`timeToLive`) for expiring expectations
* Remaining matches count (`times`)

Use this section to confirm that your expectations were registered correctly and are in the expected evaluation order.

### Received requests

The **Received Requests** section shows every request MockServer received, in the order they arrived. This includes:

* Requests matched against an expectation
* Requests proxied to a backend
* Requests that were neither matched nor proxied (resulting in a 404)

### Proxied requests

The **Proxied Requests** section shows requests that MockServer forwarded to a backend, along with the corresponding response returned.

## Troubleshooting with the UI

Use the following workflow when an expectation is not matching as expected:

<Steps>
  <Step title="Set log level to DEBUG">
    Set `mockserver.logLevel=DEBUG` before running your test. This enables detailed match failure output in the Logs section.
  </Step>

  <Step title="Open the dashboard">
    Navigate to `http://localhost:1080/mockserver/dashboard` in your browser.
  </Step>

  <Step title="Send the request">
    Trigger the request from your application or test.
  </Step>

  <Step title="Inspect the Logs section">
    Find the log group for your request. Look for an `EXPECTATION_NOT_MATCHED` event and expand its **because** block. MockServer will show you exactly which fields did not match and why — for example, a header value mismatch or a path pattern that did not apply.
  </Step>

  <Step title="Check Active Expectations">
    Confirm your expectation is listed and that its matcher looks correct. If it is absent, the expectation may have expired or been cleared.
  </Step>
</Steps>

<Note>
  The UI is available for all deployment modes except the deployable WAR. It is not available when MockServer is deployed as a servlet inside an existing servlet container.
</Note>
