Skip to main content

Logging Antipatterns

(Compiled from AWS, Azure, Google and and other community sources)

The following are antipatterns to avoid:

Avoid

  • Too much logging:
    • Over-logging can cause performance issues and overwhelm your logging systems. Only log the information that is necessary for debugging and analysis.
  • Inconsistent logging:
    • Make sure that log messages follow a consistent format and structure, so they can be easily parsed and analyzed.
  • Not logging enough:
    • Insufficient logging can make it difficult to identify and diagnose issues when they occur.
  • Hard-coded logging:
    • Avoid hard-coding log messages and use parameterized logging instead. This makes log messages more flexible and easier to manage.
  • Not logging errors:
    • Failing to log errors can make it difficult to identify and diagnose issues when they occur. Make sure that all errors are logged with as much context as possible.
  • Not correlating logs:
    • Correlating logs across multiple systems and services is essential for identifying issues and understanding the full picture.
  • Over-reliance on logging:
    • Logging is a useful tool, but it should not be the only way to monitor and debug your system. Make sure that you have other tools and strategies in place as well.
  • Not monitoring logging systems:
    • Monitoring your logging systems is critical to ensuring that they are working properly and can handle the load.
  • Inefficient logging:
    • Inefficient logging practices, such as logging to a database or remote service, can cause performance issues and impact the overall performance of your system.
  • Not setting log levels correctly:
    • Setting log levels correctly is essential for managing the volume of log messages and ensuring that the appropriate level of detail is being logged. Make sure that you are setting log levels appropriately for each message.
  • Logging sensitive information:
    • Avoid logging sensitive information, such as passwords, credit card numbers, or personally identifiable information (PII).
  • Secrets:
    • Avoid logging secrets, such as API keys, access tokens, or passwords.
  • Passwords:
    • Avoid logging passwords, as this can compromise the security of your system.
  • PII:
    • Avoid logging personally identifiable information (PII), such as names, addresses, or phone numbers.
  • User data:
    • Avoid logging user data, such as names, addresses, or phone numbers.