Logs written to local files on the client are synced to the log server in the following three ways.
Automatic upload: Logs are uploaded automatically when certain conditions are met.
Switch-controlled upload: In addition to automatic uploads, you can use server-side switch values to modify the conditions that trigger an upload.
Manual upload: You can force an upload by calling the log upload API.
To stop uploading logs, turn off the instrumentation switch for the iOS client. For more information, see Stop uploading logs.
Automatic upload
The conditions that trigger an automatic log upload are as follows:
A log upload check is triggered every time the application cold starts.
An upload is triggered immediately when the application enters the background.
By default, an upload is triggered when 40 logs of a specific type are accumulated.
To ensure that crash logs are uploaded promptly, an upload is triggered on the next application start after a crash.
Switch-controlled upload
In addition to the default upload triggers, you can dynamically control log uploads on the Mobile Analysis > Log Management > Configure Upload Switch page in the console.
The following parameters are used to dynamically control log uploads in the console:
Upload Switch: The log and switch configurations take effect only when this switch is enabled.
Network: Select All Network Environments or Only on WiFi.
Business Code: Corresponds to the bizType set during client instrumentation. For common business codes, see View local logs.
Minimum Upload Level: Each log is assigned a level when it is written. Logs with a level less than or equal to this value are uploaded. For example, if you set the minimum upload level to 2, logs with levels 1 and 2 are uploaded, but logs with level 3 are not.
Log Upload Count: Triggers an upload when the number of logs of a specific bizType in the local file reaches this value. This parameter modifies the default threshold of 40 logs.
Log Upload Rate: Sets the log upload rate by user dimension. The rate is on a scale of 1 to 1,000. For example, a value of 1,000 means that logs from all users are uploaded. For more information, see Configure the log upload switch.
Manual upload
If your application requires specific logs to be uploaded in real-time, you can call the following API to force an upload:
[MPRemoteLoggingInterface upload];Stop uploading logs
You can turn off the instrumentation switch for the iOS client to stop uploading logs.
This method applies only to baseline version 10.1.68.42 and later.
To disable instrumentation, use the following method:
#import <MPMasAdapter/MPAnalysisHelper.h>
[MPAnalysisHelper enableRemoteLog:NO];