Fredrik Lundh schreef:
> Benedict Verheyen wrote:
> 
>> In other apps, i use the logging module with a RotatingFileHandler, so
>> that i don't have to worry about log files getting to big.
>> Is there a way to use that package too?
> 
> import logging ?
> 
> </F>


Well yes, but if i have to do that in every file and do the settings,
i doesn't look clean.
For instance, here are my settings for logging:

import logging
import logging.handlers
import os

logname = "gema"
logger = logging.getLogger('stats')
hdlr = logging.handlers.RotatingFileHandler( "logs" + os.sep + logname +
'.log', mode="a", maxBytes=500000, backupCount=9 )
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler( hdlr )
logger.setLevel( logging.DEBUG )

Repeating this in every file seems unefficient (what if i want to save
the name of the log or the level and so on)

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.

Regards,
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