Ritesh Arora
Ritesh Arora

Reputation: 31

IBM MobileFirst 8.0.0 - WorkLight Logger and Analytics not working

I have implemented WL Logger and WL Analytics in my ionic app. But the logs(Client side + Server side) are not publishing on the console.

My steps are:- 1. I have enabled MFPLogger on my console. 2. Initialize WL using

enter code here
WL.Client.init({
    onSuccess : function() {

      WL.Logger.config({ capture: true });
      WL.Analytics.init(this);


enter code here
WL.Analytics.addDeviceEventListener
(WL.Analytics.DeviceEvent.NETWORK);
WL.Analytics.addDeviceEventListener
(WL.Analytics.DeviceEvent.LIFECYCLE);
      setInterval(function() {
        WL.Logger.send();

        WL.Analytics.send();
       }, 6000);
      console.log("Success WL");
    },
    onFailure : function(err){

    }
  });
 //Client Side
 WL.Logger.info(response)
 WL.Analytics.log({type : message},message);
 //End
 //Server Side
 MFP.Logger.info(logging_message); 
 //End

Please help

Upvotes: 2

Views: 333

Answers (1)

Ritesh Arora
Ritesh Arora

Reputation: 31

Please try with this one.

WL.Client.init({
    onSuccess : function() {

      WL.Logger.config({ maxFileSize : 100000,              // allow persistent storage of up to 100k of log data
        // level : 'info',                   // at debug (and above) level
        capture : true,  
        stringify: true                  // capture data passed to log API calls into persistent storage
      });

      WL.Analytics.enable().then(function (success) {
        console.log(success);
      }).fail(function (errObj) {
        console.log(errObj);
      });

      setInterval(function() {
        WL.Logger.send();
        WL.Analytics.send();
       }, 6000);
      console.log("Success WL");
    },
    onFailure : function(err){
      console.log("Failed WL");
      WL.Logger.error('Caught an exception', err);
    }
  }); 

Upvotes: 1

Related Questions