Survey banner
Switching to Dataiku - a new area to help users who are transitioning from other tools and diving into Dataiku! CHECK IT OUT

Capturing Python logging output in a file

Capturing Python logging output in a file
Looking for a way to capture Python logging output from a recipe in a file. I explored directing output to a file in a managed folder but writing to a managed folder requires use of the API. Any other ideas?
0 Kudos
2 Replies

If your managed folder is on a "Local filesystem" connection, you can write directly in it.

* First, get the base path of the managed folder with dataiku.Folder("xxxxxx").get_path()
* Then you can write into it using the regular Python file API

So you can setup the logging module to log to a file whose path you have computed first from get_path()
0 Kudos
Thanks Clement!

This worked as advertised for a recipe that already had a managed folder as an output but wanted to share some additional detail about other situations that may be useful to others.

We are running our instance in multi-user-security mode and in this case write access on a managed folder is only granted when said managed folder is defined as output of the recipe. So the above situation worked fine. For other Python recipes however, a new managed folder must be created for each to store the output of the Python recipe.
0 Kudos


Labels (3)
A banner prompting to get Dataiku