本帖最后由 宝塔用户_mwxxim 于 2024-10-4 12:47 编辑
错误处:
|---Python项目[maotouying]的日志分割任务出错
=================已完成所有日志切割任务==================
----------------------------------------------------------------------------
★[2024-08-12 15:58:18] Successful
----------------------------------------------------------------------------
Traceback (most recent call last):
File "/www/server/panel/script/run_log_split.py", line 137, in main
for_split_func(logsplit, project)
File "class/projectModel/pythonModel.py", line 3256, in for_split
logsplit(project["name"], log_file, project["name"])
File "/www/server/panel/script/run_log_split.py", line 100, in __call__
if self.stype == 'size' and os.path.getsize(sfile) < self.log_size:
File "/www/server/panel/pyenv/lib/python3.7/genericpath.py", line 50, in getsize
return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: '/www/wwwlogs/python/my/uwsgi.log'
关键代码路径
/www/server/panel/class/projectModel/pythonModel.py
- def for_split(self, logsplit, project):
- """日志切割方法调用
- @author baozi <202-03-20>
- @param:
- logsplit ( LogSplit ): 日志切割方法,传入 pjanme:项目名称 sfile:日志文件路径 log_prefix:产生的日志文件前缀
- project ( dict ): 项目内容
- @return
- """
- if project['project_config'["stype" == "python":
- log_file = project['project_config'["logpath" + "/error.log"
- logsplit(project["name", log_file, project["name")
- elif project['project_config'["stype" == "gunicorn":
- log_file = project['project_config'["logpath" + "/gunicorn_error.log"
- logsplit(project["name", log_file, project["name" + "_error")
- log_file2 = project['project_config'["logpath" + "/gunicorn_acess.log"
- logsplit(project["name", log_file2, project["name" + "_acess")
- else:
- log_file = project['project_config'["logpath" + "/uwsgi.log"
- logsplit(project["name", log_file, project["name")
复制代码
需要加一个判断,即可解决
if project['project_config']["stype"] == "python" or project['project_config']["stype"] == "command": |
|