Log levels explained, from FATAL to TRACE

Choose levels based on the outcome, check which APIs exit the process, and normalize severity for log searches and alerts.

Best practices
Illustration of logs, metrics, and traces

The checkout service calls inventory and the first attempt times out. The retry succeeds, and the customer completes checkout. That timeout is worth recording, but a failed attempt and a failed checkout answer different questions. If the retry budget runs out and checkout cannot continue, record the failed operation with enough context to find the request.

A log level describes the severity or diagnostic detail of an event. It also gives the logger and its output handlers a way to filter events. Choose the level from what happened at the point you are logging, then check how the library and collector interpret it.

Assign the level where you know the outcome

Common level Example in the checkout service
FATAL Startup cannot proceed because required configuration is invalid.
ERROR Inventory remains unavailable after retries, and checkout fails.
WARN The first inventory attempt timed out, and a retry recovered the operation.
INFO The service started or a reconciliation job completed.
DEBUG Record the retry decision and timing for a bounded investigation.
TRACE Follow each instrumented branch of a retry loop when the framework supports that level.

The table is a working convention for teams that use these six names. For a frequently recovered timeout, counting retries in a metric may be more useful than writing a warning for every attempt. When a request fails, log the final result at the layer that knows the outcome. Recording an ERROR at each layer can turn one customer-visible failure into several error records. Include the service, operation and request or trace identifier. Attach exception details when they help explain the failure, and keep credentials and payloads out of diagnostic fields. An INFO milestone confirms that one event happened. Service health still depends on the rest of the request path.

Check whether the logging call exits

Log4j 2 defines six ordinary event levels from FATAL to TRACE. Python's standard logging uses CRITICAL at the top of its standard event levels, treats FATAL as an alias, and has no built-in TRACE level. Loguru defines TRACE and SUCCESS alongside its other levels. Check the actual library before writing a threshold or a query. Log4j 2 levels · Python logging levels · Loguru levels

The name FATAL alone tells you little about what the call does to the process. Python's logging.fatal() delegates to critical(). Go's standard log.Fatal() logs and calls os.Exit(1). Pino's fatal() is intended for a final message and attempts a synchronous flush when the level is enabled and the destination provides flushSync(). Application code still controls whether the process exits. Check the specific API when you want to log a startup failure or a recoverable request error. Go log · Pino fatal

Follow the event through each filter

With the usual INFO threshold in Log4j 2, INFO, WARN, ERROR and FATAL can pass the level check. An appender or a later filter may still discard an event. If a DEBUG record is missing, check the logger and destination thresholds before debugging ingestion. A collector cannot recover a record the application never emitted.

When the normal logs omit a timing detail, open DEBUG or TRACE for the affected module or instance and set an end time. Check the sink and collector as well, since their filters can remain unchanged. The extra detail helps only if it reaches the investigation and excludes sensitive values. Change log levels at runtime

Normalize the level without losing the source

A number is meaningful within its own format. RFC 5424 syslog severity runs from 0 for Emergency to 7 for Debug. OpenTelemetry's normalized SeverityNumber increases with severity. Its WARN range is 13–16, and SeverityText can carry the original label. A syslog Warning value of 4 and an OpenTelemetry value of 4 have different meanings, so apply a source-specific mapping before filtering across systems. RFC 5424 severity · OpenTelemetry log data model

For example, a Pipeline that maps the checkout application's WARN to Guance's warning could produce this record. It retains the original label in a separate field.

{"service":"checkout","operation":"check_inventory","outcome":"recovered","level":"WARN","status":"warning"}

The DataKit log collector reference lists info when no status is extracted and groups trace and verbose under debug for display. The general DataKit collection guide describes an unknown fallback. Send a warning and a record with no level through the actual collection path, then inspect their stored status values before building a detector. If a source uses a label such as SECURITY to describe what kind of event it is, keep that classification alongside its severity so both remain searchable.

In Guance Log Explorer, filter by the normalized status and service to see which records the detector would count. Repeated recoveries can justify tracking a retry trend, while failed checkouts may call for a different threshold and notification route. Compare failed checkout counts with traffic or a service-level objective before treating a spike in error logs as customer impact. Guance Log Detection · Log monitoring

Get a tailored plan

Contact us

Join the community

Scan with WeChat
to join the community

Try Guance

Start online and pay only for what you use.

Get started

Choose a Guance plan

Code hosting