[GH-ISSUE #5282] [Bug]: v3.3.1 cannot write log to file. #3695

Closed
opened 2026-10-31 20:34:18 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @cwyin7788 on GitHub (Jun 13, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5282

Describe the bug

When I updated 3x-ui to 3.3.1, I've found that, it can't write the logs to file anymore, not only 1 machine, all updated to latest version 3-xui machine, also cannot write log to file, please fix this bug, thank you for developers attension.

Image Image Image

How to reproduce the problem

I didn't to anything, just updated 3x-ui to the latest version, I've tried restart x-ui service, and the log still cannot write to file.

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.3.1

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

Debian Trixie

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @cwyin7788 on GitHub (Jun 13, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5282 ### Describe the bug When I updated 3x-ui to 3.3.1, I've found that, it can't write the logs to file anymore, not only 1 machine, all updated to latest version 3-xui machine, also cannot write log to file, please fix this bug, thank you for developers attension. <img width="1658" height="746" alt="Image" src="https://github.com/user-attachments/assets/98c143d6-ddb4-4910-8ef3-5849f6d8b1c5" /> <img width="716" height="694" alt="Image" src="https://github.com/user-attachments/assets/a8086cdc-902a-4930-b5b3-a21ba92b880f" /> <img width="683" height="684" alt="Image" src="https://github.com/user-attachments/assets/a6fbc8a0-0fe2-4f70-82f1-b8720a5affeb" /> ### How to reproduce the problem I didn't to anything, just updated 3x-ui to the latest version, I've tried restart x-ui service, and the log still cannot write to file. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.3.1 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system Debian Trixie ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:34:18 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 13, 2026):

This is a behavioral change introduced in v3.3.1 by commit fix(xray): confine log.access/error to the panel log folder (merged 2026-06-12, just before the v3.3.1 tag).

What changed

A new function resolveXrayLogPaths was added in internal/web/service/xray.go. Every time the Xray process starts, it takes the log.access and log.error paths from the stored Xray template config, strips each to its base filename, and rewrites the path to be inside the panel's log folder (/var/log/x-ui/ on Linux, or the value of XUI_LOG_FOLDER if set). If the stored path is already inside that folder it is left unchanged. The values "" and "none" are also left unchanged (they disable that log output).

Practical effect

If you had previously set log paths to anything outside /var/log/x-ui/ — for example /etc/x-ui/access.log or /var/log/xray/access.log — those paths are silently rewritten at process-start time. The panel UI (Settings → Xray Configuration) still shows the old path that is stored in the database; only the runtime bin/config.json contains the rewritten path.

As a result, Xray is writing logs, but to /var/log/x-ui/<basename> (e.g. /var/log/x-ui/access.log), not the path shown in the editor.

To confirm this is what is happening on your machines

  1. Check whether log files now appear in /var/log/x-ui/:
    ls -lh /var/log/x-ui/
    
  2. Read the runtime config that was actually passed to Xray to see the rewritten paths:
    cat /usr/local/x-ui/bin/config.json | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('log',{}))"
    

Workaround

Update the log paths in your stored Xray template config to be inside /var/log/x-ui/. Open Settings → Xray Configuration in the panel, find the log section, and set the paths explicitly:

"log": {
  "access": "/var/log/x-ui/access.log",
  "error": "/var/log/x-ui/error.log",
  "loglevel": "warning"
}

After saving and restarting Xray (or the x-ui service), the configured path and the runtime path will match and the behaviour will be consistent.

Background

This change was a security fix: an authenticated admin could previously point the supervised Xray process at an arbitrary file path by editing the raw Xray config. The fix intentionally restricts log output to the panel's log folder. It is a breaking change for any installation that had configured Xray log paths outside that folder, and the panel UI currently gives no indication that the path has been redirected.

Clarification needed

To confirm the above diagnosis applies to your case, please share:

  1. The current contents of the log block in your Xray template config (visible in Settings → Xray Configuration).
  2. The output of ls -lh /var/log/x-ui/ after restarting the service.
  3. The Xray-core version reported in the panel or by x-ui.

This reply was generated automatically by the issue-triage assistant; a maintainer may follow up.

<!-- gh-comment-id:4698881679 --> @github-actions[bot] commented on GitHub (Jun 13, 2026): This is a behavioral change introduced in v3.3.1 by commit `fix(xray): confine log.access/error to the panel log folder` (merged 2026-06-12, just before the v3.3.1 tag). **What changed** A new function `resolveXrayLogPaths` was added in `internal/web/service/xray.go`. Every time the Xray process starts, it takes the `log.access` and `log.error` paths from the stored Xray template config, strips each to its base filename, and rewrites the path to be inside the panel's log folder (`/var/log/x-ui/` on Linux, or the value of `XUI_LOG_FOLDER` if set). If the stored path is already inside that folder it is left unchanged. The values `""` and `"none"` are also left unchanged (they disable that log output). **Practical effect** If you had previously set log paths to anything outside `/var/log/x-ui/` — for example `/etc/x-ui/access.log` or `/var/log/xray/access.log` — those paths are silently rewritten at process-start time. The panel UI (Settings → Xray Configuration) still shows the old path that is stored in the database; only the runtime `bin/config.json` contains the rewritten path. As a result, Xray **is** writing logs, but to `/var/log/x-ui/<basename>` (e.g. `/var/log/x-ui/access.log`), not the path shown in the editor. **To confirm this is what is happening on your machines** 1. Check whether log files now appear in `/var/log/x-ui/`: ```sh ls -lh /var/log/x-ui/ ``` 2. Read the runtime config that was actually passed to Xray to see the rewritten paths: ```sh cat /usr/local/x-ui/bin/config.json | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('log',{}))" ``` **Workaround** Update the log paths in your stored Xray template config to be inside `/var/log/x-ui/`. Open Settings → Xray Configuration in the panel, find the `log` section, and set the paths explicitly: ```json "log": { "access": "/var/log/x-ui/access.log", "error": "/var/log/x-ui/error.log", "loglevel": "warning" } ``` After saving and restarting Xray (or the `x-ui` service), the configured path and the runtime path will match and the behaviour will be consistent. **Background** This change was a security fix: an authenticated admin could previously point the supervised Xray process at an arbitrary file path by editing the raw Xray config. The fix intentionally restricts log output to the panel's log folder. It is a breaking change for any installation that had configured Xray log paths outside that folder, and the panel UI currently gives no indication that the path has been redirected. **Clarification needed** To confirm the above diagnosis applies to your case, please share: 1. The current contents of the `log` block in your Xray template config (visible in Settings → Xray Configuration). 2. The output of `ls -lh /var/log/x-ui/` after restarting the service. 3. The Xray-core version reported in the panel or by `x-ui`. *This reply was generated automatically by the issue-triage assistant; a maintainer may follow up.*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3695
No description provided.