background

Why build a logging system? 1) APP (Android & iOS) does not have a unified log reporting system, so many problems of users cannot be investigated by relying on logs. What kind of logging system do we need? 1) High performance, frequent IO does not affect APP performance. 2) Do not lose logs. 3) High compression rate, encrypted logs. 4) Automatically clear expiration logs. 5) Log retrieval is highly reliable. 6) Users actively report logs.Copy the code

XLog vs LogAn

mmap encryption Compression ratio (official website) Upload the log
XLog Y Y 83.7% N
LogAn Y Y 87% Y

Performance comparison :(Honor 9i ld-al20 Android 8.0.0)

The length of a log is 18 and 10w logs are written.

Memory usage (M) CPU Time consuming (ms) Increase file size The compression ratio
XLog 5M 13% 4181 870801 51.62%
LogAn 7M 17% 1580 228637 87.29%

The length of a log is 1177 and 10w logs are written.

Memory usage (M) CPU Time consuming (ms) Increase file size The compression ratio
XLog 10M 13% 7840 2049293 98.25%
LogAn 13M 20% 2094 358676 99.69%
As you can see from the comparison above: 1) LogAn's CPU & memory usage is slightly higher. 2) LogAn takes significantly less time than XLog. 3) LogAn also adds a smaller file size than XLog. 4) LogAn compression rate is significantly higher than XLog.Copy the code

LogAn Log protocol:

Log decryption

 XLog:
 python decode_mars_nocrypt_log_file.py xxx.log 
Copy the code

Back out of plan

2) Maintain a Boolean shouldUploadLog inside App to decide whether to upload log or not. 3) UpLoadLogIntentService is triggered to compress the log file into a ZIP package and then upload it. Push - Message passthrough & notification Push config-userID teacher side - Trigger SIOCopy the code

CommonParam

field describe
source Source (Android /iOS/ Web)
deviceId Device id number
userId The user id
roomId The room id
systemVersion System version
deviceType Equipment model
agoraVersion Sound network version
appVersion The App version