ecsimsw opened a new pull request, #13681:
URL: https://github.com/apache/apisix/pull/13681

   ### Description
   
   - The `file-logger` plugin uses `io.open(path, "a+")`, even when path is 
`/dev/stdout` or `/dev/stderr`
   - This depends on OS file permissions, which fails with `Permission denied` 
in restricted environments
   - This PR uses `io.stdout` or `io.stderr` Lua runtime handles, which are 
always available regardless of file permissions
   - No schema changes, existing `"path": "/dev/stdout"` configuration works as 
before
   
   ### Changes
   
   - `apisix/plugins/file-logger.lua` : use `io.stdout`/`io.stderr` handles 
instead of `io.open` when path is `/dev/stdout` or `/dev/stderr`
   - `t/cli/test_file_logger_stdout.sh` : add CLI test for stdout output
   - `docs/en/latest/plugins/file-logger.md` : document `/dev/stdout` and 
`/dev/stderr` in path attribute
   - `docs/zh/latest/plugins/file-logger.md` : same for Chinese docs
   
   ### Note on test approach
   
   - The CLI test runs `openresty` directly in the foreground instead of using 
`apisix start`.
   - Because `apisix start` launches nginx via `io.popen(cmd):read("*all")` 
which consumes the process stdout, making `/dev/stdout` output unobservable 
from outside. 
   - This is the same approach used in production containers 
(`docker-entrypoint.sh`).
   
   #### Which issue(s) this PR fixes:
   
   Fixes #6797
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to