The SDK allows you to call the reporting APIs to upload custom logs, files, and other information. You can use this feature to promptly report local log information such as user feedback or exceptions, helping preserve the issue context.
Issuing a Command
The platform provides the feature to issue log retrieval commands. You can issue commands and query reporting results on the Log query > Command issuance page in the console. 1. On the Issue Command page, click Create query to create a log retrieval command. You need to select the Select Date and Device ID for the logs to be retrieved. You can add tags and attachment file paths for the retrieval. 2. After the command is issued, wait for the SDK to pull the configurations and upload the log files.
Actively reporting
Limits
To avoid wasting device resources and mobile data due to excessive use, the following proactive reporting limits apply:
File size limit: limits the file size before compression. If this limit is exceeded, only the most recently modified files are retained. Default value: 500 MB for Wi-Fi or 200 MB for 4G. The limit can be modified via (Kotlin) TDDiag.uploadLogs(..., sizeLimit = byte) or (Java) UploadHelper.setSizeLimit(sizeLimit).
Frequency limit: configured via the initialization parameter TDDiagConfig.Builder#setUploadCountLimit.
Traffic limit: configured via the initialization parameter TDDiagConfig.Builder.setTrafficQuota(total, metered).
Retry limit: At startup, up to 5 tasks can be retried. If the retry limit is exceeded, tasks are discarded based on priority. The priority order is retrieval > allowlist tag > other proactive reporting.
Circuit breaker: After 10 consecutive upload failures, proactive reporting is disabled for 6 hours.
Allowlist
For critical reports, you can configure a tag allowlist via the initialization parameter TDDiagConfig.Builder.setImportantLabels(...labels) to bypass the proactive reporting limits.
Note:
You can add tags triggered only by user behavior to the allowlist, such as for user feedback, to prevent excessive usage. It is recommended to enforce code review (CR) for the code that configures the tag allowlist.
Checking Data Reporting
Example
Example 1: uploading logs from the last half hour.
val now = System.currentTimeMillis() / 1000
TDDiag.upload(new UploadParam("recentLog")
.setTimestamp(now - 1800, now)
.setListener(uploadListener, true));
Example 2: uploading a custom file.
TDDiag.upload(new UploadParam("customFile")
.setExtraPaths(listOf(path))
.setExtraInfo(msg, null));
Example 3: creating a task to upload logs from the last 5 minutes when a crash occurs, which are uploaded upon the next startup.
long now = System.currentTimeMillis() / 1000;
TDDiag.upload(new UploadParam("crash")
.setTimestamp(now - 300, now)
.setSaveSync(true));