IBM MobileFirst 8.0.0 - WorkLight Logger和Analytics无法正常工作

时间:2017-11-07 06:23:19

标签: ibm-mobilefirst

我已在我的离子应用中实施了WL Logger和WL Analytics。但是日志(客户端+服务器端)不会在控制台上发布。

我的步骤是: -  1.我在我的控制台上启用了MFPLogger。  2.使用

初始化WL
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

请帮忙

1 个答案:

答案 0 :(得分:0)

请试试这个。

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);
    }
  });