On Oct 15, 8:21 am, Ivan Sagalaev <man...@softwaremaniacs.org> wrote:
> Is it really the case that we want to log everything? I believe that
> logging after initialization is enough. And for my example of a logging

That may be true if you're a Django user, but for a Django developer
working on Django internals, logging can be a good way of diagnosing
problems which could occur anywhere in the system. So the more
coverage, the better.

> handler that uses ORM it's the only way it can work. Initialization by
> definition shouldn't do anything interesting for an application
> programmer to look for, it should either succeed or fail with an
> exception saying that it "can't run your program, sorry".

Again, a logging handler which uses ORM might be fine for many
scenarios, but if there's a problem with the ORM system itself you'd
probably want to diagnose it using file-based handlers.

> As it stands now loading and processing of all the settings is the point
>   that marks success of initialization. So I'm with Simon in putting
> logging somewhere where all the other settings get processed.

Try out my patch on ticket #12012. I'm about to update it to show
three places where you can hook into Django initialization -
Settings.__init__, pre app/model loading and post app/model loading.
My test will demonstrate initialization of logging at the first hook
point, then capture of the class_prepared signal in pre app/model
loading so that model loading can be watched, then post app/model
loading to show that you can use models in the hooked code.

Regards,

Vinay Sajip
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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