Application Log Highlighter

I had to do some performance improvement tasks last week. Executables in my project logs the tick count along with the log entries that contained function names and other information. What I had to do was to check for the functions that take more time and find a way to reduce it. Looking through the differences of tick counts in a huge log seemed very difficult for me. So I decided to make an application that simplifies my work. The output of that task was the Log Highlight Application.  It helps you to easily identify the functions that take time by highlighting them with specified colors. It provides various options that makes user able to use this application for different types of log files.

Highlight Modes

There are two coloring modes for the application: “Contiguous Random Color Highlight mode” and “Conditional Color Highlight mode with Tag”. In the random color mode, When a change in tick count or the time information logged by the application changes in a log entry, the color of the entries changes from that position and remains so until another change happened. Here, the colors used will be a fixed set of readable colors by the application itself. To select this mode, check “Use Random colors without conditions” check box. In the second mode, user can give the color to be used and also mention a tag to to be appended to the log entry based on a certain amount of time difference. Here, only the entry that the change occurred will be marked with the color. To enable this mode, uncheck “Use Random colors without conditions” check box. When unchecked, you can see that some edit boxes and a list control is enabled. Using that controls, user can add different conditions in which the colors and tags are to be added to the log entry. See how the output looks like in both modes, below.

Conditional color mode with tag

Contiguous random color mode

Tick Count / Time Detection

There are two options in which the user can instruct the application on how to detect the tick count or time information in the log entries. First one is a unique format method, where the user can specify the characters that appear as prefix and suffix to the tick count or time information, so that the application can read it by searching for it in between the given prefix and suffix in the log entry. The second one is delimited columns method, where the user can specify a delimiter and a column number in case if the tick count or time information in the log entry is specified as columns delimited by specific characters(there won’t be a unique format in this case). User can select any of these modes by selecting the radio buttons: “Unique Format” and “Delimited Columns”. If time and / or date information (e.g. “12:30:10:789”) instead of tick count ( e.g. “0000763515”) is logged, the value will be identified by removing all the characters from the format and joining it as a single value. So it must be in a proper format and must have a uniform length. For example, “2” seconds must be logged as “02” as there is a maximum of 2 digits for seconds. If date and time information is required, it must be in the order: Year, Month, Date, Hours, Minutes, Seconds, Milliseconds. Any of these can be omitted, but the order must be there.<p >For the prefix, suffix and delimiter input, there is support for “\t” character which will be parsed to horizontal tab character. so, for “\” character, user will have to specify “\\” as input if it is succeeded by “t”. E.g. “\t\\ta\” will be parsed to “[tab]\ta\”. As the string “\\” will be truncated to “\”, for more than one “\”, user will have to specify the double of actual count. E.g. “\\\\” for “\\”. Note that “\T” (uppercase) won’t be identified as tab character.

Output File Format

There are two again, HTML and Text. In HTML, the file will be a .htm file, colors and tags are supported. But in Text format (.txt), Only Tags are supported; the color information given by the user won’t be reflected. The random color highlight mode doesn’t have support for Text format. There is another option called “Add Time” where the log entries with time differences are appended with the difference. For that, check “Add Time” check box.

The application isn’t thoroughly tested. As it served my purpose, I just thought of generalizing and sharing it. I’m looking forward to hear from you. Please give your feedback as comments.

Download: LogHighlight.rar


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s