How can I use python's logging inside of a model asset/model adapter

Hello,

I’m trying logging inside of a model adapter’s model code, logging example code:

import logging

logger = logging.getLogger(__name__)
logger.info("Hello World")

Executing the model code in a transform adds my logs to the Build’s logs. But when I use the published model asset the logs are not inside the Build where the model asset is used. I consume the Model Asset in a transform via a ModelInput.

How can I add/enable the logging inside of the model asset in the Build logs that use the model asset?

Thanks in advance for your help!

1 Like

This should just work by default, but you might want to tag the transforms product since they would have more context on logging in transforms

After testing it again this works now.

Using the following code in the model adapter:

import logging

logger = logging.getLogger(__name__)
logger.info("Hello World")

Have you tried using various log levels like debug, error ?

Yes, various log levels work as well