GitHub
08/09/2024, 9:13 PMLOGGING_CONF_FILE env var is not supported
Issue created by aelred
Singer SDK Version
0.13.1
Python Version
3.10
Bug scope
Configuration (settings parsing, validation, etc.)
Operating System
MacOS
Description
Logger cannot be configured with env var LOGGING_CONF_FILE.
If we have the following log config:
# logging.conf
...
format=LOGGED USING logging.conf: %(message)s
...
... and run our tap, the output does not use our requested format:
$ LOGGING_CONF_FILE=logging.conf poetry run tap-mytap
2022-11-16 110203,828 Beginning incremental sync of 'groups'...
This used to work pre-12.0 - I think it's due to the dedicated metrics logger added in 0.12.0. If we use the new env var (and different yml file format) for that, then it works:
# logging.yml
...
formatters:
child:
class: logging.Formatter
format: 'LOGGED USING logging.json: %(message)s'
...
$ SINGER_SDK_LOG_CONFIG=logging.yml poetry run tap-mytap
LOGGED USING logging.json: Beginning incremental sync of 'groups'...
It looks like one logging config is overriding the other.
Full log configs added below, I think this can be reproduced on any tap/target.
Code
# logging.conf
[loggers]
keys=root
[handlers]
keys=stderr
[formatters]
keys=child
[logger_root]
level=INFO
handlers=stderr
formatter=child
propagate=0
[handler_stderr]
level=INFO
class=StreamHandler
formatter=child
args=(sys.stderr,)
[formatter_child]
class=logging.Formatter
format=LOGGED USING logging.conf: %(message)s
datefmt=%Y-%m-%d %H:%M:%S
# logging.yml
version: 1
disable_existing_loggers: false
loggers:
root:
level: DEBUG
handlers:
- consoleHandler
formatter: child
propagate: true
formatters:
child:
class: logging.Formatter
format: 'LOGGED USING logging.json: %(message)s'
datefmt: '%Y-%m-%d %H:%M:%S'
handlers:
consoleHandler:
level: DEBUG
class: logging.StreamHandler
formatter: child
stream: ext://sys.stderr
meltano/sdkGitHub
08/09/2024, 9:13 PMLOGGING_CONF_FILE env var is not supported
Issue closed as completed by stale[bot]
meltano/sdk