upload( successCallback, errorCallback ) method

Upload a log file that contains log entries to SAP Mobile Platform server.



This function uploads a log file, which is helpful for developers who want to collect 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 or a specific folder in the installed server directly.


            



On iOS logger, when uploading a log file, the uploaded log messages are filtered by the log level at upload. 
For example, when you upload a log file at the ERROR log level, uploaded log messages contain only error log level messages. 
When you upload a log file at the INFO level, uploaded log messages contain error, warn, and info log level messages.



            


Android logger just filters the generated log messages "at the log level." 
In other words, the already generated and filtered log messages at another log level are not affected by current log level. 
Log messages are not filtered at uploading. For example, set the log level to DEBUG and log four levels (DEBUG, INFO, WARN and ERROR) of messages. 
At this time, the Android logger has four log level messages. If you set the log level to WARN and upload a log file, the log file has four log level messages which were already generated at the DEBUG level.

Syntax

<static> upload( successCallback, errorCallback )

Parameters

Name Type Description
successCallback function success callback method upon success state.This method is fired when the log file is successfully uploaded(with http statusCode and statusMessage for success).
errorCallback function error callback method upon error state.If there is a connectivity error, such as an HTTP error or unknown server error, this method is fired with http statusCode and statusMessage for error.

Example

sap.Logger.upload(function() {
  alert("Upload Successful");
}, function(e) {
  alert("Upload Failed. Status: " + e.statusCode + ", Message: " + e.statusMessage);
});

Source

logger.js, line 250.