cancel
Showing results for 
Search instead for 
Did you mean: 

Kapsel Logger not uploading messages

dominik-st
Participant
0 Kudos

Hi all

I have build a cordova app (android) including the kapsel Logger Plugin. The messages I entered via remote debugging in the Chrome console where uploaded to SCPms, but I didn't see any of the script errors which I wanted to upload automatically.

Whenever there is an script error, the message is shown via alert from my index.html (otherwise you won't see it in cordova)

      window.onerror = function( msg, url, line )
      {
        var i = url.lastIndexOf( "/" );
        if ( i > -1 )
          url = url.substring( i + 1 );
          
        console.error( msg );
        alert( "ERROR in " + url + " (line #" + line + ")\n" + msg );
        // xxx: Log versenden
        if(window.cordova && sap.Logger){
        	com.xx.xxx.xxx.devapp.uploadLog(url, line, msg);
        }
        return false;
      };

The code to upload the message is:

	uploadLog: function(url, line, msg){
			console.error("ERROR in " + url + " (line #" + line + ")\n" + msg);
			//sap.Logger.error("ERROR in " + url + " (line #" + line + ")\n" + msg);
			sap.Logger.upload(function() {
                    if(false) {
                    	debugger;
                    }
                }, function(e) {
                    console.warn("Logger Upload: Upload Failed. Status: " + e.statusCode + ", Message: " + e.statusMessage);
                });    		
	}

As mentioned before: If I enter the coding above in the debugging console, the message is uploaded.
Any Ideas?

Thanks in advance and best regards
Dominik

Accepted Solutions (0)

Answers (2)

Answers (2)

dominik-st
Participant
0 Kudos

Hi Wayne

I used the blog the set up the logging. The Log Upload works when I enter the coding above in the debugging console. But I does not work when a script error triggers the Log upload.

We use the latest HAT Version / SDK Version and the Mobile Services Cloud.

Best regards
Dominik

waynesmith
Participant
0 Kudos

First I would recomend taking a look at the following link

https://blogs.sap.com/2016/12/29/getting-started-with-kapsel-part-5-loggingsp13/

We use the above as our base line example and sampe.

the other point to all of this is to make sure you are using the latest versions

we find more offten that updating seem to resolve a lot of issue.

If the above does not help plesae let me know

Wayne Smith

SAP Support