107.django日志bug
Posted liuzhanghao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了107.django日志bug相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章
我的Android进阶之旅NDK开发之在C++代码中使用Android Log打印日志,打印出C++的函数耗时以及代码片段耗时详情