All Products
Search
Document Center

HTTPDNS:Troubleshooting APIs

Last Updated:Nov 06, 2025

Get the session ID

Obtain the session ID to trace the parsing procedure. If a parsing error occurs, provide this ID to technical support through a DingTalk group or a ticket.

Note

The session ID is a randomly generated 12-character string that remains unchanged during the app lifecycle.

getSessionId

API definition

String getSessionId()

Version introduced

1.3.2

Class

HttpDnsService

Return value

Type

Description

String

Returns the session ID.

Code example

val httpdns = HttpDns.getService(accountID)
val sessionId = httpdns?.getSessionId()
HttpDnsService httpdns = HttpDns.getService(accountID);
String sessionId = httpdns.getSessionId();

Enable HTTPDNS log printing

You can specify whether to print HTTPDNS debug logs to the console. This feature is disabled by default.

Important

To prevent the leakage of parameters, such as accountID and secretKey, or data generated during app runtime, you must disable log printing in the production version.

enable

API definition

void enable(boolean enable)

Version introduced

2.0.2

Class

HttpDnsLog

Parameters

Parameter

Type

Required

Description

enable

boolean

Yes

Specifies whether to print logs to logcat.

Code example

HttpDnsLog.enable(shouldPrintLog)
HttpDnsLog.enable(shouldPrintLog);

Set a callback class for SDK logs

You can set a callback class to obtain internal logs from the SDK.

setLogger

Adds a log callback class.

API definition

void setLogger(ILogger logger)

Version introduced

2.0.2

Class

HttpDnsLog

Parameters

Parameter

Type

Required

Description

logger

ILogger

Yes

After you set this interface, the SDK's internal logs are sent through the ILogger interface callback. This lets you control how the logs are printed and stored.

Code example

HttpDnsLog.setLogger { s ->
    Log.d(
        "HttpDnsSDK",
        "resultILogger:$s"
    )
}
HttpDnsLog.setLogger(new ILogger() {
    @Override
    public void log(String s) {
        Log.d("HttpDnsSDK", "resultILogger:" + s);
    }
});

removeLogger

Removes a log callback class.

API definition

void removeLogger(ILogger logger)

Version introduced

2.0.2

Class

HttpDnsLog

Parameters

Parameter

Type

Required

Description

logger

ILogger

Yes

The logger that was previously added.

Code example

HttpDnsLog.removeLogger(logger)
HttpDnsLog.removeLogger(logger);

Troubleshoot parsing failures with logs

If parsing fails, filter for "RESOLVE FAIL" in the console to find the cause.

If the parsing API reports an error, the following logs are output:

  1. Network connectivity failed for a single-host resolution.

76BE3851-990E-4CC6-A812-3BFDA358D3A0

  1. Network connectivity failed for a batch resolution.

DC58501C-9F5E-4088-A9B2-5E135982A74D

  1. A signature error was reported for a single-host resolution.

B5CF3EB1-2157-4F4E-A9A4-16ACE5DCC231

  1. A signature error was reported for a batch resolution.

F3B10F07-9EB6-469C-A5B6-C1B078F46D04

  1. An encryption error was reported for a single-host resolution.

6167D44B-E9F5-4A26-A8C8-56C5672F2F69

  1. An encryption error was reported for a batch resolution.

A6F5B59D-809F-4CB6-BF27-0229216A6B3A

  1. The log indicates the reason for an empty resolution result.

E95977FE-B0BC-4E24-AC3A-430B4AB9F5F5

Note

The preceding logs show only some of the reasons for parsing failures. Other failure logs are also printed when you filter for "RESOLVE FAIL".