If sensitive data is written to a log entry it could be exposed to an attacker who gains access to the logs.

Potential attackers can obtain sensitive user data when the log output is displayed. Additionally that data may expose system information such as full path names, system information, and sometimes usernames and passwords.

Sensitive data should not be logged.

In the example the entire process environment is logged using `print`. Regular users of the production deployed application should not have access to this much information about the environment configuration.

In the second example the data that is logged is not sensitive.

  • OWASP: Insertion of Sensitive Information into Log File.