Quantcast
Channel: Compare Suite » Articles
Viewing all articles
Browse latest Browse all 17

Compare log files and ignore what is not important

$
0
0

A log file is a data file with a record about the function of a software product. If you run a software it creates log files so that if you face a problem, developers can find out what the reason was and fix it. Most business systems have a logging function integrated as this allows seeing what has happened and why.

Log files are not for a home user, it is a technical thing that makes sense only for software engineers and testers. In this article I’d like to talk about the problem of the analysis of log files.

The only difference is in the datetime stamp

The date and time stamp in log file need to be ignored if you don’t want to see false positive warnings from your diff tool.

Find expected results

Log files represent the results of some software or test script. Testers or software engineers can analyze log files to see if everything worked properly or not. Here is what one should do:

1. Get a log file

2. Open it and check its key values

3. Decide if everything is fine (test passed) or something was wrong

Automation of log analysis

Software developers and testers don’t like to waste their time on useless things like writing documentation or doing some repetitive actions such as analysis of test logs.

Why not use some file diff tool for a log analysis?! Run it via the command line interface to compare the resulting log with a template one (that we know is for a properly working process). If there are no differences then everything is fine, if there are some differences then one should check out the log for details.

The problem of log comparison

Here is the problem. Diff tool will show you all the differences. Those that matter (like error or warning message) and those that don’t matter.

A log might look like this:

Datetime 10/02/2013 12:41

Program started

Sample loaded

User opened project ‘My project’

Project was saved

What differences don’t matter:

  • Date and time stamp. Each log contains a date and time stamp (10/02/2013 12:41 in a log above), for example to track a start time of the script. This need to be ignored if you don’t want to see false positive warnings from your diff tool.
  • Text strings. Some text strings entered by a user might be saved into a log file (like “My project” in an example). Different users will enter different strings, the test is passed, but a diff tool will show a false positive warning again.

Ignore strings you don’t need

The solution is to ignore certain strings. You might ask your diff tool:

  • Ignore the second line in the file
  • Ignore the line that contains “Datetime”
  • Ignore the line that contains “User opened project” text

The first line is ignored during comparison

With Compare Suite you need to go to the “Tools” menu, select “Options” and find “Ignoring” there.

Line ignore option in Compare Suite

Automation

When you have set the ignoring option, you can run Compare Suite via the command line using this command:

  • Comparesuite.exe “C:\logs\log-1.txt” “C:\logs\template-log.txt” -r:C:\logs\result.html

It will create result.html that will say to you that there are differences only if there is actually a difference that you need to pay attention to.

Results

Software developers can invest time in setting up ignore options and then enjoy clear comparison results where only significant differences will be marked.

Why Compare Suite? Well, it was already recognized by software professionals, Check out our Testimonials section to see what people say.

Follow author on Google+


Viewing all articles
Browse latest Browse all 17

Trending Articles