For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Logger SDK
Learn about the Logger SDK.
It is often difficult to reproduce problems that might occur in the field. Replicating the exact environment and device can be troublesome in these situations. It is helpful to be able to retrieve debug logs from client devices as the problems occur in the environment in which they happen. The MobileFirst client-side Logger API allows developers to instrument their code at varying verbosities. These logs then can be captured, and sent to the MobileFirst Analytics Console for further inspection.
From the client we can send logger requests to the MobileFirst Analytics Server at any logging level. However, the server configuration controls what level of logging requests are allowed. Requests sent below this threshold are ignored.
Logging levels need to be controlled to balance two needs: the need to collect information and the need to limit the quantity of data to fit limited storage ability.
Note: For the web API the browser's local storage significantly limits the amount of logs that can be stored before sending to the server. Therefore the developer must either limit the amount of data sent to the logger, or send smaller data to the server more frequently.
- Enabling log capture
By default, log capture is enabled. Log capture saves logs to the client and can be enabled or disabled programmatically. Logs are sent to the server with an explicit send call, or with auto log- Adjusting log verbosity
Seven log levels are available within the Logger API.- Sending captured logs
Send logs to the server according to our application's logic. Auto log send can also be enabled to automatically send logs. If logs are not sent before the maximum size is reached, the log file is then purged in favor of newer logs.- Auto log send
By default, auto log send is enabled. Each time a successful resource request is sent to the server, the captured logs are also sent, with a 60-second minimum interval between sends.- Fine-tuning with the Logger API
The MobileFirst client-side SDK makes internal use of the Logger API. By default, you are capturing log entries made by the SDK. To fine-tune log collection, use logger instances with package names. We can also control which logging level is captured by the analytics using server-side filters.- Fetching server configuration profiles
Logging level can be set by retrieving server configuration files.
Parent topic: Develop the analytics client