This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: logging package on IronPython
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: michael.foord, pitrou, vinay.sajip, vstinner
Priority: normal Keywords: patch

Created on 2009-02-17 00:10 by michael.foord, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
logging.patch michael.foord, 2009-02-17 00:10
logging2.patch michael.foord, 2009-02-17 10:21
Messages (9)
msg82285 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-02-17 00:10
IronPython provides sys._getframe but it throws an exception if you call
it with a non-zero depth. Because of this the logging package doesn't
work under IronPython.

It doesn't at all change the behaviour on other platforms (does an
explicit platform check I'm afraid) but fixes a nasty problem with the
logging module not working at all on IronPython. As this is a bugfix for
IronPython at least and IronPython 2.6 is currently being worked on
(tracking Python 2.6) it would be great to get this into 2.6-maint.
msg82310 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-02-17 09:51
Rather than explicit testing for sys.platform, a try...except would be
more flexible and more future-proof.
msg82312 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2009-02-17 10:07
> IronPython provides sys._getframe but it throws an exception 
> if you call it with a non-zero depth.

Stupid question: why not fixing sys._getframe()?
msg82315 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-02-17 10:17
@Victor
IronPython doesn't use Python stack frames, so tracking them and then
constructing the objects on demand would add about a ~10% performance
hit to IronPython. Even when it is done it is likely to be an option
rather than on by default - using _getframe is usually a hack anyway. :-)

@Antoine
Could do that - it would have to trap ValueError. I'd be slightly
worried about it masking other bugs. In previous versions of logging
setting _srcfile to None was *the* mechanism for stopping the use of
_getframe.
msg82316 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-02-17 10:21
Attached is an alternative patch that wraps the call to findCaller in a
try:...except.
msg82349 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2009-02-17 17:50
Fix checked into release26-maint.
msg82351 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-02-17 18:04
Vinay, the fix should also be committed to trunk (unless the relevant
code doesn't exist anymore), and to py3k.
msg82414 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2009-02-18 10:26
I know - I just thought 2.6 was the priority for Michael, so I checked
that in first, then got sidetracked...I'll get on it shortly. I should
have left the issue as "Open" to remind me - correcting that now.
msg82471 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2009-02-19 12:41
Fixes checked into trunk & py3k.
History
Date User Action Args
2022-04-11 14:56:45adminsetgithub: 49537
2009-02-19 12:41:50vinay.sajipsetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg82471
2009-02-18 10:26:01vinay.sajipsetstatus: closed -> open
resolution: fixed -> accepted
messages: + msg82414
2009-02-17 18:04:20pitrousetmessages: + msg82351
2009-02-17 17:50:22vinay.sajipsetstatus: open -> closed
resolution: fixed
messages: + msg82349
2009-02-17 10:21:38michael.foordsetfiles: + logging2.patch
messages: + msg82316
2009-02-17 10:17:02michael.foordsetmessages: + msg82315
2009-02-17 10:07:54vstinnersetnosy: + vstinner
messages: + msg82312
2009-02-17 09:51:57pitrousetnosy: + pitrou
messages: + msg82310
2009-02-17 01:32:10benjamin.petersonsetassignee: vinay.sajip
nosy: + vinay.sajip
2009-02-17 00:10:28michael.foordcreate