Bug 849917
Summary: | error messages shall be logged to stderr rather than to stdout | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise MRG | Reporter: | Petr Matousek <pematous> | ||||
Component: | qpid-tools | Assignee: | messaging-bugs <messaging-bugs> | ||||
Status: | NEW --- | QA Contact: | MRG Quality Engineering <mrgqe-bugs> | ||||
Severity: | low | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | Development | CC: | jross | ||||
Target Milestone: | --- | Keywords: | Improvement | ||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Enhancement | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | |||||||
: | 1082102 (view as bug list) | Environment: | |||||
Last Closed: | Type: | Bug | |||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 1082102 | ||||||
Attachments: |
|
Description
Petr Matousek
2012-08-21 08:34:59 UTC
Created attachment 879838 [details]
proposed patch
note: the patch also removes extra trailing spaces
Comment on attachment 879838 [details] proposed patch This works well for qpid-config. We'll need to make similar changes to the other python tools. You might consider using the new print function syntax: from __future__ import print_function and adding a function: def print_stderr(str): print(str, file=sys.stderr) and then calling print_stderr() whenever you explicity want to print to stderr. The pros of doing this are - It is future-proof in that it is the recommended way for python 2.x and 3.x - Calling a function named print_stderr is self-documenting The big con of doing this is that all print statements would need to be changed to print functions. See http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function (In reply to Ernie from comment #5) > Comment on attachment 879838 [details] > proposed patch > > This works well for qpid-config. We'll need to make similar changes to the > other python tools. > > You might consider using the new print function syntax: > from __future__ import print_function > and adding a function: > def print_stderr(str): > print(str, file=sys.stderr) > > and then calling print_stderr() whenever you explicity want to print to > stderr. > The pros of doing this are > - It is future-proof in that it is the recommended way for python 2.x and 3.x > - Calling a function named print_stderr is self-documenting > > The big con of doing this is that all print statements would need to be > changed to print functions. > > See http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function Unfortunately, I don't think we can use print_function. It appears to have become available in python 2.6, and el5 is python 2.4. (In reply to Justin Ross from comment #6) > (In reply to Ernie from comment #5) > > Comment on attachment 879838 [details] > > proposed patch > > > > This works well for qpid-config. We'll need to make similar changes to the > > other python tools. > > > > You might consider using the new print function syntax: > > from __future__ import print_function > > and adding a function: > > def print_stderr(str): > > print(str, file=sys.stderr) > > > > and then calling print_stderr() whenever you explicity want to print to > > stderr. > > The pros of doing this are > > - It is future-proof in that it is the recommended way for python 2.x and 3.x > > - Calling a function named print_stderr is self-documenting > > > > The big con of doing this is that all print statements would need to be > > changed to print functions. > > > > See http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function > > Unfortunately, I don't think we can use print_function. It appears to have > become available in python 2.6, and el5 is python 2.4. Eeks, my mistake. This is targeted for versions of RHEL > 5, so Ernie's advice stands. Actually it shall be addressed in both 2.x and 3.x, so leaving this bug tracking 2.x defect and cloning for 3.x. |