It has ERROR, WARN, INFO and DEBUG log level and log messages are captured based on the selected log level.
Android and iOS logger default log level is ERROR. By default only ERROR level logs are captured.
The sap.Logger.setLogLevel() method is used to set other levels. To get log messages for all log levels,
you must set the log level to DEBUG. (DEBUG < INFO < WARN < ERROR)
Using the provided sap.Logger.upload() method allows you to upload a log file to SAP Mobile Platform Server,
where an Administrator can view them and remotely set the appropriate log level to control the amount of information
that is written to the log. When the sap.Logger.upload() method is triggered, a log file (not multiple) is uploaded.
If the
Log Upload check box is enabled in the Management Cockpit, the client can upload a log file by calling sap.Logger.upload().
If the
Log Upload check box is disabled on the server, the client cannot upload without getting an HTTP/1.1 403 Forbidden error.
For the Logger plugin, you must call sap.Logger.upload() to upload the log file and implement an upload button or
something that does the upload from within the app to the server.
To upload a log file with the Logger plugin, these conditions must be met: 1) Log Upload check box is enabled on the server 2)The sap.Logger.upload() method is called by developer.
This is the expected work flow with the current architecture.
1) If a user has an issue, such as an exception error, he/she reports it by email or a call to customer center.
2) The Administrator (or developer) enables the app on the server. Then the Administrator lets the user know that he/she can upload the log file.
3) The user uploads a log file to the server. The Administrator gets the uploaded log file in the Management Cockpit.
4) The Administrator sends the file to the app's developer to debug.
On iOS, if the current log level is ERROR(default level), only ERROR level messages are displayed in the console
even if other log level messages are generated. But if the current log level is DEBUG, INFO or WARN,
all generated log messages, regardless of log level are displayed in the console.
On Android, all generated log messages, regardless of log level, are displayed in the Android log cat view (console).
When you use the Settings plugin, it 1) Gets the log level from the server, 2) Sets it into Logger on the client and 3) Calls sap.Logger.upload() upon a logon success event
(when the app is launched or resumed and logon is successful). This means that the setting plugin retrieves the selected log level(type) from the Management Cockpit on the server,
sets the log level to the Logger plugin and then automatically uploads a log file to the server.
If the Settings plugin is not added in the project, a log file can be uploaded only by calling the sap.Logger.upload() method manually by developer.
In the Management Cockpit (client logging dialog box), the Log Upload check box can enable and disable and you can choose the log type(level).
The uploaded log files are listed in the Management Cockpit. There are seven log types (NONE, FATAL, ERROR, WARNING, INFO, DEBUG and PATH) on the server.
Since the Kapsel Logger plugin supports only DEBUG, INFO, WARN and ERROR, the Logger plugin implicitly matches FATAL to ERROR and PATH to DEBUG.
If NONE is set on server admin UI, logger sets it to default log level.
Adding and Removing the Logger Plugin
The Logger plugin is added and removed using the
Cordova CLI.
To add the Logger plugin to your project, use the following command:
Cordova plugin add <path to directory containing Kapsel plugins>\logger
To remove the Logger plugin from your project, use the following command:
cordova plugin rm com.sap.mp.cordova.plugins.logger