码迷,mamicode.com
首页 > 其他好文 > 详细

107.django日志bug

时间:2020-10-21 21:13:15      阅读:21      评论:0      收藏:0      [点我收藏+]

标签:trap   logging   报错   文件   __init__   inner   traceback   创建   app   

1.django日志bug:

在我启动django项目的时候报错如下,这个错误很奇葩,找不到/usr/local/InfosecTestPlatform/libs/Log/Log_collect.log.这不是我们项目的日志文件么?这里为什么会出错,莫名其妙.

 [root@localhost InfosecTestPlatform]# python3 manage.py runserver 0.0.0.0:8000
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.7/logging/config.py", line 555, in configure
    handler = self.configure_handler(handlers[name])
  File "/usr/local/python3/lib/python3.7/logging/config.py", line 728, in configure_handler
    result = factory(**kwargs)
  File "/usr/local/python3/lib/python3.7/logging/handlers.py", line 147, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/local/python3/lib/python3.7/logging/handlers.py", line 54, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/local/python3/lib/python3.7/logging/__init__.py", line 1041, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/local/python3/lib/python3.7/logging/__init__.py", line 1070, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: ‘/usr/local/InfosecTestPlatform/libs/Log/Log_collect.log‘

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/local/python3/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/python3/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/python3/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "/usr/local/python3/lib/python3.7/site-packages/django/utils/autoreload.py", line 76, in raise_last_exception
    raise _exception[1]
  File "/usr/local/python3/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
    autoreload.check_errors(django.setup)()
  File "/usr/local/python3/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/python3/lib/python3.7/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/usr/local/python3/lib/python3.7/site-packages/django/utils/log.py", line 75, in configure_logging
    logging_config_func(logging_settings)
  File "/usr/local/python3/lib/python3.7/logging/config.py", line 792, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/local/python3/lib/python3.7/logging/config.py", line 563, in configure
    ‘%r‘ % name) from e
ValueError: Unable to configure handler ‘collect‘

我去Log目录下面看了一下然后发现Log_collect.log文件不见了.不见了了就不见了,我重新给你touch 一个,报错如下:

[root@localhost Log]# touch Log_collect.log
touch: cannot touch ‘Log_collect.log’: No such file or directory

我就是不让你创建这个文件,这个名字不知道为什么被占用了创建不出来,没办法我之后试试可不可以touch其他的名称文件没问题,呢就好我给我们的django项目的日志改了一个名字,之后重启好了.至于原因暂时未找到,先让服务起来再说,以后再找.

107.django日志bug

标签:trap   logging   报错   文件   __init__   inner   traceback   创建   app   

原文地址:https://www.cnblogs.com/liuzhanghao/p/13852527.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!