Hi, Steven,
currently it does not generate any output. i am running very simple test
program, and SVN is definitely showing in console output, so I replace
"error' in your template with SVN. My goal is to scan our build console
output, and only display the lines containing "error[s]' or "warning[s]"
in the email body. your template was supposed to achieve the same thing,
right? and also, is this code executed regardless of Jenkins build Status
(SUCCESS/FAILURE/UNSTABLE)?
Thank you so much for your reply, please let me know if you have more
clues. At the mean while, I will try more.
Victoria
On Thursday, April 2, 2015 at 3:33:53 PM UTC-5, Steven Deal wrote:
>
> Hi Victoria,
> I see nothing wrong with what you have. I think the string you are looking
> for would have to be '[SVN]', i.e. it's not a regular expression. You may
> wish to change this to simply 'SVN' to see something captured. Are you
> getting an error or simply not output?
>
> On Thursday, April 2, 2015 at 4:20:56 PM UTC-4, Victoria Wei Lei wrote:
>>
>> hello, Steven,
>>
>> Hope my message reach you out.
>> I used your sample code and replaced the string I want to extract from
>> console log, it would not do anything.
>> I chnage it as text format:
>>
>> <% def rdr= new InputStreamReader(build.getLogInputStream()) %>
>> <% rdr.eachLine{ it -> %>
>> <% if(it.contains("[SVN]")) { %>
>> <% def line= hudson.console.ConsoleNote.removeNotes(it) %>
>> ${line}
>> <% }
>> } %>
>>
>> I will really appreciate it if you can point out what's wrong. (it seems
>> yours was HTML, I change it to text format)
>>
>> Thanks
>> Victoria
>>
>> On Wednesday, December 18, 2013 at 8:16:20 AM UTC-6, Steven Deal wrote:
>>>
>>> Backstory: our build produces a 35000+ line log file (forget turning
>>> down the logging level). A compile error or such might be scattered
>>> anywhere over this output and typically will not be in the last few lines.
>>> Build emails became nearly useless as they rarely showed a developer what
>>> actually failed the build. To fix this, I started making more use of a
>>> custom groovy template and the email-ext plugin to parse out just the
>>> errors from the build log. Something like:
>>>
>>> <% def rdr= new InputStreamReader(build.getLogInputStream()) %>
>>>
>>> <% rdr.eachLine{ it -> %>
>>>
>>> <% if(it.contains("[error]")) { %>
>>>
>>> <% def line= hudson.console.ConsoleNote.removeNotes(it) %>
>>>
>>> <TR><TD class="console">${line}</TD></TR>
>>>
>>> <% } %>
>>>
>>> This worked great from my standpoint. However, many of my developers
>>> check their email through gmail, which clips the message at a certain size.
>>> Investigating this, I noticed that the raw source of the email contained
>>> hundreds of blank lines. Basically, it looks like every line of groovy code
>>> produces an empty line in the email. So looping through this whole log file
>>> produces an insane number of blank lines. I suspect this extra content is
>>> what's causing gmail to clip the message. Given I don't want developers to
>>> have to click through the email to see the compile error, is there an
>>> alternative to avoid this within email-ext/groovy?
>>> -steven
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/4d9beff9-d480-4399-861b-246aea57aa81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.