Incorrect log format

I'm not sure if I'm doing something wrong, but I have a Traefik v2 deployment in Kubernetes where pods start with extra flags as such

--global.checknewversion --global.sendanonymoususage --entrypoints.metrics.address=:9100/tcp --entrypoints.traefik.address=:9000/tcp --entrypoints.web.address=:8000/tcp --entrypoints.websecure.address=:8443/tcp --api.dashboard=true --ping=true --metrics.prometheus=true --metrics.prometheus.entrypoint=metrics --providers.kubernetescrd --providers.kubernetescrd.ingressClass=traefik-internal --providers.kubernetesingress --providers.kubernetesingress.ingressClass=traefik-internal --log.level=WARN --log.format=json

Now, the first line of log once the pods have started looks like

time="2022-10-08T15:30:12Z" level=info msg="Configuration loaded from flags."

Which is a bit weird, because I am setting log.level = WARN as well as json format. The documentation seems to confirm my approach however I'm not getting the expected result. Has anyone had this issue? What am I doing wrong?


Hello @adascalu,

Thanks for your interest in Traefik!

The "Configuration loaded from flags" log happens before the logger configuration.
This log is printed just after the static configuration is parsed for the CLI arguments, which arguments are specifying the log level, so that the log configuration is not yet applied.
This is why this specific log is printed whatever the log level is.

I hope this answers your question!