Skip to main content

Logging

In Turkish
Loglama
Updated 3 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/logging

In short

Logging is the practice of recording timestamped messages about events in a running program, such as errors and requests, so people can investigate them later.

What is logging?

Logging means having a program write down what it is doing as it runs. Each log entry records one event, for example a request received, a payment failed, or a job finished, along with a timestamp, a severity level, and useful details. Logs are the first place developers look when something goes wrong, because they show what happened and in what order.

Applications write logs through a logging library rather than plain print statements, so that every entry gets a consistent format and a level such as DEBUG, INFO, WARN, or ERROR, and noisy levels can be turned off in production. Modern systems prefer structured logging, where each entry is a JSON object with named fields like userId and durationMs, which makes logs easy for machines to search and filter. In containers, applications usually write logs to standard output, and a log collector ships them to a central store where logs from every server can be searched together.

A log is like a ship's logbook or a flight recorder: an ordered, written history of events that investigators can replay after the fact. Logs are used for debugging, auditing who did what, security investigations, and alerting on specific errors. Good logs include enough context to be useful, such as request IDs, but never secrets, passwords, or unnecessary personal data, which create security and privacy problems.

Logging is often confused with metrics and distributed tracing, the other two pillars of observability. A log describes one individual event in detail, a metric is a number aggregated over time, such as errors per minute, and a trace follows one request across many services. Logs are the most detailed signal but also the most expensive to store at scale, so teams often rely on metrics for trends and on logs for investigation.

Key takeaways

  • Logging records timestamped events from a running program for later investigation.
  • Log levels such as DEBUG, INFO, WARN, and ERROR indicate severity and control volume.
  • Structured logging writes entries as JSON with named fields, which makes them easy to query.
  • Central log collection lets teams search logs from many servers in one place.
  • Never write passwords, tokens, or other secrets to logs.

Example

Log levels with Python's standard logging modulepython
import logging

logging.basicConfig(
    level=logging.INFO,  # DEBUG messages are dropped at this level
    format="%(asctime)s %(levelname)s %(name)s %(message)s",
)
log = logging.getLogger("checkout")

log.debug("Cart contents: %s", cart)  # not written
log.info("Payment accepted for order %s", order_id)
log.warning("Payment retry %d for order %s", attempt, order_id)
log.error("Payment failed for order %s", order_id, exc_info=True)

# 2026-09-30 14:02:11,512 INFO checkout Payment accepted for order A-1042

Readers ask

What are log levels?

Log levels label how important a message is, commonly DEBUG, INFO, WARN, ERROR, and sometimes FATAL. A program is configured with a minimum level, so detailed debug messages can be shown during development and hidden in production.

What is structured logging?

Structured logging writes each log entry as data with named fields, usually JSON, instead of free-form text. This lets log tools filter and aggregate entries, for example finding every error for one orderId, without fragile text parsing.

What is the difference between logs and metrics?

A log records a single event with its details, such as one failed payment and its error message. A metric is a number measured over time, such as the count of failed payments per minute, which is cheaper to store and better suited to dashboards and alerts.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings