# Logs, errors, and crashes

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Frum%2Fsdk-installation%2Froku%2Ffeatures%2Flogs-and-errors.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Frum%2Fsdk-installation%2Froku%2Ffeatures%2Flogs-and-errors.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

The SDK can record logs you write yourself, errors your channel catches, and crashes it did not survive. This page covers all three, and how to stop the SDK reporting errors you already expect.

### Custom logs[​](#custom-logs "Direct link to Custom logs")

Report a line of your own at a chosen [severity level](https://coralogix.com/docs/user-guides/rum/sdk-installation/roku/features/api-reference.md#severity-levels). Each level has its own method, from [`reportDebug`](https://coralogix.com/docs/user-guides/rum/sdk-installation/roku/features/api-reference.md#reportdebug) through [`reportCritical`](https://coralogix.com/docs/user-guides/rum/sdk-installation/roku/features/api-reference.md#reportcritical). For example, [`reportInfo`](https://coralogix.com/docs/user-guides/rum/sdk-installation/roku/features/api-reference.md#reportinfo) records at Info severity:

```
m.global.cxRum.callfunc("reportInfo", "playback started", {

    data: { asset_id: "movie-8842", bitrate: 4500 },

    labels: { feature: "playback" }

})
```

| Method           | Severity | Use it for                                                    |
| ---------------- | -------- | ------------------------------------------------------------- |
| `reportDebug`    | Debug    | Detail useful only while developing the channel               |
| `reportVerbose`  | Verbose  | High-volume tracing you would not keep on in production       |
| `reportInfo`     | Info     | Ordinary milestones, such as a screen shown or content loaded |
| `reportWarn`     | Warning  | Something recoverable that a viewer may have noticed          |
| `reportErrorLog` | Error    | A failure worth investigating, recorded as a log              |
| `reportCritical` | Critical | A failure that stops the channel doing its job                |

Each takes a message and optional `{ data, labels }`.

Note

The SDK truncates a message longer than 2048 characters, keeping the first 2048 characters. However, when a `data` block has a size of over 3584 characters, the SDK drops the whole block. In both cases, it emits a warning in the console.

When the level is a variable, use [`reportLog`](https://coralogix.com/docs/user-guides/rum/sdk-installation/roku/features/api-reference.md#reportlog) with a value from `getSeverity`:

```
severity = m.global.cxRum.callfunc("getSeverity")

m.global.cxRum.callfunc("reportLog", severity.WARN, "cache miss", { data: { key: "home" } })
```

Note

BrightScript lowercases associative-array keys, so `data: { assetId: 1 }` arrives in Coralogix as `assetid`. Use snake\_case keys, or build the object case-sensitive before adding any keys:

```
data = CreateObject("roAssociativeArray")

data.SetModeCaseSensitive()

data["assetId"] = 1
```

`SetModeCaseSensitive()` works only on a new object, before you add keys, and doesn't carry into nested objects: set it on each level. The same applies to `labels`.

### Error reporting[​](#error-reporting "Direct link to Error reporting")

Pass a caught error to [`reportError`](https://coralogix.com/docs/user-guides/rum/sdk-installation/roku/features/api-reference.md#reporterror) from your `try/catch`. The SDK sends the message, error code and stack trace:

```
try

    startPlayback(asset)

catch e

    m.global.cxRum.callfunc("reportError", e, {

        data: { asset_id: asset.id },

        labels: { feature: "playback" }

    })

end try
```

Report a failure that didn't throw, as an object or a message:

```
m.global.cxRum.callfunc("reportError", { message: "no payment method on file", errorType: "PaymentError" })

m.global.cxRum.callfunc("reportError", "playlist arrived empty")
```

Set a short `errorType` for each kind of failure, such as `PaymentError`, and give thrown errors one too: `throw { message: "checkout failed", errorType: "PaymentError" }`.

Note

An error's `data` block is limited to 2048 characters, tighter than a log's. Over the limit the SDK drops the block whole, keeping none of it.

### Ignore errors[​](#ignore-errors "Direct link to Ignore errors")

`ignoreErrors` drops errors whose message matches. A string matches anywhere in the message; a regular expression is written between slashes, with the flags `i`, `m`, `s` and `x`. Set it in [`coralogix_roku_initialize()`](https://coralogix.com/docs/user-guides/rum/sdk-installation/roku/features/api-reference.md#coralogix_roku_initialize), as with every option:

```
coralogix_roku_initialize({

    ' ...

    ignoreErrors: ["expected timeout", "/^Network error/i"]

}, screen.getGlobalNode())
```

### Crashes[​](#crashes "Direct link to Crashes")

Crash reporting requires Roku OS 13 or later. The SDK reports crashes automatically on the next launch, with the exit code, the last 20 console lines before the crash, and the view that was open when the channel crashed (see [View tracking](https://coralogix.com/docs/user-guides/rum/sdk-installation/roku/features/views-and-user-context.md#view-tracking)). It doesn't report a crash followed by a device restart, or a crash when the channel isn't opened again within 24 hours.

If sending the report fails because of a server error or no network, the SDK tries again after 30 seconds and then after 2 minutes. If those fail too, it keeps the report and tries again on later launches, until 24 hours after the crash.

Warning

The SDK sends these console lines to Coralogix. Keep tokens and personal data out of your console output.

| `error_type`        | Meaning                       |
| ------------------- | ----------------------------- |
| `BrightScriptCrash` | The channel's code crashed    |
| `OutOfMemory`       | The channel ran out of memory |
| `SystemKill`        | The OS closed the channel     |
| `Crash`             | Any other unexpected exit     |
