Enabling debug/log console in Worklight

Recently i started learning about the IBM WorkLight and i followed the instructions on the Your First application to build a simple HelloWorld type of application. As a developer one of the first thing that i like to figure out how the application is actually working so i wanted to figure out a way to debug/enable log for worklight, and i followed these steps
  1. WOrklight generates log information as well as it allows you to use the same logger to write your own log information, How the log information is displayed depends on the client. For example in case of desktop client you can ask Worklight to display the log in a popup window by calling WL.Client.init({showLogger:true}); JavaScript method during onload event
  2. If you want you can use the WorkLight logger to write application specific log messages in the same logger you can do that by calling WL.Logger.debug("Sample debug statement"); WL.Logger.error("Sample error statement");
With these changes, this is how the wlCommonInit() method of my application looks like

function wlCommonInit(){
 console.log("Entering wlCommonInit");
 WL.Logger.debug("Sample debug statement");
 WL.Logger.error("Sample error statement");
 console.log("Exiting wlCommonInit");
Now when i access the application through browser a logger windows gets popped up and it has the log messages like these

No comments: