Troubleshoot real-time log pull failures (iOS)

更新时间:
复制 MD 格式

If real-time diagnostic log pull tasks fail on iOS, use this guide to identify and resolve common causes such as MSS connection issues, missing sandbox logs, or unreachable pull instructions.

Problem description

During development, you can use the log component to print information to the console to help locate and troubleshoot problems.

After an app is released, you can use the client diagnostic log API provided by the mPaaS client SDK to record logs and pull them from the console. However, incorrect integration or usage can prevent diagnostic logs from being pulled.

Reproduce the problem

  1. Log on to the console. Go to Products and Services > Mobile PaaS > Mobile Analysis Service > Log management > Pull real-time logs. Click Add to open the page for creating a diagnostic task. Then, fill in the diagnostic task details as prompted.

  2. After you fill in the details, click OK to create the diagnostic task. Once the task is created, click Trigger Push/Sync to send it to the client. The task status on the page updates after the task is sent.

  3. After the client receives the diagnostic task, it uploads the logs to the server. The task status then changes to Task successfully processed. You can then click View to go to the subtask details page and click Download to download the logs.

Result Analysis

A task can have the following statuses:

  • nitialization completed

  • Calling Sync service succeeded (iOS, only calling Sync service, not sending to the client)

  • Calling Push service succeeded (Android, only calling Push service, not sending to the client)

  • Calling Sync service failed (iOS)

  • Calling Push service failed (Android)

  • Task successfully processed

  • Task failed

  • Partial tasks failed

A subtask can have the following two statuses:

  • Expired or permission restricted

  • Completed

If the process succeeds, the task status is "Task processing complete" and the subtask status is "Processing complete". The most common error scenario is the task status showing "Task processing complete" while the subtask status shows "Expired or no permission". This indicates that the pull failure may be caused by one of the following reasons:

  • The diagnostic log has expired and has been deleted from the client.

  • Binary log generation failed because the client does not have file write permissions.

  • The client log generation failed for other reasons.

Troubleshoot the problem

Check if MSS registration was successful

On iOS, log pulling depends on the MSS service. Confirm that the client MSS service is working correctly by checking the Sync category log output in the console. The following examples show normal and abnormal MSS component connections.

If MSS is not working correctly, resolve the MSS service connection issue first.

  • Normal MSS component connection

2020-03-25 11:19:33.873603+0800 Demo[24958:6621533] [Sync] start sync ssl:cn-hangzhou-mss-link.cloud.alipay.com,settings:{
2020-03-25 11:19:33.873873+0800 Demo[24958:6621533] [Sync] LL socket connect SUCESS!
  • Abnormal MSS component connection (The following example shows a failure caused by a network issue)

2020-03-25 11:16:53.624467+0800 Demo[24452:6612201] [Sync] LL connectToHost=cn-hangzhou-mss-link.cloud.alipay.com port:443
2020-03-25 11:16:53.627994+0800 Demo[24452:6612201] [Sync] LL onSocket:willDisconnectWithError:err Error Domain=NSPOSIXErrorDomain Code=50 "Network is down"

Checking Whether Local Logs Are Written to the Sandbox

Important

Perform this check while disconnected from the network.

Confirm that your code writes binary logs, then go to the app sandbox path Library/file/<date>/11.2nd and check whether files similar to the following are generated.

Important

When you check the files, make sure their creation and modification times match your test time.

2

If you cannot find the relevant logs in the sandbox, review the integration process for the client diagnostic component. If the problem persists, prepare a project that can reproduce the issue and search for the DingTalk group number 145930007362 to join for further assistance.

Check if the pull action instruction reaches the client

After you trigger the Sync action in the mPaaS log pull console, check the client console output for the related instruction received through MSS, for example: 4

If the instruction is never received, check the network connection and confirm that the user ID is correct. If the problem persists, search for the DingTalk group number 145930007362 to join for further assistance.