Archive for July, 2008
License
After years of blogging I finally picked a license.

Zeljko Filipin’s Blog on Software Testing by Zeljko Filipin is licensed under a Creative Commons Attribution 3.0 Croatia License.
Get rid Of “Press a key…” While Using Log Parser
As I said before, I use Log Parser a lot.
One thing that really annoyed me is Press a key... that would appear after each screen of results.
C:\>LogParser "SELECT text FROM errors.log"
[...]
Press a key...
[...]
It took me some time to get rid of it, so maybe this helps somebody. Use -rtp:-1 switch and there will be no more Press a key...
C:\>LogParser -rtp:-1 "SELECT text FROM errors.log"
Log Parser and Batch Files
I am using Log Parser to parse log files. I parse a lot of files and I wanted to make a batch file that will do it for me.
I pasted my commands to a batch file, executed it, and to my surprise, it would parse the files but would not find anything.
This is content of my batch file:
LogParser "SELECT text FROM errors.log WHERE text LIKE '2008-%'"
When I execute it, it does not find anything:
C:\>parse_logs.cmd
C:\>LogParser "SELECT text FROM errors.log WHERE text LIKE '2008-'"
Statistics:
-----------
Elements processed: 34
Elements output: 0
Execution time: 0.02 seconds
When I executed the command from command prompt, Log Parser would find what I was looking for:
C:\>LogParser "SELECT text FROM errors.log WHERE text LIKE '2008-%'"
Statistics:
-----------
Elements processed: 34
Elements output: 24
Execution time: 0.02 seconds
I looked around, asked a few people but no luck.
I finally found the problem.
There is % in Log Parser SQL query:
LIKE '2008-%'
% represents variable in batch file, and if you take a closer look how batch file gets executed you will see that
LIKE '2008-%'
is executed as
LIKE '2008-'
I changed batch file to
LIKE '2008-%%'
and now it works.
