maintain logs from record.js to sugarcrm.log file

One of my custom functionality works randomly. so i need to maintain logs from record.js file to sugarcrm.log file. Is any one help to solve this problem. In my records.js file i have more than 3 function, whenever function call's and returns some data i want to maintain logs to sugarcrm.log file.

Parents
  • Take a look at clients/base/views/create/create.js and look for "app.logger.error". You will see an example on how to write into sugarcrm.log directly from js controllers. App.logger is defined at sidecar/src/utils/logger.js.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply
  • Take a look at clients/base/views/create/create.js and look for "app.logger.error". You will see an example on how to write into sugarcrm.log directly from js controllers. App.logger is defined at sidecar/src/utils/logger.js.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Children
  • I call my error function from another function, and add alerts function in initialize function. Still no entry added on my sugarcrm.log file. Can you please tell me,is am doing anything wrong.

    /////////Function call

    self.alerts.showServerError.call(this);

    /////////alerts function 

    initialize: function (options) {

       this.alerts = _.extend({}, this.alerts, {
          addServerErrorsugarCRM: function() {
               console.log("TEST");
               if (!this instanceof app.view.View) {
                   app.logger.error('from Custom-template.js');
                   return;
                }
                var name = 'server-error';
                this._viewAlerts.push(name);
             },
          });

    },

    Here are my full code.

    ({
       extendsFrom: 'RecordView',
       initialize: function (options) {
          this._super('initialize', [options]);
          this.model.on('data:sync:complete',this.renderColors,this);
          this.alerts = _.extend({}, this.alerts, {
                addServerErrorsugarCRM: function() {
                console.log("TEST");
                if (!this instanceof app.view.View) {
                      app.logger.error('from Custom-template.js');
                         return;
                  }
                var name = 'server-error';
                this._viewAlerts.push(name);
             },
          });
       },
       renderColors:function (){
          this.alerts.showServerError.call(this);
       },

    });