Logger prints correct message to console if exception thrown when logging to DB.