How to display milliseconds in logs?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2014 09:31 AM
The sys logs, (warning, error, all) only display the created date in seconds.
The problem is, there are a lot of activities that then are grouped in the same second, and I lose my order of operations making troubleshooting a whole lot more difficult.
Can I alter the detail level?
Thanks,
-Stephen
- 6,475 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2014 03:04 PM
I'm speaking more generically here. Since when I am troubleshooting anything, oftentimes there are several actions grouped together in the same second and thus, not sorted. If, in the future, I am working on a specific issue I may include a timestamp in the log as you suggested. It's just mostly redundant to the existing fields and thus not really ideal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2014 04:11 PM
Gday,
I got just the script you might need for milliseconds...
var localtime = new Date();
var ms = '000' + localtime.getMilliseconds();
ms = ms.slice(-3);
gs.log(gs.nowDateTime() + '.' + ms........
Let me know how you go, if this works please mark the question as answered.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2014 05:31 PM
Thanks Jamie, not looking for a script though. Looking for a system parameter or something similar to enable displaying milliseconds in the datetime fields that already exist in the log.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2018 01:08 PM
Hello from 2018! Is there any plan for ServiceNow to fix this? I don't think it's hard to add milliseconds to timestamps, but I've noticed that ALL messages from workflow tasks (and, perhaps, other places) seem to have the exact same timestamp regardless of what the script is doing.
For example, I implemented my own pause() method and threw it all over, but all of the logging timestamps were still the same. For the sake of us who have to debug workflows and other server-side scripts, can this please be fixed?
Edit: You can't "Show Matching" filter on the timestamp, either -- it only honors the date and not the time when filtering.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 08:08 AM
Hello from 30/09/2019!
It seems that the question is still relevant.
We always have to tinker a date time prefix in the message to control the order?
Thanks