---
title: Debugging Guide
---

# Debugging Guide

## vConsole

You can enable the debug mode on the app and then tap the vConsole button on the panel interface to view logs for troubleshooting.

### Enable vConsole

Tap the three-dot icon in the top right corner of the miniapp. Tap **Open Debugging** to enable vConsole.

### Performance analysis tool

- Get the full picture of your miniapp's performance and optimize it based on specific metrics.
- The overall performance should be assessed in conjunction with the hardware performance.
  
  > The base library must be later than **2.11.0**.

**How to enable the performance analysis tool:**

- Tap the three-dot icon in the top right corner. Choose **Open Debugging** > **vConsole** > **Perf**.

   <Image src="/images/debug/perf.png" width="200px" />

- Toggle log: Specify whether to receive console logs from the logic layer. It is recommended to disable this option before collecting performance data to avoid `console.log` affecting performance metrics.
- Open FPS monitor: Enable FPS monitoring. You can tap the monitoring window to switch between metrics and drag it wherever you want.

   <Image src="/images/debug/debug1-us.png" width="200px" />

#### FPS

FPS stands for frames per second. The higher the FPS, the smoother the view appears, and vice versa.

- 60 to 50: Excellent
- 50 to 40: Good
- 40 and under: Needs improvement

#### MS

MS stands for the time to render each frame. The higher the value, the lower the FPS, and vice versa.

#### MT

MT stands for the time taken to send a message from the logic layer to the view layer, in ms. The higher the value, the slower the response, and vice versa.

When the logic layer and view layer communicate in dual-thread mode, serialization and deserialization of communication data are required. Large volumes of data result in longer processing times.

- Communication time: It should be kept below 100 ms, based on the device's performance and FPS.
- Communication frequency: Avoid excessive and continuous communication calls to prevent congestion and delays in response time.

#### KB

KB stands for the size of data sent from the logic layer to the view layer. The higher the value, the slower the response, and vice versa.

The larger the data, the higher the MT. Avoid frequent and lengthy bulk data transfers. `setData` uses the split path to update the root of the data.

- Communication volume: Data volume should be kept relatively low to avoid lengthy bulk data transfers.
- Communication frequency: Avoid excessive and continuous communication calls to prevent congestion and delays in response time.

## Tuya MiniApp IDE logs

- When encountering issues or crashes with Tuya MiniApp IDE, send the runtime logs to the Tuya MiniApp team for troubleshooting.
- You can access the logs by clicking Debug > View Logs in the top menu bar.
   - Client: Basic operational logs for Tuya MiniApp IDE.
   - Remote debugger: The Tuya MiniApp IDE logs output when the remote debugger is used. Upload this log if you encounter any issues with the remote debugger.
   - Plugin: Logs for plugins.

## Client logs

- When any exceptions or crashes occur on the mobile app, upload the logs to assist in identifying and resolving the issues.

Upload logs:

- When errors such as app crashes and API request failures occur during the miniapp's operation, you can upload logs for troubleshooting.
- On the mobile app, go to Settings > About > Upload logs.
- Send the log screenshot and the time of the exception occurrence to the Tuya MiniApp team.

## FAQs

- Is there another way to access debugging if I have hidden the three-dot icon?

   - You can enable the debug mode through [changeDebugMode](/en/miniapp/develop/ray/api/other/changeDebugMode).
      Use `ty.changeDebugMode` for a native miniapp.
   - Make sure to disable the debug mode before the miniapp goes live.

  ```js
  ty.changeDebugMode({
      isEnable: true,
      success: function () {
        console.log('success')
      },
      fail: function (e) {
        console.log('fail', e)
      }
    })
  ```

- Why can't I find access to open debugging?
  
  Only the preview and trial versions of miniapps support the debugging feature.
