Logging sensitive information like credit card numbers during exceptions is a serious security violation. It creates insecure storage of PII (Personally Identifiable Information) and PCI DSS protected data in log files, which are often less protected than the main application database. This can lead to data breaches and compliance violations. The correct approach is to log that an error occurred without including the actual sensitive data.