> ## Documentation Index
> Fetch the complete documentation index at: https://docs.logbrew.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Error log: what it is, where to find it, and error tracking

> Learn what an error log is, find the error log on macOS, Linux, Windows, Apache, Nginx, and PHP, and see when an error belongs in a log or in error tracking.

LogBrew is an observability platform for developers and coding agents, with a
generous free tier and no card needed.

An error log is a record of the errors that an application, a server, or an
operating system writes while it runs. Each entry has a time, a severity level,
and a message. Many entries also have a stack trace. This PHP 8.5 error log
entry is from a real run:

```text theme={"theme":"css-variables"}
[26-Nov-2026 08:25:26 UTC] PHP Fatal error:  Uncaught DivisionByZeroError: Division by zero in Command line code:1
Stack trace:
#0 Command line code(1): intdiv(1, 0)
#1 {main}
  thrown in Command line code on line 1
```

## Where to find the error log

| System | Error log location |
| - | - |
| macOS | Unified log. Open the Console app, or use the `log` command. |
| Linux with systemd | The systemd journal. |
| Windows | Event Viewer, then **Windows Logs** > **Application** or **System**. |
| Apache HTTP Server | The `ErrorLog` directive. The default is `logs/error_log` in the server root. Debian and Ubuntu use `/var/log/apache2/error.log`. |
| Nginx | The `error_log` directive. Linux packages use `/var/log/nginx/error.log`. Homebrew uses `/opt/homebrew/var/log/nginx/error.log`. |
| PHP | The `error_log` setting. When it has no value, PHP writes to the web server error log, or to standard error in the CLI. |

Use these commands to read the errors, or to print where the log is:

```bash theme={"theme":"css-variables"}
# macOS
/usr/bin/log show --last 1h --predicate 'messageType == error' --style compact
# Linux with systemd
journalctl -p err -b
# Windows PowerShell
Get-WinEvent -FilterHashtable @{LogName='Application'; Level=2} -MaxEvents 20
# Apache, Nginx, and PHP: print the error log setting
httpd -V | grep DEFAULT_ERRORLOG
nginx -V 2>&1 | tr ' ' '\n' | grep error-log-path
php -i | grep '^error_log '
```

On macOS 27.2, the `log` command gives 1 line for each error:

```text theme={"theme":"css-variables"}
Timestamp               Ty Process[PID:TID]
2026-11-26 11:23:28.876 E  analyticsagent[50921:442060d] [com.apple.analyticsagent:query] [BluetoothStatusQuery] No controller info. Returning unknown
```

## Error logs and error tracking

An error log keeps 1 entry for each error. Error tracking groups errors with
the same cause into 1 issue, and counts each new error as an occurrence of that
issue.

| | Error log | Error tracking |
| - | - | - |
| 1 record | 1 line for each error | 1 issue for each cause |
| The same error 3 times | 3 lines | 1 issue with 3 occurrences |
| Stack trace | Only when the logger writes it | Parsed into frames |
| Release and environment | Only when you add them | Stored on each occurrence |
| Status | None | `unresolved`, `resolved`, or `archived` |
| Alerts | You write a search or a count | Alerts for new and regressed issues |

You need both. The log tells you what happened in 1 request. The issue tells
you how often the same failure happens, since when, and in which release.

## When to log an error and when to report an issue

* Log the error when your code handles the failure. Examples are a retry, a
  fallback, or a `503` response that asks the client to try again.
* Report an issue when the failure is a bug. An example is an exception that
  your code does not catch.
* Do not report a `4xx` client error as an issue. It describes a bad request,
  not a failure in your code. The LogBrew Node.js SDK follows this rule by
  default.

## Test it: 6 error logs and 1 issue

This test sends logs and errors from a Node.js server to LogBrew. It ran on
2026-11-26 with Node.js 22.18, Pino 10.4, `@logbrew/node` 0.1.30, and
`@logbrew/sdk` 0.1.48.

**1. Save the server as checkout.js**

The `/retry-later` route handles the failure and writes an error log. The
`/checkout` route throws an error that the code does not catch.

