error handling for logs