Log
The log block configures sing-box's logger: severity, where to write, whether to include a timestamp, and whether to disable logging entirely.
Options
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
disabled | bool | false | true | false | When true, sing-box installs a no-op log factory. Nothing is written anywhere, regardless of other fields. |
level | string | trace | trace | debug | info | warn | warning | error | fatal | panic | Minimum severity. An empty string is treated as the default. The keywords "warn" and "warning" are accepted aliases. |
output | string | (stderr) | <empty> | stderr | stdout | <file path> | Where to write log lines. Empty defaults to stderr; "stderr" and "stdout" are the literal stream names; any other value is treated as a file path. |
timestamp | bool | false | true | false | When true, every line is prefixed with a timestamp like "-0700 2006-01-02 15:04:05". Required for the timestamp to appear in file output. |
Source: option/options.go:40-46 · pinned at v1.13.11 (553cfa1)
Examples
Default behavior (file omits log entirely — equivalent to {}):
json
{
"log": {}
}Quiet sing-box for a deployment:
json
{
"log": {
"level": "warn",
"timestamp": true,
"output": "/var/log/sing-box.log"
}
}Disable logging entirely:
json
{
"log": {
"disabled": true
}
}Notes
- The default level when
levelis left empty istrace(the most verbose tier), not info — seelog/log.go:67-69. Most production configurations should setlevelexplicitly. outputof"stderr"and"stdout"are literal stream names; any other non-empty value is treated as a file path (log/log.go:32-45).- When writing to a file, colors are forced off and timestamps are forced on regardless of the
timestampsetting — see the formatter setup atlog/log.go:46-52.
Source: option/options.go:40-46 · v1.13.11 (553cfa1)
