On Sun, Jun 20, 2010 at 12:19 PM, Russell Keith-Magee
<russ...@keith-magee.com> wrote:
> On Sun, Jun 20, 2010 at 4:59 AM, David North
> <david-django-develop...@dnorth.net> wrote:
>> On 28/05/2010 16:48, Russell Keith-Magee wrote:
>> * They have to be sprinkled all over the place (or in a lot of places, at
>> least) rather than the logging aspect of the application being more
>> centrally defined, which makes it hard to ensure they're consistently where
>> they ought to be
>
> Well.. logging is *always* going to be sprinkled all over the place -
> at some point, you have to be able to say "after you wibble the
> doo-gadget, write X to the log", and the only sensible place to this
> is somewhere in doo_gadget.wibble().

Django should use it's own logger or loggers (for different logical
componets? ORM, Templating etc.) so that Django's internal logging can
be controlled or ignored via logging handlers.

>> One way round this is to use an aspect-oriented approach, which is nice and
>> easy in Python - e.g. http://www.hackersinshape.net/archives/67 - this would
>> allow us to drop decorators onto functions we want logging around, and
>> possibly even do so dynamically for maximum flexibility and ease of
>> maintenance.
>
> I can see how aspect orientation is an alternative approach to the
> central control problem, but I really don't see how it fixes the
> 'sprinkling' problem - instead of logging calls sprinkled everywhere,
> you have metaclasses that automatically sprinkle decorators on
> methods. This gives you less fidelity (since you can only log at the
> enter/exit method level), and adds magic (since you need to understand
> how the metaclass is works in order to understand what is being
> logged).

Direct logging is simpler and would work for most use cases. The
aspect oriented approach would be useful as a separate library or
module separate from Django IMHO.


I've used Zain's jogging for a while as a nice way of using python's
logging module with Django. It might be worthwhile to check it out and
see what it's doing for reference.

http://github.com/zain/jogging

Ian


-- 
=======================================
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
=======================================

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to