-
Notifications
You must be signed in to change notification settings - Fork 33
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
Logging is silently disabled on agnpy import #155
Comments
Hello @pguenth, thanks for reporting this! Line 1 in 7afc1f8
i.e. to notify the user if sherpa and Gammapy are not installed.
Can it be that by re-importing |
As far as I understand the logging library, this should not make a difference. Just using |
Okay the behavior of the logging module is apparently even more unexpected (at least to me):
(https://docs.python.org/3/library/logging.html#logging.basicConfig) So the problem is most likely that agnpy's call to The solution you proposed seems to be the best in my opinion (although for a slightly different reason) and is also what the documentation recommends. |
Hey all :)
Importing agnpy seems to set the configuration for the python logging library, although in a quick search I could not find out why. Since the logging library silently ignores further configuration calls to
logging.basicConfig(...)
for some reason I do not understand, this leads to the confusing/frustrating situation that no logging output is shown anymore.I'm not sure I would consider this a bug in agnpy, but it will probably cause some frustration further down the line nevertheless. So I think it would be better to avoid the problem if that is possible.
Example code:
Note: There is also the kwarg
force=True
that one can set inbasicConfig
to circumvent this problem.The text was updated successfully, but these errors were encountered: