1

I'd like to be able to log outputs from the functions I pass to my engines in the relevant engine logs.

I.e.:

data = /* my list of data to operate on */
def fn(inval):
    import logging
    log = logging.getLogger()
    log.error('This is on the engine')
    // do stuff
    return result

calculated_data = []
for datum in data:
    calc = view.apply(fn, datum)
    calculated_data.append(calc)

I'd like to be able to see the log statements in the relevant engine log that operated on the specific task.

GoingTharn
  • 1,123
  • 1
  • 11
  • 19

1 Answers1

3

You can grab the logger of the current app (i.e. the engine in this case) with:

from IPython.config import Application
log = Application.instance().log

Then log as normal, and it will go to the engine logs.

minrk
  • 37,545
  • 9
  • 92
  • 87
  • Would it be possible to forward logs to the master process, to reach stdout through a console handler? – jasaarim Oct 12 '15 at 13:08