```js theme={"theme":"css-variables"}
import { createServer } from "node:http";
import pino from "pino";
import {
  createLogBrewNodeClient,
  installLogBrewPinoInstrumentation,
  withLogBrewHttpHandler
} from "@logbrew/node";

const client = createLogBrewNodeClient();
installLogBrewPinoInstrumentation({ client });
const logger = pino({ level: "info" });

class CardDeclinedError extends Error {
  name = "CardDeclinedError";
}

const server = createServer(withLogBrewHttpHandler((req, res) => {
  const url = new URL(req.url, "http://localhost");
  const orderId = url.searchParams.get("order");
  logger.info({ orderId }, "order created");
  logger.warn({ orderId, attempt: 2 }, "payment retry");
  if (url.pathname === "/retry-later") {
    logger.error({ orderId, reason: "provider_timeout" }, "payment failed");
    res.statusCode = 503;
    res.end("try again later");
    return;
  }
  throw new CardDeclinedError("card declined by the payment provider");
}, { client }));

await new Promise((resolve) => server.listen(0, resolve));
const base = `http://127.0.0.1:${server.address().port}`;
const runs = Number(process.argv[2] ?? 1);
for (let i = 1; i <= runs; i++) {
  const handled = await fetch(`${base}/retry-later?order=ord_10${i}0`);
  const crashed = await fetch(`${base}/checkout?order=ord_10${i}1`);
  console.log(`run ${i}: /retry-later ${handled.status}, /checkout ${crashed.status}`);
}
server.close();
await client.shutdown();
```

**2. Set the key and run the server**

Use the ingest key of your project. See
[Node.js logging](https://docs.logbrew.co/guides/node-logging.md) to create it. Run the server 1 time
with release `checkout-api@2.4.0`. Then run it again with release
`checkout-api@2.6.0`.

```bash theme={"theme":"css-variables"}
npm install @logbrew/node @logbrew/sdk pino
export LOGBREW_SERVER_API_KEY="<ingest_key>"
export LOGBREW_SERVICE_NAME="checkout-api"
export LOGBREW_ENVIRONMENT="production"
LOGBREW_RELEASE="checkout-api@2.4.0" node checkout.js 3
LOGBREW_RELEASE="checkout-api@2.6.0" node checkout.js 3
```

Each run prints the same 3 lines:

```text theme={"theme":"css-variables"}
run 1: /retry-later 503, /checkout 500
run 2: /retry-later 503, /checkout 500
run 3: /retry-later 503, /checkout 500
```

**3. Read the error logs**

```bash theme={"theme":"css-variables"}
logbrew read logs --severity error --release checkout-api@2.6.0 --since 1h --json
```

Each run stored 15 logs: 6 `info`, 6 `warning`, and 3 `error`. This command
returns the 3 `error` logs of the second run. Each one has its own trace
ID. This is 1 of them, shortened:

```json theme={"theme":"css-variables"}
{
  "level": "error",
  "source": "pino",
  "message": "payment failed",
  "occurred_at": "2026-11-26T08:27:53.315Z",
  "release": "checkout-api@2.6.0",
  "service_name": "checkout-api",
  "trace_id": "<trace_id>",
  "attributes": {
    "metadata": {
      "context.orderId": "ord_1010",
      "context.reason": "provider_timeout",
      "pinoLevel": "error",
      "pinoLevelNumber": 50
    }
  }
}
```

The 6 `error` logs of the 2 runs did not open an issue. LogBrew opens
issues from errors that the SDK reports, not from the level of a log.

**4. Read the issue**

```bash theme={"theme":"css-variables"}
logbrew read issues --release checkout-api@2.6.0 --since 1h --json
```

The 6 uncaught errors of the 2 runs made 1 issue with 6 occurrences. The
new release did not open a new issue. `first_seen_at` is from the first
run, and `release` is the release of the last occurrence. This is the
issue, shortened:

```json theme={"theme":"css-variables"}
{
  "id": "<issue_id>",
  "title": "GET /checkout failed",
  "message": "card declined by the payment provider",
  "fingerprint": "node.http:CardDeclinedError:checkout.js",
  "severity": "error",
  "status": "unresolved",
  "occurrence_count": 6,
  "first_seen_at": "2026-11-26T08:23:30.981Z",
  "last_seen_at": "2026-11-26T08:27:54.388Z",
  "release": "checkout-api@2.6.0",
  "trace_id": "<trace_id>",
  "diagnostics": {
    "breadcrumbs": [
      {"category": "log.pino", "level": "info", "message": "order created", "timestamp": "2026-11-26T08:27:54.388Z", "type": "debug"},
      {"category": "log.pino", "level": "warning", "message": "payment retry", "timestamp": "2026-11-26T08:27:54.388Z", "type": "debug"}
    ],
    "exception": {"mechanism": {"handled": false, "type": "node.http"}, "type": "CardDeclinedError"}
  }
}
```

The fingerprint has 3 parts: the capture source, the error type, and the
file of the top stack frame. Errors with the same fingerprint go into the
same issue.

**5. Read the logs of the failed request**

```bash theme={"theme":"css-variables"}
logbrew read logs --trace "<trace_id>" --since 1h --json
```

The command returns the 2 logs that the last `/checkout` request wrote
before the error: `order created` and `payment retry`.

## How LogBrew connects logs and issues

* **Breadcrumbs.** The logs that a request writes before an error go into
  `diagnostics.breadcrumbs` of the occurrence. Only the logs of the same
  request go in.
* **Trace ID.** Each occurrence keeps the trace ID of its request. Use it with
  `logbrew read logs --trace` to read all logs of that request.
* **Release and environment.** Logs and issues use the same `release` and
  `environment` filters.

To investigate an issue step by step, see
[Investigate an issue](https://docs.logbrew.co/guides/investigate-an-issue.md). To get alerts for new and
regressed issues, see the
[alerting guide](https://logbrew.co/en/guides/alerts).

## Related pages

> [card] [Structured logging](https://docs.logbrew.co/concepts/structured-logging.md)
>
> Choose log fields and levels that you can search.

> [card] [Node.js logging](https://docs.logbrew.co/guides/node-logging.md)
>
> Send Winston and Pino logs with their trace IDs.

> [card] [Python logging](https://docs.logbrew.co/guides/python-logging.md)
>
> Send records from the standard logging module.

> [card] [Manage issues](https://docs.logbrew.co/guides/issue-workflow.md)
>
> Resolve, archive, assign, and reopen issues.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.