首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Buildbot主机的http.log错误

Buildbot主机的http.log错误
EN

Stack Overflow用户
提问于 2014-07-17 09:39:59
回答 1查看 536关注 0票数 1

最近,当我试图重新启动我的构建主程序时,由于http.log的一些问题,它失败了。我得到以下错误:

代码语言:javascript
复制
2014-07-17 11:21:55+0200 [-] RotateLogSite starting on 8000
2014-07-17 11:21:55+0200 [-] Starting factory <buildbot.status.web.baseweb.RotateLogSite instance at 0x0295F300>
2014-07-17 11:21:55+0200 [-] Setting up http.log rotating 10 files of 10000000 bytes each
2014-07-17 11:21:55+0200 [-] while starting BuildMaster
    Traceback (most recent call last):
      File "C:\Python27\lib\site-packages\twisted\application\service.py", line 308, in addService
        service.privilegedStartService()
      File "C:\Python27\lib\site-packages\twisted\application\service.py", line 277, in privilegedStartService
        service.privilegedStartService()
      File "C:\Python27\lib\site-packages\twisted\application\internet.py", line 358, in privilegedStartService
        self._waitingForPort = self.endpoint.listen(self.factory)
      File "C:\Python27\lib\site-packages\twisted\internet\endpoints.py", line 461, in listen
        interface=self._interface)
    --- <exception caught here> ---
      File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 108, in execute
        result = callable(*args, **kw)
      File "C:\Python27\lib\site-packages\twisted\internet\posixbase.py", line 482, in listenTCP
        p.startListening()
      File "C:\Python27\lib\site-packages\twisted\internet\tcp.py", line 998, in startListening
        self.factory.doStart()
      File "C:\Python27\lib\site-packages\twisted\internet\protocol.py", line 72, in doStart
        self.startFactory()
      File "C:\Python27\lib\site-packages\twisted\web\http.py", line 1844, in startFactory
        self.logFile = self._openLogFile(self.logPath)
      File "C:\Python27\lib\site-packages\buildbot-0.8.8-py2.7.egg\buildbot\status\web\baseweb.py", line 477, in _openLogFile
        return LogFile.fromFullPath(path, rotateLength=rotateLength, maxRotatedFiles=maxRotatedFiles)
      File "C:\Python27\lib\site-packages\twisted\python\logfile.py", line 48, in fromFullPath
        os.path.dirname(logPath), *args, **kwargs)
      File "C:\Python27\lib\site-packages\twisted\python\logfile.py", line 161, in __init__
        BaseLogFile.__init__(self, name, directory, defaultMode)
      File "C:\Python27\lib\site-packages\twisted\python\logfile.py", line 40, in __init__
        self._openFile()
      File "C:\Python27\lib\site-packages\twisted\python\logfile.py", line 166, in _openFile
        BaseLogFile._openFile(self)
      File "C:\Python27\lib\site-packages\twisted\python\logfile.py", line 64, in _openFile
        self._file = file(self.path, "r+", 1)
    exceptions.IOError: [Errno 22] invalid mode ('r+') or filename: 'E:\\master_dir\\http.log'

我发现我的http.log已经达到了4GB大小,尽管它应该在10 my后旋转。为什么buildbot不能在10 to后旋转http.log?为什么我要得到错误的Invalid mode (r+)?是否有一个构建配置参数来设置http.log的旋转大小?

删除该文件至少解决了启动buildmaster的问题,但我仍然不知道为什么我一开始就会出现这个错误。

我正在运行buildbot版本0.8.8,谢谢。

编辑

正如djmitche所问的,我尝试使用twisted日志记录模块。无论斜杠的顺序如何,它都是很好的记录。

代码语言:javascript
复制
######## TWISTED ##########
from twisted.python.logfile import LogFile

LOG_FILENAME_TWISTED = r'C:\wp\log_rotate_twisted.log'

lf = LogFile.fromFullPath(LOG_FILENAME_TWISTED, rotateLength=20)

# Log some messages
for i in range(20):
    lf.write('i = %d' % i)
EN

回答 1

Stack Overflow用户

发布于 2014-08-02 21:35:57

这可能是Twisted Python的一个问题(我建议添加相应的标记)。

您能否验证日志旋转参数是否设置正确,也许可以通过在_openLogFile中修补_openLogFile来打印rotateLength?重新启动主程序时,打印的输出将出现在twistd.log中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24799969

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档