SagerNet / SagerNet/sing-box

check 指令使用了被检查配置文件中的 log 配置

Open
#3,927 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
38.2k
Forks
4.6k
Avg merge
19d 15h
Merged PRs (30d)
1

Description

操作系统

Windows

系统版本

25H2

安装类型

sing-box 原始命令行程序

如果您使用图形客户端程序,请提供该程序版本。

No response

版本
sing-box version 1.13.3

Environment: go1.25.7 windows/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,with_naive_outbound,with_purego,badlinkname,tfogo_checklinkname0       
Revision: d3768cca3602c2949417fe767c1acd88d7f67698
CGO: disabled
描述

check 指令使用 -c 参数指定配置文件后,错误的使用了被检查配置文件的 log 配置,日志等级及时间戳等配置均会影响 check 指令的输出。
check 指令的日志配置不应由被检查的配置文件指定。

重现方式
.\sing-box.exe check -c config.json
{
  // ...
  "log": {
    "level": "trace"
  }
}
日志
TRACE[0000] close service
TRACE[0000] close service completed (0.00s)
TRACE[0000] close endpoint
TRACE[0000] close endpoint completed (0.00s)
TRACE[0000] close inbound
TRACE[0000] close inbound completed (0.00s)
TRACE[0000] close outbound
TRACE[0000] close outbound completed (0.00s)
TRACE[0000] close router
TRACE[0000] close router completed (0.00s)
TRACE[0000] close connection
TRACE[0000] close connection completed (0.00s)
TRACE[0000] close dns-router
TRACE[0000] close dns-router completed (0.00s)
TRACE[0000] close dns-transport
TRACE[0000] close dns-transport completed (0.00s)
TRACE[0000] close network
TRACE[0000] close network completed (0.00s)
TRACE[0000] close certificate
TRACE[0000] close certificate completed (0.00s)
TRACE[0000] close cache-file
TRACE[0000] close cache-file completed (0.00s)
TRACE[0000] close clash server
TRACE[0000] close clash server completed (0.00s)
TRACE[0000] close logger
TRACE[0000] close logger completed (0.00s)
支持我们
完整性要求
  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
  • 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
  • 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the sing-box check command and its -c configuration-loading path, reproducing the issue with the provided config.json on Windows. Trace where logging is initialized during check and verify that the checked file's log.level does not control the command's output. Done means check validates the file without emitting configuration-driven trace logging.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.