Log files for Nested scripts

How do i Log information to a common File when running nested scripts from a master script ?

Comments

  • JonathanOSXJonathanOSX ForumAdmin admin
    Normally in a Master script you want to have each script generate it's own Result file then so you call it using RunWithNewResults.

    If you call another script (using the Run statement) then those actions will be logged in the result for the script that called it. On drawback to that is that if one script fails they will all fail. If you want to trap potential errors in the master script then you can use a TRY...CATCH...END TRY structure to trap and report errors.
  • Thanks for the Information on the Log Files.

    Can you tell me how to update the "NumberOfFails" value from within the Script. Trying to get Jenkins to realize an error has occurred.


    <statistics><script>
    <LastStatus>Success</LastStatus>
    <NumberOfRuns>1</NumberOfRuns>
    <NumberOfFails>0</NumberOfFails>
    <FirstRun>2013-06-21 13:53:03 -0400</FirstRun>
    <LastRun>2013-06-21 13:53:03 -0400</LastRun> <TotalTimeOnSuccess>0.038000</TotalTimeOnSuccess>
    </script></statistics>
  • JonathanOSXJonathanOSX ForumAdmin admin
    You don't set it directly, but anytime you use the LogError command it will increment it by 1. It will also increment by 1 if an exception is raised and not caught causing the script to end (e.g. an ImageNotFound error occurs)

    If the script finishes and and the error count is at least 1 then the process will return an error code > 0 and Jenkins will recognize that as a failure.
Sign In or Register to comment.