2016-04-06 14 views
1

Bir yapılandırma dosyası tarafından günlüğe kaydedilmiş bir flask projem var. Yerel olarak çalışırken bu çalışır, ancak apache wsgi altında çalıştırdığımda, tüm hata iletilerini (yalnızca hataları değil), vhost da kurulan error.log dosyasına yazılır.Tüm günlükler, apache hata günlüğüne kopyalanıyor

Bazı kullanıcılardan sonra, app.logger_name'i ayarlamayı ve app.logger'ı ayarlamayı denediğimi düşündüğüm this issue numaralı telefonu buldum ancak yine de aynı sorunu yaşıyorum.

yapılandırma/logging.yaml: pastebin

Vhost:

<VirtualHost *:80> 
     ServerName myapp.com 

     WSGIDaemonProcess myapp home=/var/www/vhosts/myapp/httpdocs 
     WSGIScriptAlias//var/www/vhosts/myapp/httpdocs/myapp.wsgi 

     <Directory /var/www/vhosts/myapp/httpdocs> 
       WSGIProcessGroup myapp 
       WSGIApplicationGroup %{GLOBAL} 
       Order deny,allow 
       Allow from all 
     </Directory> 

     ErrorLog /var/www/vhosts/myapp/logs/error.log 
     CustomLog /var/www/vhosts/myapp/logs/access.log combined 
</VirtualHost> 

myapp.wsgi:

activate_this = '/var/www/vhosts/myapp/httpdocs/env/bin/activate_this.py' 
execfile(activate_this, dict(__file__=activate_this)) 

import sys 
sys.path.insert(0, '/var/www/vhosts/myapp/httpdocs') 

from run_web import app as application 

run_web.py:

import init 
import logging 
from web import app, api 

init.add_to_syspath() 

init.logging_conf() 

# Flask removes all log handlers so our logs are written to the error log as well. 
app.logger_name = "nowhere" 
app.logger 

logger = logging.getLogger('run_web') 

logger.info('Starting web') 

api.init() 

if __name__ == '__main__': 
    logger.info('Flask running in debug mode') 
    app.debug = True 
    app.run() 

init.logging_conf ():

def logging_conf(): 
    with open('conf/logging.yaml', 'r') as yaml_file: 
     logging_config = yaml.load(yaml_file) 

    dictConfig(logging_config) 

cevap

İlgili konular