[Grok-dev] Is it easy to create a custom log handler?
Souheil CHELFOUH
trollfot at gmail.com
Fri Mar 26 16:35:15 EDT 2010
from the top of my head something like :
import logging
def generate_logger(name):
path = "/path/to/loggers_folder/%s.log" % name
format = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
# preparing logging.
logger = logging.getLogger(name)
logger.setLevel(logging.INFO)
# files tuning
handler = logging.handlers.RotatingFileHandler(
path, maxBytes=5000000, backupCount=10)
handler.setFormatter(format)
logger.addHandler(handler)
return logger
2010/3/26 Sebastian Ware <sebastian at urbantalk.se>:
> in order to keep z3.log clean I would like to create a custom.log
> where I can log certain activities in my application. Stuff I don't
> want to put in the database.
>
> I understand it such that I should create a custom logger to connect
> to the python logging module. But is there any component in zope3 I
> can use to set this up easily?
>
> Does anyone have some code samples?
>
> Mvh Sebastian
>
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
>
More information about the Grok-dev
mailing list