2014-07-17 31 views
1

最近,當我嘗試重新啓動我的buildmaster時,由於http.log存在一些問題,它失敗了。我得到以下錯誤:Buildbot master的http.log錯誤

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大小,雖然它應該10MB後旋轉。爲什麼buildbot在10MB後無法旋轉http.log?爲什麼我得到錯誤Invalid mode (r+)?是否有一個構建配置參數來設置http.log的旋轉大小?

刪除文件atleast解決了啓動buildmaster的問題,但我仍然無能爲力,爲什麼我最初得到這個錯誤。

我正在運行buildbot版本0.8.8 謝謝。

編輯

由於提問者djmitche,我試着用twisted日誌模塊。它記錄的很好,不管斜線的順序如何。

######## 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) 
+0

也許你應該寫信給buildbot郵件列表,這裏沒有太多支持 – hithwen

+0

Yeap tats true !!不管怎麼說,多謝拉。 – sk11

+0

Twisted示例與Buildbot不同 - Buildbot使用'LogFile.fromFullPath'。嘗試讓您的示例更接近Buildbot的功能(請參閱baseweb.py)。 '日誌記錄'的例子是不相關的,所以你可以離開它。 – djmitche

回答

0

這可能是扭曲的Python的問題(我建議添加相應的標籤)。

您可以通過在_openLogFile中修改C:\Python27\lib\site-packages\buildbot-0.8.8-py2.7.egg\buildbot\status\web\baseweb.py打印rotateLength來驗證日誌旋轉參數設置是否正確?當您重新啓動主設備時,打印輸出將出現在twistd.log中。

+0

是的,也許這是Twisted的問題。 我按照你的建議試過,它說10000000字節(10MB),與問題中的日誌消息相同。 我剛剛注意到'http.log'和'twisted.log'超過了10MB,目前是250 + MB – sk11

+0

你使用的是什麼版本的Twisted? – djmitche

+0

我正在使用版本13.1.0 – sk11