facebookarchive / planout

PlanOut is a library and interpreter for designing online experiments.
http://facebook.github.io/planout
Other
1.68k stars 216 forks source link

note on logging issue #12

Closed jdavidheiser closed 10 years ago

jdavidheiser commented 10 years ago

During the Pydata talk today, some users in the audience noticed that, on ipython notebooks, the logging can echo to the notebook, in addition to logging to a file. This is most likely a result of inheriting a parent log, depending on the user's configuration. In order to remove this, the following code can be run:

(assuming we have an experiment defined as 'e')

l = e.logger.values()[0]
l.parent.removeHandler(l.parent.handlers[0])

This grabs the logger from e, then removes the stream handler from the parent logger (which has been inherited). I figured this would be useful to you in future demos, since you mentioned noticing this issue for a small subset of users in the past.

Once this parent logger has been removed, it seems to be gone for all future experiments that are created.

jdavidheiser commented 10 years ago

I spoke to another user who had the logging issue, and he was using Anaconda (I am not), and he tested it on both Ipython 1.2.1 and 2.0 - so neither of those seems to be the relevant variable for determining who will have this issue and who will not.

jdavidheiser commented 10 years ago

A possible fix within planout would be to set logger.propagate to False to stop it from propagating to parent loggers.

eytan commented 10 years ago

Thanks @jdavidheiser -- this is exactly the patch suggested by another developer. I just merged this pull request after testing it: https://github.com/facebook/planout/pull/13