When using Email-ext plugin, I would like also to write the last 20 lines of the build log there (not attached as a file) I know I can access the log using $BUILD_LOG variable, but don't know exactly how to take the las 20 lines from that variable. Any help? Thanks a lot.
Asked
Active
Viewed 9,123 times
6
-
How to do the same using groovy script which will then run on jenkins script console? – Tarishi Jain Jun 20 '19 at 07:06
2 Answers
12
You could use the following syntax, from the Content Token reference:
${BUILD_LOG, maxLines, escapeHtml} - Displays the end of the build log. maxLines - display at most this many lines of the log. Defaults to 250. escapeHtml - If true, HTML is escaped. Defaults to false.

EricP
- 980
- 5
- 8
-
1Thanks a lot! I used ${BUILD_LOG, maxLines=50, escapeHtml=false} and worked perfectly. – Ricardo Apr 19 '13 at 07:46
-
When I include "${BUILD_LOG, maxLines=10, escapeHtml}" in the content box I get an email literally with the same line. Can you post how you set this into your content configuration? – Marco RS May 14 '14 at 03:11
-
-
I'm getting a syntax error when i use `${BUILD_LOG, maxLines=50, escapeHtml=false}`. Any ideas why? – Manu Apr 05 '23 at 07:54
0
I am able to get the last 20 lines of BUILD_LOG
${BUILD_LOG, maxLines=20, escapeHtml=false}

vijay yadav
- 1
- 1