---
source_url: https://www.pubnub.com/docs/chat/chat-sdk/build/features/error-logging
title: Error logging
updated_at: 2026-06-22T14:36:50.613Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Error logging

Chat SDK records all errors by default ([errorLogger](https://www.pubnub.com/docs/chat/chat-sdk/build/configuration#input-parameters)) from initialization until app closure. [Download logs](#download-error-log) as a TXT file containing JSON (use a [formatter](https://jsonformatter.curiousconcept.com/) for readability).

Each session log contains the `PUBNUB_INTERNAL_ERROR_LOGGER` constant, session ID, and error list. Error structure:

* `key` listing the method that caused the error and the object on which it was called.
* `error` containing the exact error message.
* `thrownFunctionArguments` showing the method arguments the error relates to.

In this example, an error is returned when you try to [retrieve channel details](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/details) without providing the channel ID that is required in this Chat SDK method.

```json
{
    "PUBNUB_INTERNAL_ERROR_LOGGER_1691586109386":[
        {
            "key":"Chat.getChannel",
            "error":"ID is required",
            "thrownFunctionArguments":{
                "0":""
            }
        }
    ]
}
```

In this example, you want to [create a public channel](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/create#create-public-channel), and the channel ID is too long as it exceeds the [92 UTF-8 characters](https://www.pubnub.com/docs/general/channels/overview#channel-names) allowed by PubNub.

```json
{
    "PUBNUB_INTERNAL_ERROR_LOGGER_1691586109386":[
        {
            "key":"Chat.createPublicConversation",
            "error":{
                "name":"Error",
                "message":"PubNub call failed, check status for details",
                "status":{
                    "error":true,
                    "operation":"PNSetChannelMetadataOperation",
                    "statusCode":400,
                    "errorData":{
                        "status":400,
                        "error":{
                            "message":"Invalid request input.",
                            "source":"objects",
                            "details":[
                                {
                                    "message":"Path parameter 'channel' exceeds the maximum allowed length.",
                                    "location":"channel",
                                    "locationType":"path"
                                }
                            ]

                        }
                    },
                    "category":"PNBadRequestCategory"
                }
            },
            "thrownFunctionArguments":{
                "0": "Lorem-ipsum-dolor-sit-amet-consectetur-adipiscing-elit-sed-do-eiusmod-tempor-incididunt-ut-la",
                "1":"Object"
            }
        }
    ]
}
```

## Download error log

Download a file containing session errors from a web app.

### Method signature

```ts
chat.downloadDebugLog(): void
```

#### Input

This method doesn't take any parameters.

#### Output

| Type | Description |
| --- | --- |
| `void` | Method does not return any value. It allows you to add additional logic and download a text file with logs from a web app. |

### Sample code

Download the current error log.

```ts
chat.downloadDebugLog()
```