如何将Webpy的记录器更改为我自己的记录器?

时间:2014-05-29 09:12:39

标签: logging web.py

我使用http://webpy.org/cookbook/logging中的示例,但它无效。

import sys, logging
from wsgilog import WsgiLog
import config

class Log(WsgiLog):
    def __init__(self, application):
        WsgiLog.__init__(
            self,
            application,
            logformat = '%(message)s',
            tofile = True,
            toprint = True,
            file = config.log_file,
            interval = config.log_interval,
            backups = config.log_backups
            )

1 个答案:

答案 0 :(得分:-2)

class Log(WsgiLog):
    def __init__(self, application):
        WsgiLog.__init__(
            self,
            application,
            logformat = '%(message)s',
            loglevel=logging.INFO,
            tofile = True,
            toprint = True,
            file = 'log.txt',
            interval ='s',
            backups =1
            )