---
icon: material/text-box-outline
title: "Logging"
description: "Where the engine writes its own logs, and how to change the location, appender, and rotation"
---

The engine writes its own diagnostic logs through
[Log4j2](https://logging.apache.org/log4j/2.x/){target="_blank"}. These are the engine's
logs about itself, separate from the event data it processes.

## Where the logs go

The engine resolves the log directory at startup:

1. `TENX_LOG_PATH`, if set.
2. Otherwise `/var/log/tenx/` on Linux and macOS, `%AppData%\tenx\log\` on Windows.

The file is `tenx.log` in that directory. `TENX_LOG_PATH` is appended to directly, so
it needs a trailing separator (`/` on Linux and macOS, `\` on Windows).

```bash
export TENX_LOG_PATH=/custom/log/path/
```

To log to stdout instead of a file, name the console appender:

```bash
export TENX_LOG_APPENDER=tenxConsoleAppender
```

## Rotation

| Setting | Default |
|---|---|
| Size trigger | 10 MB |
| Archives kept | 10 |
| Archive name | `tenx.{date}.{index}.log` |

## Changing the configuration

Rotation, layout, and appenders come from `log4j2.yaml` in
[`$TENX_CONFIG`](../install/paths.md). The defaults:

```yaml
properties:
  property:
    - name: log-path
      value: "${env:TENX_LOG_PATH:-/var/log/tenx/}"

appenders:
  rollingFile:
    - name: tenxFileAppender
      fileName:    "${log-path}tenx.log"
      filePattern: "${log-path}tenx.%d{dd-MMM}.%i.log"
      policies:
        sizeBasedTriggeringPolicy:
          size: 10MB
      defaultRollOverStrategy:
        max: 10
```
