Okay.. update.. it does seem to work right, even without forcing the
initialization as you suggested.. which is a relief.. Was losing my mind
(maybe Django 1.3 doesn't require the settings.LOGGING?)  While testing with
prints, I realized the view function I thought should be called wasn't
called until AFTER login..  Oops :)

Thanks all.


Gelonida N wrote:
> 
> On 08/28/2011 12:00 AM, Scott Danzig wrote:
>> 
>> 
>> Gelonida N wrote:
>>> So before your three lines:
>>>> import logging
>>>> logger = logging.getLogger('otherlogger')
>>>> logger.warn('hello')
>>> you had to be sure, that the django settings and thus the logging
>>> configuration has really been completed.
>>>
>>> You could for example add following two lines before:
>>>> from django.conf import settings
>>>> LOGGING = settings.LOGGING # force import
>>>
>>> The second line is needed, as the first line is a 'lazy import' and will
>>> only read the settings and configure logging  when you access the first
>>> time a element of settings.
>>> I just used settings.LOGGING, as it should always exist, when you try to
>>> log.
>>>
>> 
>> Thanks Gelonida.. tried your suggestion and added those two lines before
>> my
>> import logging ... unfortunately no change.  Perhaps it's not
>> straightforward.  Sounds like it wasn't obvious to you either.
> 
> That's weird.
> This works fine for me.
> 
> 
> Just some more things to test:
> 
> 
> Is ee, that you didn't add a root logger in your
> log config.
> 
> you could add following two handlers.
> 
> 
>     'loggers': {
>         # root loggers
>         '': {
>             'handlers': ['console'],
>             'level': 'WARNING', # or 'DEBUG'
>             'propagate': True,
>         },
>         # not sure if this is really useful
>         'root': {
>             'handlers': ['console'],
>             'level': 'WARNING', # or 'DEBUG'
>             'propagate': True,
>         },
> 
> 
> 
> If this doesn't help you could add some print statements to be sure,
> that your settings file is really read.
> 
> 
> 
> You could add a print statement after  the assignment of
> LOGGING in settings.py
> 
> LOGGING={ .. ..}
> print "LOGGING VARIABLE IS SET NOW"
> 
> 
> 
> and in your file.
> 
> print "CHECKPOINT 1"
> from django.conf import settings
> print "CHECKPOINT 2"
> LOGGING = settings.LOGGING # force import
> print "CHECKPOINT 3"
> import logging
> logger = logging.getLogger('otherlogger')
> print "CHECKPOINT 4"
> logger.warn('hello')
> print "CHECKPOINT 5"
> 
> What do you get as output?
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Django-1.3-logging-not-working-as-I%27d-expect-tp32299898p32349771.html
Sent from the django-users mailing list archive at Nabble.com.

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

Reply via email to