> For the complete documentation index, see [llms.txt](https://support.powerio.com/hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.powerio.com/hub/faq/faq-en/hvac-codesys-faq/wo-liegt-das-codesys-log.md).

# Where is the CODESYS log located

On powerIO devices, the CODESYS log is located in the Runtime working directory. Installations with Runtime 4.0 to 4.7 write it to /tmp on the first start.

The CODESYS log `codesyscontrol.log` is located in the runtime working directory. In CODESYS, download the log in the device editor under **Files** . If the CODESYS application from powerIO version `3.7` was started first with a runtime version `4.0.0.0` to `4.7.0.0` , the log is located in `/tmp` and is not available in the CODESYS File Explorer.

## Download CODESYS log

Prerequisite: CODESYS is connected to the device.

1. Open the device in the device tree with a double-click.
2. Open the tab **Files**.
3. In the runtime system area, click **Refresh**.
4. Select `codesyscontrol.log` and the files `codesyscontrol_0.log`, `codesyscontrol_1.log` and `codesyscontrol_2.log`, if available.
5. Copy the files to the PC.

## Rotation of the log files

The runtime writes to `codesyscontrol.log`. When the file reaches the maximum size, the runtime moves the contents to a file with a number and starts a new `codesyscontrol.log`. A restart of the runtime does not start a new file.

| Setting                | Value from runtime `4.16.0.0` | Meaning                                                              |
| ---------------------- | ----------------------------- | -------------------------------------------------------------------- |
| `Logger.0.MaxFileSize` | `1000000`                     | A file becomes about 1 MB in size.                                   |
| `Logger.0.MaxFiles`    | `3`                           | In addition to the current file, at most 3 older files are retained. |

More files do not mean that more history is retained. The total amount is limited: current file plus `MaxFiles` older files, so at most about 4 MB. At the next rotation, the runtime overwrites the oldest file.

The numbers `_0`, `_1` and `_2` are reused in rotation. The number therefore says nothing about the age of the file. Sort the files by modification date. The file with the oldest modification date contains the oldest entries.

How long the history goes back depends on the amount of messages. Frequent messages, for example repeated connection errors, fill 1 MB in just a few hours. Therefore, save the CODESYS log directly after an exception.

## Storage location by runtime version

The storage location is in the main configuration `CODESYSControl.cfg` in the entry `Logger.0.Name`. The default values come from the package of the respective runtime.

| Runtime on first start  | `Logger.0.Name`           | Visible in CODESYS | `MaxFiles` |
| ----------------------- | ------------------------- | ------------------ | ---------- |
| from `4.16.0.0`         | `codesyscontrol.log`      | yes                | `3`        |
| `4.8.0.0` to `4.15.0.0` | `codesyscontrol.log`      | yes                | `1`        |
| `4.0.0.0` to `4.7.0.0`  | `/tmp/codesyscontrol.log` | no                 | `1`        |

The CODESYS log remains at both storage locations after a restart and after an update of the CODESYS application.

## Reason for the storage location in /tmp

From CODESYS Application powerIO version `3.7` the main configuration is permanently stored on the device. The CODESYS application creates the file on first start and then no longer replaces it. The file therefore contains the default values of the runtime that was installed on first start.

A device is affected if the CODESYS application from version `3.7` was first started with a runtime `4.0.0.0` to `4.7.0.0` . A later update to a newer runtime does not change the storage location. The CODESYS application `5.1` still offers the runtime `4.0.0.0` to `4.7.0.0` .

The entries `Logger.0.Name`, `Logger.0.MaxFiles` and `Logger.0.MaxFileSize` cannot be changed via `CODESYSControl_User.cfg` .

## Save CODESYS log without a file

If `codesyscontrol.log` under **Files** is missing, save the messages via the tab **Log**. The tab shows only the messages since the last start of the runtime. Therefore, save the messages before a restart.

Prerequisite: CODESYS is connected to the device.

{% stepper %}
{% step %}

### Open device editor

Open the device in the device tree with a double-click.
{% endstep %}

{% step %}

### Open Log tab

Open the tab **Log**. Under **Components** is `<All components>` selected.
{% endstep %}

{% step %}

### Load messages

Click the refresh icon. CODESYS loads the messages from the runtime.
{% endstep %}

{% step %}

### Export messages

Click the export icon. Save the XML file on the PC.
{% endstep %}

{% step %}

### Copy exception log

Also copy the file under **Files** the file `codesysexception.log` to the PC, if available.
{% endstep %}
{% endstepper %}

The XML file can be reopened in the tab **Log** via the import icon. To keep the CODESYS log permanently as a file, correct the storage location.

## Correct storage location

{% hint style="warning" %}
**WARNING**

Data loss when uninstalling the CODESYS application. The device completely deletes the CODESYS data directory: boot project, retain data, trends, alarms, configuration, user management, and certificates.

* Back up the CODESYS project and the license before uninstalling.
* Contact powerIO support if the license is not on a dongle.
  {% endhint %}

Uninstall the CODESYS application. Then install the CODESYS application with a runtime from `4.8.0.0` new. The new installation adopts the default values of this runtime.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://support.powerio.com/hub/faq/faq-en/hvac-codesys-faq/wo-liegt-das-codesys-log.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
