SSP-1540 Add guard against NPE and redirect error messages to log file