Logs written to the local files on a client are synchronized to the log server in the following ways:
Upload logs automatically: Logs are automatically uploaded to the log server when certain conditions are met.
Upload logs based on the switch: Logs are uploaded to the log server based on the switch value delivered by the server.
Upload logs manually: Logs are uploaded to the log server when the log upload API is called.
To stop uploading logs, you need to turn off the iOS tracking switch. See Stop uploading logs for more information.
Upload logs automatically
The conditions for automatic log upload are as follows:
The app triggers the logic of checking log upload upon each cold startup.
Logs are immediately uploaded when the app is switched to the backend.
Logs of the same type are uploaded when the quantity reaches 40.
To ensure timely upload of crash logs, a crash log is uploaded each time the app is restarted after a crash.
Upload logs 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.
Set the URL of the upload switch configuration.
Dynamically control the log upload through the mPaaS console.
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.
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.
Upload quantity: Specify the number of logs. Logs of current type are uploaded when the specified threshold is reached. For example, you can change the default value 40 to another value.
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.
For more information, see Configure the log switch.
Upload logs manually
If some logs need to be uploaded in real time, call the following API to upload logs manually:
Stop uploading logs
Turn off the iOS tracking switch to stop log uploading.
This method only works for mPaaS baseline 10.1.68.42 and later versions.
The method of disabling tracking is as follows:
#import <MPMasAdapter/MPAnalysisHelper.h> [MPAnalysisHelper enableRemoteLog:NO];