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"}
}
}
}
Use structured JSON logs in deployed services:
$ vl-convert serve \
> --log-format json --log-level info \
> --port 3000
The server logs request identifiers, status, duration, and budget information alongside conversion diagnostics. See Server Logging for the request fields and proxy behavior.
Each conversion response also carries Vega diagnostics in the X-VLC-Logs header. Save this body as request.json:
request.json
{
"spec": {
"$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"
}
}
}
}
}
Use --dump-header to save the response headers:
$ curl http://127.0.0.1:3000/vegalite/svg \
> -H 'Content-Type: application/json' \
> --data-binary @request.json \
> --dump-header headers.txt \
> --output chart.svg
X-VLC-Logs contains a JSON array. Its first entry is:
WARN: Log scale domain includes zero: [0,200]