Info and log

NarendraK14
Tera Contributor

Apart from scope safe what are the benefits of using gs.info instead of gs.log ?

3 REPLIES 3

Juhi Poddar
Kilo Patron

Hello @NarendraK14 

  • Scope safety is the primary reason for using gs.info() over gs.log().
  • In addition, gs.info() generates informational logs that are easier to filter and identify in the System Logs.
  • Given the widespread use of scoped applications in ServiceNow, gs.info() is considered the preferred method for logging in most scenarios.

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

Harish Bainsla
Kilo Patron
Kilo Patron

Hi @NarendraK14  check below link it will clear your question it explain everything in simple way

 

https://www.servicenow.com/community/itsm-forum/can-we-use-gs-log-in-scoped-application/td-p/876624

if my answer helps you mark helpful and accept solution

Ankur Bawiskar
Tera Patron
Tera Patron

@NarendraK14 

gs.log() won't work in scoped app

Hence we should use gs.info()

No major benefit other than logging the information in system logs table for future troubleshooting or debugging

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader