6

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.

Ricardo
  • 2,831
  • 4
  • 29
  • 42

2 Answers2

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
  • 1
    Thanks 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
  • @Marco You need to have the true/false value for `escapeHtml`. – Killian Nov 26 '14 at 12:41
  • 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}

jenkins Custom Message slack