Skip to Content
0

Kapsel Logger not uploading messages

Jan 08 at 03:38 PM

40

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Wayne Smith
Feb 28 at 08:55 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Dominik Steinrücken Mar 09 at 09:38 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded