Import snappy stops python import logging from working

My logging for my python code was working using:
import logging
logging.basicConfig(filename=logfile,level=logging.DEBUG)
logging.debug(‘This message should go to the log file’)

but once I add any one of the following lines, the logging no longer works:
from snappy import Product
from snappy import ProductData
from snappy import ProductIO
from snappy import ProductUtils

Any suggestions?
Thanks
john

I also need to import snappy in python. Any solution? Thanks

In the snappy folder you find the jpyutil.py you’ll find that some lines (583 - 586) which also configure logging.
Maybe this interferes with your logging configuration.
You can try to disable these lines in the jpyutil.py file or maybe first import the snappy module in your code and then configure logging as you want it.

1 Like

Hi,

This is still a major issue. I think the problem is that the version of jpy that snap is shipping with is quite old.

The logging issue in jpy seems to have been fixed 2 years ago. See https://github.com/bcdev/jpy/blob/master/jpyutil.py#L43 and https://github.com/bcdev/jpy/pull/151