CherryPy服务器错误日志

3
CherryPy服务器的错误日志记录在哪里?我已经安装了CherryPy并使用python3.2启动了服务器。
    from cherrypy import wsgiserver

    def my_crazy_app(environ, start_response):
        status = '200 OK'
        response_headers = [("Content-type","text/plain")]
        start_response(status, response_headers)
        return ['Hello world!']

    server = wsgiserver.CherryPyWSGIServer(
                ('0.0.0.0', 80), my_crazy_app,
                server_name='www.cherrypy.example')
    server.start()

当我访问该网址时,页面没有加载,也没有打印任何错误信息。
1个回答

6

您需要指定错误或访问日志文件名。您可以在配置文件中这样做...

[global]
log.error_file = 'Web.log'
log.access_file = 'Access.log'

或者在Python文件中...
cherrypy.config.update({'log.error_file': 'Web.log',
                'log.access_file': 'Access.log'
               })

我想你可能会遇到"端口80未空闲"的错误。尝试把端口号改为8080。

Andrew


1
需要在'Web.log'和'Access.log'周围加上引号,以便将路径识别为字符串。 - clubby789

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接