Computing.Net > Forums > Windows XP > Processing logfiles, commandline

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Processing logfiles, commandline

Reply to Message Icon

Name: ikerstges
Date: August 4, 2008 at 05:59:31 Pacific
OS: Windows XP Professional
CPU/Ram: Core2Duo/1024Mb
Product: HP
Comment:

Hi All,

I'm monitoring log files of testcases. The logfile always contains a last line where the status is reported (successful/NOT successful). I'm able to find these status reports with following commandline script:

For /F "tokens=*" %%A in ('Dir /B /A:-D %1') Do (
type %%~fA | find "INFO - Testcase was successful!" >> D:\scripts\splitfiles\logs\temp\successful.txt
For /F "tokens=*" %%A in ('Dir /B /A:-D %1') Do (
type %%~fA | find "INFO - Testcase was NOT successful!" >> D:\scripts\splitfiles\logs\temp\not_successful.txt

But now my question:

How can I find the last 2 ERROR lines in my logfile?

Here is an example of my last logfile:

04 Aug 2008, 11:24:06 ERROR - Assertion failed param1: 1 matching "MercuryTest_21588" param2: No matches assertionType: CONTAINS
04 Aug 2008, 11:24:06 INFO - Condition was false
04 Aug 2008, 11:24:29 INFO - ***** Executing Step: Step 3 *****
04 Aug 2008, 11:24:31 INFO - Loaded URL: http://test.wap.xxxxxx.com/xxxxxxxx... successfully
04 Aug 2008, 11:24:31 ERROR - Failed at Step 3: field 1 - 2 (MercuryTest_21588) not found(Control type: [link] Criteria: [.text] Criteria value: [1 - 2 (MercuryTest_21588)])
04 Aug 2008, 11:24:31 ERROR - Failed at Step 3: field not found(Control type: [link] Criteria: [.text] Criteria value: [1 - 2 (MercuryTest_21588)])
04 Aug 2008, 11:24:31 INFO - ***** Executing Step: Reset Promos *****
04 Aug 2008, 11:24:31 INFO - start call of sequence: WAP:xxxxCommons.ResetAllPromotionAreas
04 Aug 2008, 11:24:31 INFO - start call of sequence: WAP:xxxxCommons.SchedulePromotion
04 Aug 2008, 11:24:33 INFO - Loaded URL: http://test.xxxxxxxx.xxxx.com/defau... successfully
04 Aug 2008, 11:25:04 INFO - Useragent set to IE6
04 Aug 2008, 11:25:04 INFO - Loaded standard security configuration
04 Aug 2008, 11:25:04 INFO - Testcase was NOT successful!

I'm only interested in the last two ERROR lines, I want to pipe the contents of these to the "not_successfull.txt" but I cannot find how to achieve that?

Any help will be greatly appreciated!


Thanks in advance!
Igor



Sponsored Link
Ads by Google

Response Number 1
Name: Ed in Texas.
Date: August 5, 2008 at 00:31:44 Pacific
Reply:

Igor, just a guess, dunno for sure. Seems to me you could just define a variable to be the last two and update it at each test. Normally ignored, the variable could then be echoed or printed out if the test fails?
HTH.
Ed in Texas.


0
Reply to Message Icon

Related Posts

See More


caps and spaces appear at... Show Folder Name.



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Processing logfiles, commandline

Task Manager Processes www.computing.net/answers/windows-xp/task-manager-processes/88061.html

Problematic processes www.computing.net/answers/windows-xp/problematic-processes/102102.html

explorer process @ 100% all the tim www.computing.net/answers/windows-xp/explorer-process-100-all-the-tim/95088.html