[Feature] Allow the background log path to be specified

未关闭
#692 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@perfectmodelslab 已经在做这个了。

开始于 2026年10月25日。

  • #1059 来自 @perfectmodelslab —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
58/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
python
领域
cli

调研方向

从启动入口开始,跟踪 background_launch() 到 background_log_path(port);检查 _open_log_for_write() 以及 comfy logs 如何读取配置键 background_log。确定环境变量还是启动选项是受支持的接口,然后验证所选路径已被记录,并且现有的防止跟随符号链接的保护仍然完整。如果行为发生变化,请更新相关的 comfy logs 文档。

由索引模型根据 Issue 内容生成。

描述

enhancement

What

comfy launch --background writes ComfyUI's output to
<workspace>/user/comfyui_<port>.log, and there is currently no way to ask for a
different path. A --log-file option on launch, or an env var honoured by
background_log_path(), would let a supervising process keep that log wherever it
keeps its others.

Why

comfy-cli is increasingly something else starts — a project launcher, a dev
script, a systemd unit. Those supervisors usually have one convention for where
their managed services log (/tmp/<name>.log, /var/log/<name>/, a run
directory), and ComfyUI is the one participant whose log lands somewhere else, in
a location that also moves with the workspace.

In our case (a launcher that starts piper / ollama / a Chatterbox bridge / ComfyUI
side by side) every other helper announces (logs: /tmp/<name>.log) on startup
and points back there on failure. ComfyUI can't, so we symlink /tmp/comfyui.log
at comfy-cli's file instead. That works fine — this is a convenience request, not
a defect report.

Current state, for reference

  • launch exposes --background and --frontend-pr; no log option.
  • background_launch() computes log_path = background_log_path(port)
    unconditionally.
  • The background_log config key looks like it might be an input, but it's
    written by comfy-cli after launch and read back only by comfy logs to locate
    the file.

Suggested shape

Either is fine; the env var alone would cover the supervisor case:

def background_log_path(port, workspace: str | None = None) -> str:
    override = os.environ.get("COMFY_BACKGROUND_LOG")
    if override:
        return os.path.abspath(override)
    ...

One thing worth preserving

_open_log_for_write() opens with O_NOFOLLOW so a pre-placed symlink in
<workspace>/user can't be used to clobber its target — a good defence, and an
override path should keep it rather than special-casing "trusted" locations. Worth
saying explicitly in the docs for such an option: the override must be a real
file path, not a symlink
, or the launch fails with ELOOP.

That behaviour is also why the workaround has to point the other way (a symlink
at comfy-cli's file, never the workspace path symlinked outward) — which is
easy to get backwards, and might deserve a line in the comfy logs docs
regardless of whether this request is taken up.

主要语言
Python
星标
1k
派生
176
平均合并
1 天 11 小时
30 天内合并 PR
87

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Comfy-Org/comfy-cli 的其他 Issue

查看 Comfy-Org/comfy-cli 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。