LOGIN
Sign In or Register
Avatar
Not Registered Yet?

Join Now! It's FREE. Get full access and benefit from this site

Reset My password - Remind Me My username

Username
Password
Remember me

How to attach the jenkins build log as part of the email body?

Way 1 - 

 

Put following lines as part of Default Content text box

${BUILD_LOG, maxLines=9999, escapeHtml=false}

 

this works for free style projects

 

Way 2 - If you want send only specific line using regex

${BUILD_LOG_REGEX, regex="\\b(Buildfile|BUILD)\\b", linesAfter=1}

 

${BUILD_LOG_REGEX, regex="^.*?BUILD FAILED.*?$", linesBefore=0, linesAfter=10, maxMatches=5, showTruncatedLines=false, escapeHtml=true}

 

${BUILD_LOG_REGEX, regex="\\b(FC0)\\b", linesAfter=1}

 

${BUILD_LOG_REGEX, regex="^.*?BUILD FAILED.*?$", linesBefore=0, linesAfter=10, maxMatches=5, showTruncatedLines=false, escapeHtml=true}

 

${BUILD_LOG_REGEX, regex="^.*?FC0.*?$", maxMatches=95, showTruncatedLines=false, escapeHtml=false, matchedLineHtmlStyle=true} 

This will show exactly which is expected lines as part of the regEx.

 

 

More Info 

http://wiki.hudson-ci.org/display/HUDSON/Email-ext+plugin

http://stackoverflow.com/questions/9439450/how-will-i-filter-out-only-errors-in-jenkins-email-ext-build-log-regex

http://champasoft.blogspot.nl/2012/11/jenkins-pattern-for-e-mailing-log.html

Rate this item
(0 votes)
Rajesh Kumar

.

Total, Over 12 years of extensive experience in the Software Configuration Management domain having depth knowledge of DevOps, Continuous Integration and Delivery, Configuration Management, Build and Installer, Release Management and Application Management.

What corporate management say about us?

Rajesh touched a lot of Devops topics and resolved a lots of related queries and doubts. The mentoring method is really smooth and helpful.

Sohit Malik
I'm a Software Engineer, Noida
Sep 02, 2016