upload( successCallback, errorCallback ) method

Upload a log file, with log entries, to SAP Mobile Platform server.



This function uploads a log file, which is helpful for collecting logging data from the app to trace bugs and issues.
It uploads a log file, which contains log entries based on log level.
Developers can access the log data in the Management Cockpit and/or a specific folder in installed server directly.


            



On iOS, the uploaded log messages are filtered by the log level at upon upload. 
For example, when you upload a log file with an ERROR log level, the uploaded log messages contain only ERROR log level messages. 
When you upload log files with an INFO level, uploaded log messages contain ERROR, WARN, and INFO log level messages.



            


On Android, generated log messages are filtered "at the log level." 
In other words, the already generated and filtered log messages at another log level are not affected by the current log level. 
Log messages are not filtered upon upload. For example, if you set the log level to DEBUG log messages are filtered at four levels (DEBUG, INFO, WARN, and ERROR. 
Logger on Android has four log levels messages. So, if you set the log level to WARN and upload a log file, the log file has four log level messages that were already generated at the DEBUG level.

Syntax

<static> upload( successCallback, errorCallback )

Parameters

Name Type Description
successCallback function Callback function called when a log file is successfully uploaded to the server.When a log file is successfully uploaded, it is fired. (with http statusCode and statusMessage for success)
errorCallback function Callback function called when an error occurs while uploading a log file to the server.If there is a connectivity error, such as an HTTP error, or unknown server error, it is fired with http statusCode and statusMessage for error.

Example

sap.Logger.upload(successCallback, errorCallback);

function successCallback() {
    alert("Upload Successful");
}

function errorCallback(e) {
    alert("Upload Failed. Status: " + e.statusCode + ", Message: " + e.statusMessage);
}

Source

logger.js, line 259.