Generic function to enabe or disable gs.log statements from script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi All,
I have requirement to minimize the logging information in Prod for better optimization.
so i have created a system property and set it true and created a script include to call that system property , inside what generic gs.log stmt can be given , can someone help me with this pls ,so that it can be called from any of the scripts .
example of gs.log stmts: these are from difft scripts , want generic function to call from other scripts.
gs.log('ret.getHeader ' + request.getHeader(), 'Or-Incident');
gs.log('Multiset created&updated: ' + multiCCreated + ' : ' + multtUpdated);
gs.log(info, 'Transform');
gs.log("11 - Pplink sct gets through variable");
Thanks in Advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Don't use gs.log() as it doesn't work in scoped app, please use gs.info()
check these blogs
Community Code Snippets: Using a System Property to Control Logging
Managing syslog Growth in ServiceNow
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
Instead of gs.log use gs.info or logger.log, if your script running in a scoped application.
Shashank Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
@Neelavathi M Instead of reinventing the wheel with a custom script include, I recommend you to explore GSLog utility. This serves the same purpose for more details please refer to https://www.servicenow.com/docs/de-DE/bundle/zurich-api-reference/page/app-store/dev_portal/API_refe...
Hope this helps.
