
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
02-15-2020 10:56 PM - edited 08-13-2024 11:06 AM
Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
Hi there,
Ok don't forget completely about adding log statements to Server Side script 🙂 Though I wanted to highlight a really nice small addition made in the Orlando release on the Script Editor. A small addition called "logpoint". When enabled you could simply add a "logpoint" - similar like a breakpoint - on which you could add a temporary log statement, without updating/changing the actual script!
So it should be more flexible, no updates on scripting needed anymore, no accidental log statements transferred to production and you could use this for debugging purposes on any instance.
Working with the Script Editor
Not familiar (enough) with working with the Script Editor? A few weeks back, I wrote an extensive article about "Utilizing the Script Editor". This article also contains the additions made to the Script Editor with the New York release.
Orlando
With the Orlando release, the Script Editor has been enhanced again. Two catching enhancements I would like to highlight:
- Find References;
- Logpoint.
Find References is available when performing a right-mouse click on recognized Script Includes in the Script Editor and selecting "Find References" from the context menu. Basically, this will generate a list of files referencing the Script Include. Read more about this on the Docs: JavaScript syntax editor [https://docs.servicenow.com/bundle/orlando-application-development/page/script/general-scripting/con...]
Logpoint is available when performing a right-mouse click on a line number on the Script Editor within the Platform UI and selecting "Add logpoint" from the context menu. Basically, this will set breakpoints or conditional logpoints to log messages to the console at specific lines and remove logpoints when you are done debugging them.
Activating logpoints
Out-of-the-box the logpoints functionality is not activated. You can easily activate this through setting System Property "glide.debug.log_point" to "true".
Using logpoints
To get your first touch on using logpoints, let's just add a new Business Rule on the Incident table, which triggers on Update, maybe add a condition like Short Description changes. Within the Script field of the Business Rule, on a random line number simply right-mouse click for the context menu to appear. Here you could add something like "gs.info('>>>DEBUG: Orlando logpoints test')".
You can verify the logpoint was set by hovering over the greenish marking on the line number. Adding multiple logpoints to the same script is possible.
After setting the logpoints, activate the Debug Log. Do this by:
1) Navigating to "System Diagnostics > Session Debug > Debug Log"
- OR -
2) Opening the Script Debugger from the Script Editor toolbar and activating "Log" under "Settings".
When triggering this Business Rule, the logpoint should have generated the gs.info statement. When opening the System Logs you should be able to find your log statement.
This could also be done when using the Script Debugger.
Wow! Log statements generated without actually editing scripting, really nice.
Note: Add the logpoint on a line in the Script Editor which contains actual code being executed. If you would add the logpoint on a blanc line or a commented line, the logpoint will not be executed.
Platform UI versus Service Portal Designer, Virtual Agent Designer, etcetera
There is a "small" note I have to make… this all works really nice when using the Script Editor on the Platform UI. The Script Editor available on Script type fields. On Script fields on the Service Portal Designer, Virtual Agent Designer, etcetera… unfortunately, the behavior of the Script Editor is not exactly the same and actually very limited. The new enhancements described in this article, do not apply to the Service Portal Designer, Virtual Agent Designer, etcetera.
---
And that's it actually. If any questions or remarks, let me know!
C |
If this content helped you, I would appreciate it if you hit bookmark or mark it as helpful.
Interested in more Articles, Blogs, Videos, Podcasts, Share projects I shared/participated in? |
Kind regards,
Mark Roethof
ServiceNow Technical Consultant @ Quint Technology
1x ServiceNow Developer MVP
1x ServiceNow Community MVP
---
- 6,966 Views

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hello Mark,
I tried following your steps and it didnot work for me
I turned on the property which enabled an additional "Add log point " option but when i added ,nothing appeared in the log table on my instance
Are there any limitations such as on which lines this needs to be used.
Any syntactical rules that are to bPle present
can we use gs.log() instead of gs.info()
I am able to trigger the script but logpoint is not avaiable on the log table.
Thanks,
Siva

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Have to reproduce. Though didn't try with gs.log. gs.log is also pre-2015 🙂 See this slide from 2015:
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Reproduced with using gs.log('>>>Debug Test', "TEST");
Looks to be working fine. Your screenshot also looks oke.
Did you also activate the Debug Log? (from the Script Debugger or "System Diagnostics > Session Debug > Debug Log").
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Yeah, this isn't working for me either. I enabled the property and see the new functionality but never see my gs.log text in either the session log window or system logs. I've tried with gs.info as well.
I do see log entries...just not the one I want.
Is it supposed to be on a line with code or a blank line? This page says a blank line.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi there,
Just tried again according to what I wrote earlier in this article, still works here.
Not logpoint specific, though general: see the comment on usage of gs.log in my previous reply.
Did you:
- Add the property?
- Activate the debug log?
- Added the logpoint on a line with code that is being executed?
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Yep. All the above. One of my teammates tried as well with the same results. Seems like I'm going to have to open a Hi ticket on the matter.
Thanks
-Roger
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Ok, I did get it to work in my PDI (Paris) but it only shows in the system logs. The session log in the debugger doesn't show it. And it DOES have to be on a functional code line. ServiceNow needs to change their documentation.