Previous Next

Thread: Capturing logparser exit codes

Last post 08-11-2008 6:36 AM by pas30339. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 07-31-2008, 8:33 AM

    • pas30339
    • Not Ranked
    • Joined on 10-20-2007, 12:18 PM
    • Posts 7
    • pas30339

    Capturing logparser exit codes

    When running Logparser 2.2 programatically is there any way to capture exit codes?

  • 07-31-2008, 2:55 PM In reply to

    • joelangley
    • Top 50 Contributor
    • Joined on 07-20-2008, 2:37 PM
    • Posts 82
    • joelangley

    Re: Capturing logparser exit codes

    I am not sure I understand the question...what exactly do you want to do? 

  • 07-31-2008, 4:28 PM In reply to

    • pas30339
    • Not Ranked
    • Joined on 10-20-2007, 12:18 PM
    • Posts 7
    • pas30339

    Re: Capturing logparser exit codes

    We have an application will be running logparser.exe (not the COM dll) nightly and inserting records in to an SQL server table and we want to trap exit codes to determine if any errors occur in the running of LP so we can have the application automatically try and run LP again should it fail.

  • 07-31-2008, 7:33 PM In reply to

    • yellowdog.dave
    • Top 50 Contributor
    • Joined on 07-18-2008, 3:17 AM
    • Johannesburg, South Africa
    • Posts 51
    • yellowdog.dave

    Re: Capturing logparser exit codes

    Hi, 

    When running from the command line, just use the ERRORLEVEL: variable and exit with the value of the return code of the previous statment; 

    Therefore if you have a batch file that looks like this;

    @echo off
    echo Here is a test
    logparser "select 'Twit' from *.*" -i:fs -q
    exit %ERRORLEVEL%


    You will get an exit code of 0.

    If you have a batch file that looks like this

    echo Here is a bad test
    logparser "This is an error"
    exit %ERRORLEVEL%

    You will get an exit code of 1615. 

    Just note that if there is no data you will also get valid error codes - you may want to refer to the documentation for further info. 

    Hope this helps, good luck.

    Cheers, Dave 

    Yes, dear
  • 08-10-2008, 5:00 PM In reply to

    • joelangley
    • Top 50 Contributor
    • Joined on 07-20-2008, 2:37 PM
    • Posts 82
    • joelangley

    Re: Capturing logparser exit codes

     Just curious if this worked for you.

  • 08-11-2008, 6:36 AM In reply to

    • pas30339
    • Not Ranked
    • Joined on 10-20-2007, 12:18 PM
    • Posts 7
    • pas30339

    Re: Capturing logparser exit codes

     Yes.  This worked for me and was exactly what I was looking for.

Page 1 of 1 (6 items)
Page view counter