Search code examples
javascriptsapui5console.logsap-web-ide

How to properly use jQuery.sap.log.debug instead of console.log in SAPUI5 v.1.38.39?


About environment:

  • The used framework: SAPUI5
  • version: 1.38.39
  • development environment: sap web-ide
  • reproductible with OpenUI5 v.1.38

About Issue :

Recommendation from UI5 : to don't use console.log("message")
Proposition from UI5: use jQuery.sap.log.debug("message") instead, documentation here
expected result : see the "message" in the console from chrome debugger"
actual result : Don't see the "message" in the console"

Code part :

on my controller :

onInit: function(){
  jQuery.sap.log.debug('onInit fired'); // display nothing in chrome console
  console.log('onInit fired'); // display "onInit fired" in chrome console
},

Question:

Does someone has a solution or idea for solve this problem ?

Remark:

  1. My question is probably simple, but i didn't find any solution nowhere, and I am new to UI5, so I am asking here, thank you for your help and comprehension.
  2. If someone also can tell me why this question (the only one I asked so far) lock me to ask further questions, I think the post respect this ? Thank you for your feedback

Solution

  • Did you set the log level to DEBUG?
    If not try to add :

    jQuery.sap.log.setLevel(jQuery.sap.log.Level.DEBUG)
    

    Also, is there any particular reason you are using 1.38 and not something more recent?