Made captured logs to appear only when there is an error.