Message255299
handle() and emit() are high level methods of a handler, and format() is at a lower level. Not all emit() methods will call format(). For example, socket-based and queue-based handlers don't. So it is not in general possible to separate format() out - you will need to have a customised handler to deal with your somewhat unusual use case, and do whatever you need in there.
Threading is a complex area and while logging is one specific case you may have come across, it's entirely possible to have a situation with any other lock (e.g. in your application) where acquiring the lock and calling __unicode__() on one of your objects will also result in a deadlock. So your proposal wouldn't fix the problem in a general way - just move it so that you might avoid the problem, but a more esoteric use of locks wouldn't necessarily work. In general, to avoid deadlocks, you have to acquire locks in a fixed order, and only you know what those locks are - so you can implement the appropriate acquisition and release code in your handle(). |
|
Date |
User |
Action |
Args |
2015-11-24 23:03:12 | vinay.sajip | set | recipients:
+ vinay.sajip, r.david.murray, fviard |
2015-11-24 23:03:12 | vinay.sajip | set | messageid: <1448406192.11.0.819635226067.issue25668@psf.upfronthosting.co.za> |
2015-11-24 23:03:12 | vinay.sajip | link | issue25668 messages |
2015-11-24 23:03:11 | vinay.sajip | create | |
|