某天 Jenkins 忽然不能構建了,排查了下,發現磁盤滿了。最終定位到 /private/var/log/jenkins/jenkins.log ,這個文件有99GB。。。java
趕忙百度了下。bash
緣由是 DNS查詢錯誤,返回了全部的日誌數據,不斷的寫日誌。ui
在 /Library/LaunchDaemons/org.jenkins-ci.plist 中找到jenkins 的啓動腳本 /Library/Application Support/Jenkins/jenkins-runner.shthis
增長 java的啓動參數 -Dhudson.DNSMultiCast.disabled=truespa
而後重啓 Jenkins 便可日誌
#!/bin/bash
#
# Startup script used by Jenkins launchd job.
# Mac OS X launchd process calls this script to customize
# the java process command line used to run Jenkins.
#
# Customizable parameters are found in
# /Library/Preferences/org.jenkins-ci.plist
#
# You can manipulate it using the "defaults" utility.
# See "man defaults" for details.
defaults="defaults read /Library/Preferences/org.jenkins-ci"
war=`$defaults war` || war="/Applications/Jenkins/jenkins.war"
javaArgs="-Dfile.encoding=UTF-8 -Dhudson.DNSMultiCast.disabled=true"
... 省略 ...
echo "JENKINS_HOME=$JENKINS_HOME"
echo "Jenkins command line for execution:"
echo /usr/bin/java $javaArgs -jar "$war" $args
exec /usr/bin/java $javaArgs -jar "$war" $args
複製代碼