zain / jogging

Easier Django logging!
MIT License
103 stars 5 forks source link

exception() shouldn't mess with the source argument if passed. #2

Open ianlewis opened 15 years ago

ianlewis commented 15 years ago

If the source argument is passed to the exception() method in LoggingWrapper, it should be used as is rather than inserting the request path or "Exception".

sadohert commented 14 years ago

I'm not sure if my problem is the same thing. When I go to run my tests I have a case where I'm testing a view, so doing a POST, and my view handling has a problem so Django throws an exception. When this gets into the logger.exception handler both exception AND request are non-null, so the request object seems to take precedence, and force the "source" of the log to a web address, instead of "Exception", which eventually doesn't work for me because the global logger gets returned by get_logger(source), and then the "source" parameter gets appended to the keyword args, taht get passed into the normal python logger, who chokes because he doesn't know what the "source" parameter is for.

ianlewis commented 14 years ago

Yes, this is sort of the same thing. The original functionality is there so that you know what URL caused the exception but it is a problem because get_logger() will return the root logger for all exceptions coming from a view (request is not None).

So what you are describing is really the root of the issue and needs to be fixed before this bug gets closed. Just to note also, this bug will occur outside of tests, in normal view code, as well.