Hi, 

I thought your  following code searches error/warning for each line, and 
only display the lines that contain the message:
"<%
            build.getLog(100).each() { line ->
def styleName = line.matches('.*warning:.*') ? 'warning' : 
(line.matches('.*error:.*') || line.matches('.*undefined reference.*') || 
line.matches('.*Error:.*')) ? 'error' : 'normal'
%>
                <TR><TD 
class="console_${styleName}"><pre>${line}</pre></TD></TR>"

sorry, I don't quite know the groovy script yet, what's the purpose to 
define StyleName? 

I tried another sample which supposed to scan the lines contain "error", 
but it does not produce filtered output either,  any idea? 
<!-- CONSOLE OUTPUT -->
<%
    if(build.result == hudson.model.Result.FAILURE) {
%>
        <TABLE width="100%" cellpadding="0" cellspacing="0">
    <TR><TD class="bg1"><B>PARSED OUTPUT</B></TD></TR>
<%      def rdr= new InputStreamReader(build.getLogInputStream())
        rdr.eachLine{ it -> 
      if(it.contains("[error]")) {
          def line= hudson.console.ConsoleNote.removeNotes(it)  %>
          <TR><TD class="console"><pre>${line}</pre></TD></TR>
<%
            } 
%>      </TABLE>
        <BR/>
<%  } %>
<% } %>

Thank you!
Victoria 

On Thursday, April 2, 2015 at 11:50:49 AM UTC-5, slide wrote:
>
> If you are using what I wrote, it only gets the last 100 lines of the log. 
> You would need to change that somehow to get the information you want.
>
> On Thu, Apr 2, 2015, 09:22 Victoria Wei Lei <weil...@gmail.com 
> <javascript:>> wrote:
>
>> It seems that current template displaying a truncated console output, 
>> below is partial output in my email:
>> "
>>  
>> Building ProductSW/Processes/TaskStarter
>>
>>  Creating directory cpu
>>
>>  C:/QNX650/Host/win32/x86/usr/bin/mkdir -p cpu
>>
>>  Compiling TaskStarter.c
>>
>>  C:/QNX650/Host/win32/x86/usr/bin/qcc -V4.4.2,gcc_ntox86 -c -Wp,-Wall 
>> -Wno-unknown-pragmas -Wp,-Wno-parentheses -DNDEBUG -DPPC_PROC=0 
>> -DBOARD_RENUM -DCT_80 -DTMRU_QNX -msse -msse2 -msse3 -march=prescott 
>> -mfpmath=sse -mstackrealign -O  -Wp,-MD -Wp,cpu/TaskStarter.d 
>> -IC:\Jenkins_buildslave_gen3\workspace\testjob/Processes/IPMI 
>> -IC:\Jenkins_buildslave_gen3\workspace\testjob/QNX_BSP/BSP/src/hardware/startup/lib/x86
>>  
>> -IC:\Jenkins_buildslave_gen3\workspace\testjob/QNX_BSP/BSP/src/hardware/startup/lib/
>>  -IC:\Jenkins_buildslave_gen3\workspace\testjob/Processes/POST -I../Include  
>> -I../../Include -I../../Include\TMSC -I../../Include\Status 
>>
>> -IC:\Intel\libraries\ipp41\ia32_itanium\include 
>> -IC:\Intel\libraries\ipp41\ia32_itanium\tools\staticlib TaskStarter.c -o 
>> cpu/TaskStarter.o
>>
>>  TaskStarter.c: In function &apos;main&apos;:
>>
>>  TaskStarter.c:72: error: expected expression before &apos;<<&apos; token
>>
>>  cc: C:/QNX650/host/win32/x86/usr/lib/gcc/i486-pc-nto-qnx6.5.0/4.4.2/cc1 
>> caught signal 1
>>
>>  make[2]: *** [TaskStarter.o] Error 1
>>
>>  make[2]: Leaving directory 
>> `C:/Jenkins_buildslave_gen3/workspace/testjob/Processes/TaskStarter&apos;
>>
>>  make[1]: *** [TaskStarter.y] Error 2
>>
>>  make[1]: Leaving directory 
>> `C:/Jenkins_buildslave_gen3/workspace/testjob/Processes&apos;
>>
>>  make: *** [Processes.y] Error 2
>>
>>    end   rtm ct80 Thu Apr  2 11:04:50 2015
>>
>>  start sample ct80 Thu Apr  2 11:04:50 2015
>>
>>  Changing to C:\Jenkins_buildslave_gen3\workspace\testjob\TMSC_Sample 
>>
>>  Making the Sample"
>>
>>
>> what I really interested is to only display below lines what contains Error"
>>
>> "TaskStarter.c:72: error: expected expression before '<<' token
>>
>>  make[2]: *** [TaskStarter.o] Error 1
>>
>> make[1]: *** [TaskStarter.y] Error 2
>>
>> make: *** [Processes.y] Error 2"
>>
>> what should I do? 
>>
>> Thanks
>>  
>> On Wednesday, April 1, 2015 at 2:26:18 PM UTC-5, slide wrote:
>>
>>> You would probably just want to modify the template where it outputs the 
>>> lines from the console to match for specific things like "error:" or 
>>> whatever your error messages look like. I've done something similar to 
>>> highlight warnings and errors from GCC output. It's below:
>>>
>>> <!-- CONSOLE OUTPUT -->
>>> <%
>>>     if(build.result == hudson.model.Result.FAILURE) {
>>> %>
>>>         <TABLE width="100%" cellpadding="0" cellspacing="0">
>>>     <TR><TD class="bg1"><B>CONSOLE OUTPUT</B></TD></TR>
>>> <%
>>>             build.getLog(100).each() { line ->
>>> def styleName = line.matches('.*warning:.*') ? 'warning' : 
>>> (line.matches('.*error:.*') || line.matches('.*undefined reference.*') || 
>>> line.matches('.*Error:.*')) ? 'error' : 'normal'
>>> %>
>>>                 <TR><TD class="console_${styleName}"><
>>> pre>${line}</pre></TD></TR>
>>> <%
>>>             } 
>>> %>      </TABLE>
>>>         <BR/>
>>> <%  } %>
>>>
>>> On Wed, Apr 1, 2015 at 11:11 AM Victoria Wei Lei <weil...@gmail.com> 
>>> wrote:
>>>
>>
>>>> Helllo,
>>>>
>>>> I am using parsed console log plugin and Email-ext plugin in Jenkins to 
>>>> send out daily build status, only upon build failure or compiler warnings. 
>>>> I would like to display the extracted error/warning message in the email 
>>>> body. I got groovy email template from "https://github.com/jenkinsci/
>>>> email-ext-plugin/blob/master/src/main/resources/hudson/plugi
>>>> ns/emailext/templates/groovy-html.template". It display Console Output 
>>>> instead of specific error/warning message want. I have zero knowledge on 
>>>> groovy or html et al, it gonna take me sometime to learn and able to 
>>>> modify 
>>>> the template to fulfill my need quickly.
>>>>
>>>> Can someone point me a sample file that can search out either console 
>>>> output or parsed console output and only display the lines contain "error" 
>>>> or "warning"?
>>>>
>>>> Any help is greatly appreciated.
>>>>
>>>> Victoria Lei 
>>>>
>>>> -- 
>>>> 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 jenkinsci-use...@googlegroups.com.
>>>
>>>
>>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>>> gid/jenkinsci-users/71d20ed6-fe68-409c-8f2d-4da254aa1d1c%
>>>> 40googlegroups.com 
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/71d20ed6-fe68-409c-8f2d-4da254aa1d1c%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>  -- 
>> 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 jenkinsci-use...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/c1fe91e9-73bf-4f82-9756-8276bfec7cbd%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/c1fe91e9-73bf-4f82-9756-8276bfec7cbd%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1c38193b-8a78-49ff-8b0c-678c19416284%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to