All Products
Search
Document Center

Mobile Platform as a Service:Upload logs

Last Updated:Sep 07, 2023

Logs written to the local files on the client are synchronized to the log server in the following ways:

  • Automatic upload: Logs are automatically uploaded to the log server when certain conditions are met.

  • Upload based on the switch: Logs are uploaded to the log server based on the switch value delivered by the server.

  • Manual upload: Logs are uploaded to the log server when the log upload API is called.

Automatic upload

The conditions for automatic log upload are as follows:

  • Logs are automatically uploaded to the log server when the log quantity meets certain rules:

    • Logs recording active devices/users, startup time, lag, stuck, and crash are uploaded in real time.

    • Custom event logs and automation logs are uploaded when the log quantity reaches 50.

  • When an app switches to the backend, the logs are uploaded for once.

Upload based on the switch

You can log in to the mPaaS console, choose Mobile Analysis Service > Log Management > Configure upload switch, and modify the parameters to dynamically modify the log upload conditions.

The meanings of the parameters are as follows:

  • Upload: The settings are effective only when this switch is turned on.

  • Network: Select All networks or Only Wi-Fi. This parameter specifies the network through which logs are uploaded.

  • Business code: The value is the same as the business code (bizType) set when tracking is created. For more information about common business codes, see View local logs.

  • Log count: specifies the number of logs. Logs of this type are uploaded when the specified number is reached.

  • Log upload rate: specifies the percentage of users whose logs are uploaded, in per-mil. The value 1000 indicates that logs of all the users are uploaded.

  • Minimum upload level: Each log has a level when being generated. Logs of a level smaller than or equal to the value specified here are uploaded. For example, if this parameter is set to 2, logs of levels 1 and 2 are uploaded, but logs of level 3 are not uploaded.

For more information, see Configure the log switch.

Manual upload

Call the following code to manually upload logs:

MPLogger.uploadAll();