What is the difference between gs.log and GsLog?? - Please explain me in detail

chandu789
Kilo Contributor

What is the difference between gs.log and GsLog?? - Please explain me in detail

4 REPLIES 4

solutioningnow
Giga Guru

Hi Chandra,



Below is the basic difference:


GSLog : GSLog is a script include which makes logging and debugging from script easier by implementing levels of log output, selectable by per-caller identified sys_properties values.




gs.log : gs.log("Hello World"); Will write to the database and the log file. Too much of this can adversely affect performance



You can find more information about GSLog on below wiki link:


GSLog - ServiceNow Wiki



Regards,


Solutioner


What do you mean by "selectable by per-caller identified sys_properties values." - Please explain


Hi Chandra,



Below is an example of GSLog:



var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA");


gl.logWarning("This is a warning message");




Logging of Logs is depends on the value of System Property.


As the best Practise, we should used GSLog only for debugging. As we can turn On or Off logs messages using System Property.



Hope this answers your question



Regards,


Solutioner






Subhajit1
Giga Guru

GsLog is what Solutioner has said: A Script Include


gs.log is basically a Utility Function available with the GlideSystem Object. You may like to read more about GlideSystem here: GlideSystem - ServiceNow Wiki



Its usage has already been described above in the Thread.



Thanks,


Subhajit