Logging and Warnings#
Vega and Vega-Lite report warnings while compiling or evaluating a chart. A conversion can succeed even though Vega dropped an invalid property or recovered from a data problem, so check these messages when a chart does not look as expected.
This examples use a logarithmic scale whose inferred domain includes zero. Save this Vega-Lite specification:
chart.vl.json
{
"$schema": "https://vega.github.io/schema/vega-lite/v6.json",
"data": {
"values": [
{"category": "A", "value": 100},
{"category": "B", "value": 200}
]
},
"mark": "bar",
"encoding": {
"x": {"field": "category", "type": "nominal"},
"y": {
"field": "value",
"type": "quantitative",
"scale": {"type": "log"}
}
}
}
The CLI writes logs to standard error, so standard output stays available for conversion results.
$ vl-convert --log-level warn \
> vl2svg --input chart.vl.json --output chart.svg
The command succeeds and writes a timestamped warning to standard error. The relevant part is:
...
WARN vl_convert: Log scale domain includes zero: [0,200]
--log-filter accepts a tracing-subscriber filter directive for finer control and takes priority over --log-level:
$ vl-convert --log-filter 'vl_convert=debug' \
> vl2svg --input chart.vl.json --output chart.svg