Eight Node.js logging libraries compared: Pino, Winston, and more

Compare eight Node.js loggers by output, routing, and collection. Choose a logger for JSON application events, multiple destinations, CLI output, or Express access logs.

Best practices
Illustration of log collection, processing, and querying

The choice of Node.js logger shows up in the shape of a production log. Can you filter errors by request ID? Does a stack trace arrive as one record? If the service writes to both a file and the console, can those destinations use different levels?

Start with Pino if the application mainly needs structured JSON, or Winston if each destination needs its own format and level. Signale addresses terminal output, while Morgan records HTTP requests in Express. This comparison uses each project's documented behavior and package release history.

Eight Node.js logging libraries at a glance

Library Typical output Where it fits What to check
Pino JSON records Production applications and APIs Serialization runs at the call site. A configured worker transport can handle downstream processing.
Winston Configurable by transport and format Applications with several log destinations Rotation and exception handlers need explicit setup.
Log4js-node Layout-dependent records, commonly text Teams routing logs by category Set a JSON-compatible output format explicitly.
Bunyan JSON records Existing Bunyan services npm's latest release is old. Check runtime and maintenance requirements.
Roarr JSON records Application and library logging Node.js output must be enabled. Browsers use a writer callback.
Signale Human-readable terminal output CLI tools and scripts Interactive display is designed for a terminal session.
Tracer Template-formatted text Debugging with caller details File and line placeholders help locate the call.
Morgan Preset or custom request lines Express access logging Application events still need their own logging path.

Pino for JSON application logs

Pino writes JSON by default. Child loggers can carry fields such as a request ID into subsequent calls, error serializers can preserve a stack, and redact removes or masks configured paths. Fastify uses Pino for its built-in logger once logging is enabled.

When a service uses a worker transport, the calling thread still constructs and serializes the log record. The worker handles the configured transport work. Default records omit source file and line details for individual calls. If those details matter, account for the cost of collecting them when comparing configurations.

Winston for destination-specific routing

Winston separates levels, formats, and transports. A service can send readable info logs to the console and write JSON from error onward to a file. A remote destination needs its own compatible transport.

Configure rotation through the separate winston-daily-rotate-file transport when the application owns the files. Set timestamp and error formats explicitly and inspect the serialized stack. Add the documented exception or rejection handlers if you need those events captured.

Log4js-node for categories and appenders

Log4js-node keeps the Log4j-style split between categories and appenders. Categories assign levels and select destinations. Appenders control where records go, and layouts control their representation. That model fits services which send, for example, audit and application output down different paths. Common layouts produce text. Use a custom or compatible third-party layout for JSON and check the fields it emits.

Bunyan in existing services

Bunyan writes structured JSON and provides child loggers and error serializers. Its CLI can format records or show errors and higher levels. On a Unix-like shell, with Bunyan installed in the project:

node app.js | ./node_modules/.bin/bunyan -l error

As of November 6, 2026, npm's latest tag pointed to Bunyan 1.8.15, released in January 2021. That publication date is a reason to check runtime compatibility and the maintenance you would have to own. Existing services can weigh those risks against the cost of changing field mappings and alerts.

Roarr for libraries and application context

Roarr can be imported directly in Node.js or a browser. Node.js output is disabled until ROARR_LOG=true is set, then records go to stdout. In a browser, configure ROARR.write to receive records. On Node.js, adopt() can add context to logging within its asynchronous callback scope. That lets a library attach its own details while the host application decides how to handle output.

Signale for a terminal interface

Signale gives scripts colored messages, an interactive mode that updates the display, and timers through time() and timeEnd(). Its secrets option masks explicitly configured values. Use that as a narrow filter and keep secrets out of the log inputs. Human-readable output fits a CLI progress display. If a background job also needs machine-readable events, give them a structured output path.

Tracer for file and line details

Tracer adds levels, timestamps, and caller information to console-style output. A format with {{file}}:{{line}} gives you a source location, and a custom transport callback lets you redirect output. Its templates are useful for debugging. Decide which fields to carry separately if production searches need structured request context.

Morgan for Express access logs

Morgan uses presets such as Apache combined and custom tokens to emit request lines with the fields you select. :response-time measures until response headers are written, while :total-time measures until the response finishes. A streamed response can therefore have different values for the two.

For a service that already has an application logger, Morgan can send request lines to a configured stream while that logger handles business events and errors. Check whether the framework already emits access logs before adding a second middleware. The Morgan logging guide covers request IDs and JSON output.

Make the choice at the output boundary

  1. For Express access logs, start with Morgan and decide where its request lines should go.
  2. For a CLI's progress and results, start with Signale.
  3. For a busy API that writes JSON to a collected stream, start with Pino.
  4. For per-destination filtering, formatting, or application-managed rotation, start with Winston and configure the relevant transports.
  5. For an application already organized around logging categories, consider Log4js-node.

Collect and check the logs in Guance

Keep three representative records from the application: a normal event, a request log, and an exception with a stack. With DataKit file collection, confirm the configured path is readable and the source matches the intended records. For container stdout or stderr, check the container collection settings, runtime access, and filters. A plain-text stack may need multiline grouping before field parsing.

Then use the applicable Guance Pipeline to extract fields and confirm event time, severity, and request identifiers. A change from Pino to Winston can change the representation of level and errors. An old query can keep running while returning fewer matches. Recheck the queries and error monitors against the new output before relying on them.

The choice in practice

Use an application logger for the application's own events and add access logging if you need request-level records. Prefer the output shape your collector can reliably read and your queries can consistently interpret.

Frequently asked questions

How much faster is Pino than Winston?
Pino's published benchmarks reflect the versions, messages, and configuration used there. To decide whether logging affects your service, compare the same payloads, level settings, and destinations. Include redaction, backpressure, and request latency if those are material to the service.

Should an existing Bunyan application migrate?
Check the Node.js upgrade plan, the package's maintenance posture, and how much existing tooling depends on its fields. If you migrate, keep downstream queries and alerts working by mapping levels, timestamps, and error stacks deliberately.

Can Morgan replace Winston?
Morgan records the HTTP request lifecycle in Express. Use an application logger for domain events and errors. A Morgan stream.write adapter can pass request lines to that logger if you want a shared destination.

Can I collect the output of all eight in Guance?
You can ingest their output when it reaches a supported source DataKit can read. Use JSON extraction or a Grok rule that matches the text, and configure grouping for multiline records where needed. Interactive terminal displays and browser callbacks need a separate collectable output path.

Further reading: Pino in Node.js · Choosing a logging framework (Chinese)

Guance docs: DataKit logging overview · Log Explorer · 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