[GH-ISSUE #3906] 如何设置日志保存到文件,并同时打印到标准输出 #3095

Closed
opened 2026-05-05 14:00:15 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @mapxn on GitHub (Dec 30, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3906

Describe the feature request

如何保存日志到文件,并同时打印到标准输出
使用0.53.2版本,frps使用如下yml配置,发现只能保存到文件里,标准输出为空

bindAddr: 0.0.0.0
bindPort: 7000

vhostHTTPPort: 30080
vhostHTTPSPort: 30443

log:
  to: /var/log/frp/frps.log
  level: info
  maxDays: 7
  disablePrintColor: false

印象在旧版本中是可以的,是新版本我不会用吗?

Describe alternatives you've considered

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @mapxn on GitHub (Dec 30, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3906 ### Describe the feature request 如何保存日志到文件,并同时打印到标准输出 使用0.53.2版本,frps使用如下yml配置,发现只能保存到文件里,标准输出为空 ```yml bindAddr: 0.0.0.0 bindPort: 7000 vhostHTTPPort: 30080 vhostHTTPSPort: 30443 log: to: /var/log/frp/frps.log level: info maxDays: 7 disablePrintColor: false ``` 印象在旧版本中是可以的,是新版本我不会用吗? ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 14:00:15 -06:00
Author
Owner

@superzjg commented on GitHub (Dec 30, 2023):

一直都是分开的,你可以两种方式实现:
1、设置log.to为文件,运行frp命令时,使用重定向 > 或 >> log.to定义的文件
2、不设置log.to为文件,而是 console,运行frp命令时,重定向 > 或 >> 到某个文件

<!-- gh-comment-id:1872443813 --> @superzjg commented on GitHub (Dec 30, 2023): 一直都是分开的,你可以两种方式实现: 1、设置`log.to`为文件,运行frp命令时,使用重定向 > 或 >> `log.to`定义的文件 2、不设置`log.to`为文件,而是 `console`,运行frp命令时,重定向 > 或 >> 到某个文件
Author
Owner

@wuai1024 commented on GitHub (Dec 30, 2023):

我也想问这个,目前使用docker部署的,都只有文件能看到。

docker logs frpc 没有内容

<!-- gh-comment-id:1872521313 --> @wuai1024 commented on GitHub (Dec 30, 2023): 我也想问这个,目前使用docker部署的,都只有文件能看到。 docker logs frpc 没有内容
Author
Owner

@superzjg commented on GitHub (Dec 30, 2023):

一直都是分开的,你可以两种方式实现: 1、设置log.to为文件,运行frp命令时,使用重定向 > 或 >> log.to定义的文件 2、不设置log.to为文件,而是 console,运行frp命令时,重定向 > 或 >> 到某个文件

我自己再说一点,openwrt 系统中 将 frp 以 procd方式启动/守护时,设置
procd_set_param stdout 1
procd_set_param stderr 1
设置后,标准输出和标准错误,并不会重定向到 syslog,这个问题确实存在。
procd 简介:https://openwrt.org/docs/guide-developer/procd-init-scripts#defining_service_instances

<!-- gh-comment-id:1872554007 --> @superzjg commented on GitHub (Dec 30, 2023): > 一直都是分开的,你可以两种方式实现: 1、设置`log.to`为文件,运行frp命令时,使用重定向 > 或 >> `log.to`定义的文件 2、不设置`log.to`为文件,而是 `console`,运行frp命令时,重定向 > 或 >> 到某个文件 我自己再说一点,openwrt 系统中 将 frp 以 procd方式启动/守护时,设置 procd_set_param stdout 1 procd_set_param stderr 1 设置后,标准输出和标准错误,并不会重定向到 syslog,这个问题确实存在。 procd 简介:https://openwrt.org/docs/guide-developer/procd-init-scripts#defining_service_instances
Author
Owner

@mapxn commented on GitHub (Dec 30, 2023):

我也想问这个,目前使用docker部署的,都只有文件能看到。

docker logs frpc 没有内容

我也是发现使用最新版后,docker logs没有输出了(配置文件平滑迁移的)

<!-- gh-comment-id:1872625941 --> @mapxn commented on GitHub (Dec 30, 2023): > 我也想问这个,目前使用docker部署的,都只有文件能看到。 > > > > docker logs frpc 没有内容 我也是发现使用最新版后,docker logs没有输出了(配置文件平滑迁移的)
Author
Owner

@github-actions[bot] commented on GitHub (Jan 25, 2024):

Issues go stale after 21d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

<!-- gh-comment-id:1909291954 --> @github-actions[bot] commented on GitHub (Jan 25, 2024): Issues go stale after 21d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
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: github-starred/frp#3095
No description provided.