Skip to content

Logging is inconsistent/broken inside the 'embed' environment. #685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jettisonjoe opened this issue May 19, 2017 · 2 comments
Open

Logging is inconsistent/broken inside the 'embed' environment. #685

jettisonjoe opened this issue May 19, 2017 · 2 comments

Comments

@jettisonjoe
Copy link

Log lines seldom print (if at all) from interactive environment created with a call to embed().

Example (broken) code using bpython:

import logging
import bpython

logging.basicConfig()
l = logging.getLogger()
l.critical('before')
bpython.embed(locals())
l.critical('after')

Output from bpython example:

CRITICAL:root:before
>>> l.critical('inside')
>>> 
CRITICAL:root:after

This is in contrast to the behavior from, say, IPython, which prints log lines correctly.

Example (working) code using IPython:

import logging
import IPython

logging.basicConfig()
l = logging.getLogger()
l.critical('before')
IPython.embed(locals=locals())
l.critical('after')

Output from IPython example:

CRITICAL:root:before
...
In [1]: l.critical('inside')
CRITICAL:root:inside

In [2]:
Do you really want to exit ([y]/n)

CRITICAL:root:after
@thomasballinger
Copy link
Member

Is this related to #658 maybe?

@jettisonjoe
Copy link
Author

Possibly, but that issue specifically calls out "Python 3.4 & 3.5" while I observed this behavior on Python 2.7.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants