datajoint / datajoint-python

Relational data pipelines for the science lab
https://datajoint.com/docs
GNU Lesser General Public License v2.1
169 stars 84 forks source link

How to log/print in computed table #1166

Closed Hegelim closed 1 month ago

Hegelim commented 2 months ago

Suppose I have defined some computed table schema that looks like the following

def make(self, key):
        source = self.key_source

        # Debugging key source
        logging.info(f"Key Source: {source}")
        logging.info(f"Key: {key}")

        key_dict = (source & key).fetch1()
        logging.info(key_dict)
        logging.debug(key_dict)
        print(key_dict)

Suppose this is for class A, and I want to run A().populate(). I have tried logging/print/logging to file, but none of them work. How to properly log/print/debug?

CBroz1 commented 2 months ago

Those logging.info and print statements should be visible when called by default. If not, that's more likely an issue with how the populate is being called (jupyter, ipython, etc. config), and not an issue with datajoint

logging's FileHandler (demo) should be able to add logging to a file in addition to the standard printout. Doing so could be a sanity check that the code is running

dimitri-yatsenko commented 1 month ago

Is this still an issue? This seems like a logger configuration issue, not datajoint specific. We plan to close this issues unless we get a clarification.

dimitri-yatsenko commented 1 month ago

Please re-open if this is still an issue.