How can I set the log level of an SDK tap? I've lo...
# singer-taps
r
How can I set the log level of an SDK tap? I've look through the code and it looks like
TAP_<NAME>_LOG_LEVEL=ERROR
should work, but doesn't...
e
Should be
TAP_<NAME>_LOGLEVEL=ERROR
I believe
r
Sorry, typo in the OP - I have tried that.
e
Hmm, I can confirm that does work for me:
Copy code
$ TAP_GEEKBOT_LOGLEVEL=warning poetry run tap-geekbot
2025-05-22 09:39:33,461 | ERROR    | tap-geekbot          | Config validation error: 'api_key' is a required property

$ TAP_GEEKBOT_LOGLEVEL=debug poetry run tap-geekbot
2025-05-22 09:39:52,537 | DEBUG    | tap-geekbot          | Validating config using jsonschema: {'type': 'object', 'properties': ...
2025-05-22 09:39:52,537 | ERROR    | tap-geekbot          | Config validation error: 'api_key' is a required property
r
Oh, I think it's actually the SDK logger I'm interesting in reducing the level of. Looks like the tap logging is controlled by that environment variable, but I'm still seeing a bunch of logging stemming from
singer_sdk
. Perhaps
LOGLEVEL=error
will work...
Nope. Is it possible to configure the log level for the tap regardless of logging source (i.e. tap and SDK)? Ideally, I only want to see
singer_sdk.metrics
INFO
logs - everything else
WARNING
or above.
e
I see the problem. We only use that env var to set the level of the
<plugin_name>
logger: https://github.com/meltano/sdk/blob/8adf45277b07c13071af875bc0c9e9419766908d/singer_sdk/plugin_base.py#L144-L152
r
Yeah, that's what I was looking at.
Although, having written my requirement out I don't think it is actually as simple as setting all loggers to the given log level.
But I do think that `TAP_<NAME>_LOGLEVEL`/`LOGLEVEL` should control the SDK log level also.
e
But I do think that `TAP_<NAME>_LOGLEVEL`/`LOGLEVEL` should control the SDK log level also.
Yeah, I agree.
Although, having written my requirement out I don't think it is actually as simple as setting all loggers to the given log level.
You probably want a logging config file: https://sdk.meltano.com/en/v0.46.3/implementation/logging.html#custom-logging-configuration
👍 1
r
Makes sense, thanks for the docs link.