问题复现:

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/logging-0.4.9.6-py2.6.egg/logging/config.py", line 171, in fileConfig
    qn = cp.get(sectname, "qualname")
  File "/usr/lib64/python2.6/ConfigParser.py", line 556, in get
    raise NoSectionError(section)
NoSectionError: No section: 'logger_ info'


配置文件:

[loggers]
keys=root, info, error
[handlers]
keys=root, info, error
[formatters]
keys=root, info, error

[logger_root]
level=NOTSET
handlers=root
qualname=root
propagate=0
[logger_info]
level=DEBUG
handlers=info, root
qualname=info
propagate=0
[logger_error]
level=WARN
handlers=error, root
qualname=error
propagate=0

[handler_root]
class=StreamHandler
args=(sys.stdout,)
formatter=root
[handler_info]
class=logging.handlers.TimedRotatingFileHandler
;args=('../logs/xmzoomeye-server-info.log', 'd', 1, 7)
args=('logs/xmzoomeye-server-info.log', 'd', 1, 7)
formatter=info
[handler_error]
class=logging.handlers.TimedRotatingFileHandler
;args=('../logs/xmzoomeye-server-error.log', 'd', 1, 7)
args=('logs/xmzoomeye-server-error.log', 'd', 1, 7)
formatter=error

[formatter_root]
format=%(asctime)s - %(levelname)s - %(message)s
datefmt=
[formatter_info]
format=%(asctime)s - %(levelname)s - %(message)s
datefmt=
[formatter_error]
format=%(asctime)s - %(levelname)s - %(filename)s - %(lineno)s - %(message)s
datefmt=


问题排查:

1. 程序中使用logging日志模块记录程序运行日志及错误日志,基于CentOS7 64位系统开发,系统中运行并未异常,但放到CentOS6.5 64位系统出现如上问题

2. 错误信息中发现/usr/lib/python2.6/site-packages/logging-0.4.9.6-py2.6.egg/logging/config.py中的logging竟然有版本号,logging,模块不是内置模块吗?按说在PyPi上不是应该不能重名提交吗?更何况与内置模块同名..

3. 尝试pip uninsatll logging卸载第三方库,我擦勒竟然卸载掉了... 尝试import logging竟然程序一切运行正常~ 我去~ 这是什么鬼?


解决方案:

pip uninstall logging
python xmzoomeye-agent -c app/conf/default.ini -l app/conf/logging.ini