A log is like a system's record book. Whenever something happens, for example a user logs in, a request meets an error or a service starts, a line with the exact time and details is recorded in a file or system.

An example of a log line#

Time, severity level, source and message: "14:03:21 ERROR database connection failed". From this one line you learn what the problem was, at what moment, and in which part it happened.

Common levels#

  • DEBUG: technical details for the developer
  • INFO: normal events
  • WARNING: a warning, not yet broken
  • ERROR: a real error
  • CRITICAL: a critical error needing immediate action

Why does it matter?#

  • Finding the cause of an error that happens only occasionally
  • Investigating an attack or suspicious login
  • Counting traffic and user behavior
  • Compliance with legal record-keeping requirements

Example#

Your WordPress site shows a white screen. Instead of guessing, you open the host's PHP error log and see that a plugin stopped with a memory error or an incompatible version.

Notes#

  • Rotate logs and plan the deletion of old ones, or the disk fills up.
  • Don't write passwords, card numbers or sensitive information to logs.
  • In large systems, gather logs in one central place so searching is easy.
  • When asking others for help, for example an AI assistant, remove sensitive information from logs before sending them.