Jeremy Dunck schreef:
>> Or i should be doing this in the settings file and importing this in my
>> files. But then again, i use utility classes and then those would have
>> to import settings to be able to use the same logfile. That doesn't feel
>> right.
> 
> After you've done this setup code in settings.py, this is all you need
> in the other files:
> 
> import logging
> logger = logging.getLogger('stats')
> logger.error('hi there')
> 
> ====
> 
> The logging module keeps a registry of loggers and associated
> handlers; calling getLogger gets a reference to logger you already
> configured with the handlers in settings.py.

Hi Jeremy,

indeed that's a way to do it and i have done it like this but i've
encountered something strange. Maybe something with mod_python?

Anyway, i'm setting the logger up in the settings.py file and
afterwards, in other files I import it like you showed.
For instance, i'm trying to add logging to a module that gets data via
odbc and sometimes the connection seems to be interrupted.

The odbc code is placed in a seperate module & package.
I add the import statement for the logger to the module. The "hi there"
statement is printed once as expected but the log statements that are in
the code (functions) that is run, are not printed to the log file.
I know the code is run but the log statements have no effect?

Weird thing is that it works in the custom manipulators code that i use.

I tried defining a new logger in the odbc module and using that logger
to print but that didn't seem to work. Again, only the "hi there
statement is run" and the rest of the logging statements is ignored.

Any idea as to why that is?

Thanks,
Benedict


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to