Open whyjz opened 3 years ago
Hmm I agree, that's definitely not ideal. The logging defaults get set here: https://github.com/isce-framework/isce2/blob/e9606834c44be80a5daa1f295241ffa562cc15e8/__init__.py#L39
And it looks like we're changing the root logger with our config: https://github.com/isce-framework/isce2/blob/e9606834c44be80a5daa1f295241ffa562cc15e8/defaults/logging/logging.conf#L10-L11
Maybe we should remove the root logger config. I think our internal modules should be using logger_isce anyway.
Here's what I currently do in my script for anyone interested in a quick workaround:
import logging
import isce
root_logger = logging.getLogger()
root_logger.setLevel('WARNING')
import rasterio
The key here is to change the root logger settings immediately after importing isce. Now it works just fine. Thus, I think I will leave you to decide whether to close this issue. For me, it would still be great if we could modify the isce logging defaults to fix this. Thanks for the help and thoughts anyway :+1:
Thanks! For now I think I will keep this open. It's good to have a documented workaround but I think isce2 should still try to "play nice" with other packages that use the builtin logging package. From what I can tell, our modules already use named loggers such as "isce.topsinsar.runGeocode". In fact, I don't see a single getLogger()
call in isce2 which uses the root logger, so I think resolving this may be as simple as removing the logger_root
lines from our config.
Hi, It seems to me that importing
isce
changes the environmental logging settings to the debug level. For example, the following code works well:However, if we import isce before these lines:
A lot of debug messages will appear, which is a bit annoying:
It's true that I can set up individual log settings to inhibit the message, for example,
However, this is also not ideal for me as there are multiple packages being imported, and sometimes we need to add more packages during the development and do not want to see debug messages flooding the screen.
Is there a way to make isce not change the universal logging level, or an alternative solution to address this issue? Thanks in advance...