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,480 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2014 10:26 AM
If you are printing to the log table, then using a debug function that prints out the milliseconds can be very helpful. Here is my default debug function:
function debug (message) {
gs.log('[' + new Date().getTime() + ']' + message, '<Name of Script>');
}
The call to new Date().getTime() will print out in epoch time (basically, milliseconds) when the function was called.
Then you can go to your logs, filter on your script name that you passed in to the gs.log function, and then you can sort by message, descending.
Does this help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2014 11:57 AM
That does help. Not quite what I was asking though.
Is it not possible to change how the existing date fields display in the log?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2014 02:50 PM
Not that I am aware of. The whole of SN is set up with HH:MM:SS. I just looked around and couldn't find anything that used milliseconds. Maybe somebody knows something that I don't and can correct me on this.
Is it code that you are working with? If so, then the debug function I gave you is the best option. If it is not code, then I suppose you will just have to guess at the seconds. (Although I don't know how else to post in the logs without code)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2018 01:16 PM
I just tried this out in Jakarta and the logs never show the <Name of Script>, so I still can't sort chronologically.