Skip to main content

How to implement Logging in Sentry

Issue

I need to stream logs from my applications to monitor and archive overall behavior and higher-risk processes. I am not only debugging errors, and I want a Sentry-supported way to do this.

Applies To

  • All SaaS Customers and Self-Hosted Users

  • Logging

Resolution

Use Sentry Structured Logs. Structured Logs let you send searchable, trace-connected log data to Sentry and view it alongside errors and traces, without turning every message into an Issue.

To send application logs:

  1. Open the Logs set up guide and select your SDK.

  2. Enable Logs in your SDK initialization. In many SDKs this is enableLogs: true or an equivalent option. See the Logs docs for your platform.

  3. Send logs with your SDK’s logger API (for example Sentry.logger.info in JavaScript).

    Sentry.init({
    dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
    enableLogs: true,
    });

    Sentry.logger.info("Checkout completed", { orderId: "order_456" });
  4. Open Logs in Sentry to search, filter, and inspect those entries. For product behavior, see the Logs documentation.

Logs count toward your Logs volume, not your error quota. For pricing and included volume, see What is the pricing for Sentry Logs? and the Logs pricing docs.

If you cannot install a Sentry SDK, or you want to forward platform logs, use log drains or Sentry’s OTLP logs path.

If you need an Issue instead of a log entry:

Use captureMessage. The message appears in Issues (often with level:info) and counts toward your reserved errors. Prefer Structured Logs when you want an archive of process activity without creating Issues.

If you only need to know that a scheduled job ran:

Use Cron Monitoring. Crons track check-in frequency and failures. They do not store an application log archive.

Did this answer your question?