我正在使用uwsgi和nginx運行一個python燒瓶應用程序。我無法讓應用模塊記錄。如果我自己運行燒瓶應用程序,我可以看到格式正確的日誌,但在uwsgi中,我看到'沒有處理程序可以找到記錄器...'並且日誌丟失。打印顯示正常。有人可以幫助我做錯了什麼嗎?燒瓶+ uwsgi:沒有處理程序可以找到記錄器
感謝
我跑uwsgi作爲
/usr/local/bin/uwsgi --ini /root/uwsgi.ini
# cat /root/uwsgi.ini
[uwsgi]
base=/root/mainapp
app = mainapp
module = %(app)
pythonpath = %(base)
socket = /tmp/mainapp.sock
chmod-socket = 666
callable = app
logto = /var/log/mainapp/app.log
paste-logger = %p
[formatters]
keys: detailed
[handlers]
keys: console
[loggers]
keys: root, module1, module2, module3
[formatter_detailed]
format: %(asctime)s %(name)s:%(levelname)s %(module)s:%(lineno)d: %(message)s
[handler_console]
class: StreamHandler
args: []
formatter: detailed
[logger_root]
level: DEBUG
handlers:
[logger_module1]
level: DEBUG
qualname: module1
handlers: console
[logger_module2]
level: DEBUG
qualname: module2
handlers: console
[logger_module3]
level: DEBUG
qualname: module3
handlers: console
,並在模塊中,我打電話
import logging
log = logging.getLogger('module1')
log.info('hello world')
我確實有logging.conf和燒瓶應用說 進口logging.config logging.config.fileConfig(「logging.conf」)相同的日誌記錄配置 –