All Products
Document Center

Upload logs

Last Updated: Jun 09, 2021

Logs written to the local files on a 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:

  • The local logs are automatically uploaded to the log server when the logs reach a certain amount. The specific rules are as follows:
    • Active device/user logs, startup time logs, lag logs, stuck logs, and crash logs are uploaded in real time.
    • Custom event logs and automation logs are uploaded when the log quantity reaches 50.
  • If an App runs in the backend for more than half an hour, logs are uploaded when the App switches to the frontend.
  • If ClientMonitorWakeupReceiver is configured, logs are uploaded every three hours.

Upload based on the switch

Based on the above default log upload conditions, you can dynamically control the log upload through the mPaaS console. Log in to the mPaaS console, choose Mobile Analysis Service > Log management > Configure upload switch > Event tracking configuration, 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.
  • Upload quantity: Specify the number of logs. Logs of current type are uploaded when the specified threshold is reached.
  • Log upload rate: Specify 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 log switch.

Manual upload

Call the following interface to manually upload logs:

  1. MPLogger.uploadAll();