Correct log trace for failed script execution.

The function needs to be wrapped by a newLogClosure for the logger to be
able to log it.