Skip to content
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

Add redirect_stderr option #23

Merged
merged 2 commits into from
Sep 27, 2014
Merged

Add redirect_stderr option #23

merged 2 commits into from
Sep 27, 2014

Conversation

nirs
Copy link
Collaborator

@nirs nirs commented Sep 27, 2014

This patch adds a new redirect_stderr option. When set to False, only
sys.stdout is patched and used for condole output. The default value is
True, keeping the current behavior.

Redirecting stderr can cause the console to become unusable becuase
Python is writing errors to stderr when it cannot raise an exception.
For example, during interpeter shutdown, or when code in del method
raises an exception.

For example, in vdsm, we get this error every few seconds:

Exception RuntimeError: RuntimeError('cannot notify on un-acquired lock',)
in <module 'threading' from '/usr/lib64/python2.7/threading.pyc'> ignored

While fixing such issues may be possible, it may not be practicle in
large code base. Avoding redirection of stderr allow using manhole in
such case.

This patch adds a new redirect_stderr option. When set to False, only
sys.stdout is patched and used for condole output. The default value is
True, keeping the current behavior.

Redirecting stderr can cause the console to become unusable becuase
Python is writing errors to stderr when it cannot raise an exception.
For example, during interpeter shutdown, or when code in __del__ method
raises an exception.

For example, in vdsm, we get this error every few seconds:

    Exception RuntimeError: RuntimeError('cannot notify on un-acquired lock',)
    in <module 'threading' from '/usr/lib64/python2.7/threading.pyc'> ignored

While fixing such issues may be possible, it may not be practicle in
large code base. Avoding redirection of stderr allow using manhole in
such case.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.13%) when pulling a15edb2 on nirs:redirect-stderr into c6144c9 on ionelmc:master.

@ionelmc
Copy link
Owner

ionelmc commented Sep 27, 2014

Very nice. Seems travis has some issue with the coveralls package (unrelated).

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

Successfully merging this pull request may close these issues.

None yet

3 participants