Skip to content

07. Regular Expression For Time Stamps

Ingo Rockel edited this page Nov 16, 2017 · 1 revision

Because some JDKs don't provide any time information when dumping threads, a regular expression time stamp parsing for each line in the log file is included. TDA matches every line to the regular expression given in the preferences and stores the first matching group if the regular expression matches the line. It then takes the last match found as time stamp for the next thread dump to get a time stamp nearest to the thread dump. An example for such a regular expression is

(\d\d\/\d\d\/\d\d\s\d\d:\d\d:\d\d).*

This expression matches lines like

06/02/14 14:54:04       at java.lang.Thread.run(Thread.java:534)

TDA takes the first capturing group of the expression as time stamp. In this example the \d is for digits and the capturing group is included in the brackets and matches 06/02/14 14:54:04. This is stored as timestamp for the next thread dump. Starting with JDK 1.6 the SUN JDKs print out a time stamp in the line before the dump. There is a default regular expression which recognizes this time stamp.

If the timestamp is stored in milliseconds since 1970 there is a checkbox in the preferences Parsed timestamp is a long representing msecs since 1970 to tell TDA to convert the parsed time stamp from milliseconds into a human readable time stamp. See References for detailed information about the regular expressions in java.