Changed exception handling in logData