Background:
Currently, Deskstop App has a logging system in place. That is configurable and allows storing of backups on log rotation. Desktop App stores all type('all' | 'trace' | 'fatal' | 'error' | 'off' | 'info' | 'warn' | 'debug') of logs in app.log file that has a rotation policy of 10 MB and stores compressed backup up to 3 files. Add has a dedicated error.log file that stores only error logs(10 MB | 3 backups). This is built on top of log4js. It is difficult to query based on date and there is no distinction between logs.
Categorizing Logs based on a different type of task:
Sunbird desktop app code can be categorized into different sections based on the task that it dose. Grouping logs based on categorizes help debug, sync and analyze the different aspects of the Desktop app. This task can have a different log folder and each file inside this can be stored based on the date they are created. This files can be in yyyy-MM-dd<logType>.log pattern.
- App Install: These logs will be generated when the app is being installed on the system(Window, Ubuntu or Mac). Here we need to hook into Elector to get these logs.
- StartUp / App launch: These logs will be generated when the app is being launched. All the logs generated after user clicks on the app link and app is ready to use will be logged here.
- Runtime: These logs will get generated for all user-initiated tasks. Like API call, import/export/download request, content read, filter applied, etc. All logs from UI will also be collected here.
- Process: These logs are for all the asynchronous functions/tasks that get executed in the background. Like import/export/download jobs, telemetry sync, device registry, etc.
- Default/Common: Logs generated from code that is common which cant be grouped are collected here.
Additionally, there will be a few more types of log categories:
- Crash: These logs gets generated when the app crashes. These can be Electron or Node crash logs.
- Error: All logs that are of ERROR type from different categories can be collected to one file so that this can be referred for quick analysis or can be used to sync to the platform for remote analysis.
- Performance: All logs that are of PERF type from different categories can be collected to one file so that this can be referred, to measure app performance.
- Debug: All kind of logs that gets generated in the desktop app can be collected in one file in the order they are generated for in-depth analysis when needed. This type of logging will be disabled by default. It can be enabled on demand for a short amount of time and will be turned off after.
- | logs - | appInstall - | 2019-12-02-install.log - | 2019-12-01-install.log - | appLaunch - | 2019-12-02-launch.log - | 2019-12-01-launch.log - | runtime - | 2019-12-02-runtime.log - | 2019-12-01-runtime.log - | process - | 2019-12-02-process.log - | 2019-12-01-process.log - | default - | 2019-12-02-default.log - | 2019-12-01-default.log - | performance - | 2019-12-02-perf.log - | 2019-12-01-perf.log - | error - | 2019-12-02-error.log - | 2019-12-01-error.log - | debug - | 2019-12-02-debug.log - | 2019-12-01-debug.log
Logs levels
The desktop app will have all traditional log levels and some custom levels.
Level | Description |
---|---|
INFO | For logging information messages. |
DEBUG | For logging messages for debugging purpose. |
ERROR | For logging errors. |
FATAL | For logging errors that are fatal. |
WARN | For logging warning messages. |
TRACE | For logging messages to help trace errors. |
PERF | For logging all performance information. Like how much time import took, time took for search content, etc. |
METRICS | For logging system metrics in different stages. This can contain memory, storage, a resource used, etc. |
DB_ERROR | For logging errors from Database. |
NETWORK_ERROR | For logging network-related errors. |
DIAG | For logging Diagnostic information like a number of tasks in queue, etc. |