Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log_debug cannot work...for very long #113

Open
AlexanderMann opened this issue Nov 11, 2019 · 3 comments
Open

log_debug cannot work...for very long #113

AlexanderMann opened this issue Nov 11, 2019 · 3 comments

Comments

@AlexanderMann
Copy link

AlexanderMann commented Nov 11, 2019

Problem

Singer-Python is the root repo for pretty much every tap and target, and the suggested way to log "out" is to use singer.get_logger() or one of the helpers of log_info, or...log_debug.

For target-postgres we use the DEBUG level for logging in tests, and for gaining more information for issues/bug reports etc.

To enable DEBUG logging, we have a single call out to singer.get_logger() followed up by setLevel('DEBUG') (loosely). This works pretty well up until get_logger() gets called again.

Once get_logger gets called again, the fileConfig code gets run again, and the root logger gets reset to the logging.conf and having the level set to INFO.

logging.config.fileConfig(path, disable_existing_loggers=False)

Once this happens, log_debug no longer works.

Question

Is there a suggested way to use/get DEBUG output while also leveraging singer-python?

...or...

Is this a 🐛?

Suggested Musical Pairing

https://soundcloud.com/winnetka-bowling-league/slow-dances

@briansloane
Copy link

@AlexanderMann Thanks for raising this. I've chatted with the team and we do think this is unexpected behavior and could be a bug. The team would welcome a PR if the is something you want to take a crack at resolving.

@AlexanderMann
Copy link
Author

@briansloane just realized I never pushed anything on this/etc. Do you know if there's been any work on this or if this would still be a welcomed pr?

@laurentS
Copy link

laurentS commented Jun 2, 2022

Considering how many other repos use this package, I'd not dare to introduce a breaking change here, but would you be open to a PR that allows overriding the log level here via some env var that's unlikely to be used elsewhere, say SINGER_LOGLEVEL for instance. If not set, nothing changes, but it allows users to opt-in to a cleaner behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants