> For the complete documentation index, see [llms.txt](https://docs.bugbug.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bugbug.io/debugging-tests/console-logs.md).

# Console logs

How to collect browser console logs in BugBug local and cloud runs: turn them on in project settings, then view or download them from runs history. Logs are kept for 7 days.

BugBug can capture browser console logs during test execution, both in local and cloud runs. This helps you diagnose JavaScript errors, warnings, and custom log messages without leaving the test results view.

***

#### Enabling console logs

Console logs are **disabled by default**. To turn them on, go to [Project settings](https://docs.bugbug.io/preventing-failed-tests/project-settings.md) and find **Collect console logs**.

<figure><img src="https://3168433179-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKixgeBPbLvnD0l1eiV%2Fuploads%2FjadaEQEc6os7Yy7e5dsT%2Fimage.png?alt=media&amp;token=ddb33a80-3e11-4e35-ac52-2e744e207a75" alt=""><figcaption></figcaption></figure>

Three modes are available:

* **Disabled** - No logs are collected. This is the default setting.
* **Console logs** - Collects browser console logs for each test run. Logs are then available in Runs history.
* **Full BugBug debugging -** Collects extended internal BugBug logs. Use this only if you encountered a BugBug problem and want to help the support team debug it — not intended for everyday use.

{% hint style="warning" %}
Enabling console logs can slow down (or even break) your tests if your application generates a large volume of logs.
{% endhint %}

***

#### How to access console logs

Console logs are available for any completed test run (local or cloud) when collection is enabled. Runs from before you turned the setting on don't have logs.

**Option 1 — from the test run view**

1. Go to the [Runs history](https://docs.bugbug.io/debugging-tests/runs-history.md)
2. Click on the test run to open its details
3. Click the **Logs** button at the top of the page (next to "Go to test")

<figure><img src="https://3168433179-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKixgeBPbLvnD0l1eiV%2Fuploads%2FMTBAxKr61OpkGusGksaE%2Fimage.png?alt=media&amp;token=cc35c2ce-e269-4ffe-9495-b51a6adbbf16" alt=""><figcaption></figcaption></figure>

**Option 2 — from Artifacts**

1. Go to the **Runs history**
2. Click on the test run to open its details
3. Click **Details** on the test run
4. In the **Artifacts** section, click **Download test run logs**

<figure><img src="https://3168433179-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKixgeBPbLvnD0l1eiV%2Fuploads%2FgCZrjwcAbvxVH5eQTZoR%2Fimage.png?alt=media&amp;token=124bdd21-4e24-4d41-91d6-28456a423ca4" alt=""><figcaption></figcaption></figure>

***

#### How long logs are kept

Logs expire after 7 days. For an older run you'll see "The logs have expired or have not yet been collected".

{% hint style="info" %}
If you see this message right after a test run, wait a few seconds and try again. The logs need a moment to be collected.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.bugbug.io/debugging-tests/console-logs.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
