2012-08-16 68 views
2

CherryPy服務器將錯誤日誌寫入哪裏?我已經安裝了CherryPy的,並與python3.2CherryPy服務器錯誤日誌

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() 

發射了服務器當我去到URL頁面沒有加載和打印沒有錯誤。

回答

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