KBEC-00242 - Add script to a step to save a log to a unique separate log file

Article ID:360033192011
1 minute readKnowledge base
On this page

Summary

When debugging an intermittent error, it is difficult to to track it using the default logs only. For an intermittent error, you can put a debug log script inside a step and then keep record the errors in a separate unique log file.

Solution

Perhaps there is a problem talking to the server and you receive an empty response (or an HTTP error) from the server.

To track this down, you could do one of the following:

  • You can put the following into a step command to query the $ec object to see if there’s an error:

    my $errMsg = $ec->getError();
    print $errMsg . "\n";
  • Turn on debug logging on the ec object during initialization:

    $ec = new ElectricCommander({debug => 1, logFile => 'waitForJob.$[ec:jobStepId].log'});

The reason for including jobStepId in the file name is that if this step is invoked multiple times in the job, each invocation’s debug output will go to a unique log file.

Applies to

Product versions:

4.2.x

OS versions:

All