Have you ever wondered how to remove some of the timing and other environment specific information from a trace/log file so that we only see the SQL and PeopleCode?
The timing and other information that I am referring to are:
SQL:
PeopleCode:
Why?
While these timing and other information in the trace file are great for performance tuning activities, they seem to cause several issues (at least for me) when doing a comparative analysis. By comparative analysis, I mean comparing the trace files across different scenarios to identify a problem. For example, an issue might only occur for user A but does not occur for user B. Then we would be inclined towards comparing the trace files generated for user A and user B in an effort to identify the problem. Similarly, an issue might only occur in a particular environment (say TEST) whereas it works fine in another environment (say DEVELOPMENT). Again we would be inclined towards comparing the trace files generated in TEST and DEVELOPMENT to identify the problem.
Now that I detailed the scenario/activity, I would like to describe the problem. When we try to compare two different trace files using any file compare tools (such as WinMerge), the results would identify a difference on almost every single line! Most of them would be false positives due to the timing and other information which is not really useful in such cases.
E.g.:
Regular Expressions (RegEx) Pattern Matching for PeopleSoft Trace/Log Files:
So, if we get rid of (or mask the unncessary information) then we can determine the "actual" differences more efficiently.
That is where Regular Expression (RegEx) pattern matching helps in identifying and removing/masking unncessary information.
Note: I generally use notepad++ for text editing. I am sure most text editors would have a similar RegEx find/replace functionality.
RegEx Pattern for SQL:
Find: ^[a-z]{8}\.\d+ +\(\d+\) +\t +\d+-\d+ +\d{2}\.\d{2}\.\d{2} +\d+\.\d{6} Cur#\d+\.\d+\.[a-zA-Z0-9_]+ RC=\d+ Dur=\d+.\d{6}
Replace: SQL---------------
RegEx Pattern for PeopleCode:
Find: ^[a-z]{8}\.\d+ +\(\d+\) +\t +\d+-\d+ +\d{2}\.\d{2}\.\d{2} +\d+.\d{6}
Replace: PeopleCode--------
Benefits of Regex Pattern Matching Find/Replace During Comparative Analysis:
Now, if we remove all the unnecessary information and then compare, we would be able to determine the differences quickly and easily. Here is an example of how I used the RegEx Find/Replace (detailed above) and then compared two different trace files using WinMerge.
Similarly, we can use Regex Pattern Matching to intelligently find and replace specific portions of the trace/log files to improve readability!
The timing and other information that I am referring to are:
SQL:
PeopleCode:
Why?
While these timing and other information in the trace file are great for performance tuning activities, they seem to cause several issues (at least for me) when doing a comparative analysis. By comparative analysis, I mean comparing the trace files across different scenarios to identify a problem. For example, an issue might only occur for user A but does not occur for user B. Then we would be inclined towards comparing the trace files generated for user A and user B in an effort to identify the problem. Similarly, an issue might only occur in a particular environment (say TEST) whereas it works fine in another environment (say DEVELOPMENT). Again we would be inclined towards comparing the trace files generated in TEST and DEVELOPMENT to identify the problem.
Now that I detailed the scenario/activity, I would like to describe the problem. When we try to compare two different trace files using any file compare tools (such as WinMerge), the results would identify a difference on almost every single line! Most of them would be false positives due to the timing and other information which is not really useful in such cases.
E.g.:
Regular Expressions (RegEx) Pattern Matching for PeopleSoft Trace/Log Files:
So, if we get rid of (or mask the unncessary information) then we can determine the "actual" differences more efficiently.
That is where Regular Expression (RegEx) pattern matching helps in identifying and removing/masking unncessary information.
Note: I generally use notepad++ for text editing. I am sure most text editors would have a similar RegEx find/replace functionality.
RegEx Pattern for SQL:
Find: ^[a-z]{8}\.\d+ +\(\d+\) +\t +\d+-\d+ +\d{2}\.\d{2}\.\d{2} +\d+\.\d{6} Cur#\d+\.\d+\.[a-zA-Z0-9_]+ RC=\d+ Dur=\d+.\d{6}
Replace: SQL---------------
RegEx Pattern for PeopleCode:
Find: ^[a-z]{8}\.\d+ +\(\d+\) +\t +\d+-\d+ +\d{2}\.\d{2}\.\d{2} +\d+.\d{6}
Replace: PeopleCode--------
Benefits of Regex Pattern Matching Find/Replace During Comparative Analysis:
Now, if we remove all the unnecessary information and then compare, we would be able to determine the differences quickly and easily. Here is an example of how I used the RegEx Find/Replace (detailed above) and then compared two different trace files using WinMerge.
Similarly, we can use Regex Pattern Matching to intelligently find and replace specific portions of the trace/log files to improve readability!