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

ballcosmos destroys logging configuration #27

Open
keck-in-space opened this issue Dec 12, 2022 · 3 comments · May be fixed by #28
Open

ballcosmos destroys logging configuration #27

keck-in-space opened this issue Dec 12, 2022 · 3 comments · May be fixed by #28

Comments

@keck-in-space
Copy link
Contributor

if ballcosmos is imported it overwrites my existing logging configuration

@keck-in-space
Copy link
Contributor Author

keck-in-space commented Dec 12, 2022

logging.basicConfig(
format="%(asctime)s %(levelname)s %(name)s %(message)s",
level=logging.getLevelName(LOG_LEVEL),
)

If I comment out these lines I don't get the logging behavior overwrite

@keck-in-space keck-in-space changed the title ballcosmos destorys logging configuration ballcosmos destroys logging configuration Dec 15, 2022
keck-in-space added a commit to keck-in-space/python-ballcosmos that referenced this issue Jan 24, 2023
This setting overwrites any logging configuration made by the consumer of this library. Closes BallAerospace#27
@keck-in-space keck-in-space linked a pull request Jan 24, 2023 that will close this issue
@AbdelAzizMohamedMousa
Copy link

The logging.basicConfig() function is used to configure the logging system in Python. It should be called only once at the beginning of the program to set up the logging configuration.

By calling logging.basicConfig() more than once, the configuration of the logging system will be reset to its default settings, and any previous logging configuration will be lost.

In the code you provided, calling ballcosmos() after logging.basicConfig() will reset the logging configuration to its default settings and destroy any previous logging handlers, which may cause unexpected behavior in the logging system.

If you need to use ballcosmos() after configuring the logging system, you should ensure that it does not reset the logging configuration, or you should reconfigure the logging system after calling ballcosmos().

@keck-in-space
Copy link
Contributor Author

I understand that, but a Python library should not be setting the logging configuration.

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

Successfully merging a pull request may close this issue.

2 participants