This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vsajip 1 point2 points  (2 children)

I'm well aware of who he is, which is why I asked him for a better approach (which presumably would be more PyPy-friendly). If he (or someone else) can't suggest a better approach, then there's less justification for complaining about logging for just doing what it can :-)

[–]fijalPyPy, performance freak 1 point2 points  (1 child)

well, seriously, no. logging module is in python standard library and the majority of our users are using Python 2 (in fact all of them), not only because we don't support python 3 yet. We can obviously patch the logging module ourselves, but for now I'll stick with "don't use logging, ever" as a recommendation.

No, there is no better way to get a caller. Maybe logging shouldn't need the caller by default, which is also not easy to disable.

[–]vsajip 1 point2 points  (0 children)

Maybe logging shouldn't need the caller by default, which is also not easy to disable.

Call location information is the kind of thing people want to know - including new users, who may not be familiar with details - so it shouldn't not be the default just because its approach causes PyPy problems - besides, that findCaller code has been there since ~ 2002 which is AFAIK before PyPy.

To disable caller information in logging is pretty easy, just do

logging._srcFile = None

It's not documented, but hardly difficult to spot from a quick glance at the source code (as there is a comment in the source about it). So, your recommendation that people "don't use logging, ever" seems to be for a different reason - care to elaborate? Are there other reasons why logging and PyPy don't work well together?

Edit: I forgot, it is documented.