Hi,I would like to know if it is possible to add millisecondo to oscript logthanks
Look at the Date.Tick() function. At the beginning of your function, you can do something like this
Integer startTick = Date.Tick()
....some long-winded code...
echo(Str.Format("Elapsed time %1", Date.Tick() - startTick) )
If what you're after is the date-time stamp with miliseconds, i.e 2016-11-17 18:43:23.169, well the Oscript date format doesn't allow that level of granularity - I checked as I was looking for just that thing a couple of days ago.
-Hugh Ferguson
eLink : log millisecondslog milliseconds Posted byFerguson, HughOn 11/17/2016 06:44 PM Look at the Date.Tick() function. At the beginning of your function, you can do something like thisInteger startTick = Date.Tick()....some long-winded code...echo(Str.Format("Elapsed time %1", Date.Tick() - startTick) )If what you're after is the date-time stamp with miliseconds, i.e 2016-11-17 18:43:23.169, well the Oscript date format doesn't allow that level of granularity - I checked as I was looking for just that thing a couple of days ago.-Hugh Ferguson [To post a comment, use the normal reply function]Topic:log millisecondsForum:Content Server Development ForumContent Server:Knowledge Center CS16
Just to follow up on Appu's post, there is a timer in the Service ospace (hence $Service), and it is indeed called SimpleTimer. The documentation for it is found in $Service.SimpleTimer in the Documentation feature. Just looking at it, it appears to make use of Date.Tick() and the undocumented Date.Clock() function. I was curious about Date.Clock() so I wrote a test script to try it out, and it gives a value that is very close to Date.Tick() but it's a bit higher regardless of whether you call it before or after Date.Tick().
So far though, I haven't found a nice way to get a formatted date with the date and time down to the milisecond precision. @OpenText, this would be a nice feature for the Date class.
-Hugh
what is the problem you are wanting to solve? there are various timing options and even within the logs there are indicators. The issue with getting millisecond timings is the accuracy, in order to make sure the performance doesn't drop throught the floor we dont use the hyper accurate time ( windows ) so at the lower level it has a 15ms accuracy
David
Hugh, need to ask, in reality why? what is the business case? what is it going to solve?
Less a business case but a development case. Last week, I was trying to debug something with my code where permissions that were applied by Records management's inheritance callback were being rolled back. I could see in the Audit log when they were being clobbered, but what I needed was some debug in the thread log showing the milisecond count there as well so I could compare the events and know whether this clobbering of permissions was happening before or after the node move or the callback. Given that both CS server and db server were synced to the same time, I should have been able to compare the datestamps properly.
Wouldn’t the connect logs be good for the kind of tracking you want? Then you know who and what is doing when. Especially across threads
In theory yes. In practice no. I've dived into connect logs a lot, and for something like the problem I was trying to solve, the connect log did identify the SQL that was removing the perm, but it didn't identify the function that was doing it (connect log doesn't consistently identify which function executes the SQL). I was trying to match up what I was getting in the thread logs with what was going on in the connect. I ended up patching a bunch of core functions to try and get the debug I needed in (patched so I'm not editing the core ospace). At the time, the time in miliseconds would have been extremely useful and probably would have saved me an hour or so.