How to access traefik log level through plugin

I'm working in a traefik plugin. How can i access the log level set in traefik while running a plugin?

Very interested in the solution here! I'm also curious in the standard way to log with a traefik plugin so that logs get handled / output by traefik in the execution process.

Are there docs for guidance on logging along with leveled logging?

Unfortunately, for now, this is not possible. But you can follow the progress through this issue be able to use logger from middlewares package when writing plugin · Issue #8204 · traefik/traefik · GitHub

1 Like

Indeed, for now, no plugin can know the log level of Traefik, but leveraging stdout and stderr, a plugin can write an info log and an error log respectively traefik/builder.go at ba822acb23db3d620f6b3773ac9eff3e98ce313f · traefik/traefik · GitHub

To leverage this, I built into one of my plugins a log level. But this means that you have two log levels to define, one for Traefik itself, and one for the dynamic configuration of the plugin.

1 Like

That's super helpful!! Thanks for the info / update y'all!

1 Like