Log Parser Plugin Parser Rules Questions

82 views
Skip to first unread message

Bubunia Patra

unread,
Oct 18, 2016, 1:22:39 AM10/18/16
to Jenkins Users
Hi ,

I want to use Log Parser Plugin with the following regular expression to be matched in the Jenkins console log.


Test case [id] failed
Test case [id] failed
Test case [id] failed


Finished all tests. Executed [id], pass [id], fail [id]

One more thing is I want to get the contents of Error/Info etc in to a table and send across via email? Can I access through groovy script?

 Can anyone help me in this regard?

Regards
Pradeep

Rachel

unread,
Oct 18, 2016, 5:12:20 PM10/18/16
to Jenkins Users
Hi Bubunia,

Parsing rules file could have this content:

info /Finished all tests.*/
error
/Test case .* failed/

And you could send Parsed Console Output with Editable Email Notification:
  • Content Type: HTML
  • Default Content:
<table>
<tr>
<td valign="top">
${FILE, path="$WORKSPACE/../builds/$BUILD_NUMBER/log_ref.html"}
</td>
<td valign="top">
${FILE, path="$WORKSPACE/../builds/$BUILD_NUMBER/log_content.html"}
</td>
</tr>


I hope be useful.

Best regards,
Rachel

Bubunia Patra

unread,
Oct 19, 2016, 12:03:58 PM10/19/16
to Jenkins Users
Thanks a lot Rachel thats really helped. I could see a interesting problem when there are JUNIT failures and so the build failed. But the "Parsed Console Output" captured only this ERROR: Publisher 'Publish JUnit test result report' failed: No test report files were found. Configuration error? 

Where as I was expecting it captures both the instances from the console.log :
ERROR: Publisher 'Publish JUnit test result report' failed: No test report files were found. Configuration error? 
ERROR: Publisher 'Editable Email Notification' aborted due to exception /not really/

# match line starting with 'error ', case-insensitive

error /(?i)^error /
error /ERROR: Publisher .*/
error /Test case .* failed/
error /java.lang .*/

# list of warnings here...
warning /[Ww]arning/
warning /WARNING/

# create a quick access link to lines in the report containing 'INFO'
info /INFO/
info /Finished all tests.*/


# each line containing 'BUILD' represents the start of a section for grouping errors and warnings found after the line.
# also creates a quick access link.

# each line containing 'BUILD' represents the start of a section for grouping errors and warnings found after the line.
# also creates a quick access link.
start /BUILD/

Console logs from Jenkins builds:
=======================
Started by user anonymous
Building on master in workspace /var/lib/jenkins/jobs/abc/workspace
No emails were triggered.
[workspace] $ /bin/sh -xe /tmp/hudson4161516826794033267.sh

[workspace] $ /bin/sh -xe /tmp/hudson4156565298504095007.sh
Build step 'Execute shell' marked build as failure
Archiving artifacts
Recording test results
ERROR: Publisher 'Publish JUnit test result report' failed: No test report files were found. Configuration error?
Sending e-mails to: bubunia...@gmail.com
Email was triggered for: Failure - Any
Sending email for trigger: Failure - Any
ERROR: Publisher 'Editable Email Notification' aborted due to exception: 
java.lang.NoSuchMethodError: org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(Lhudson/model/Run;Lhudson/FilePath;Lhudson/model/TaskListener;Ljava/lang/String;ZLjava/util/List;)Ljava/lang/String;
at hudson.plugins.emailext.plugins.ContentBuilder.transformText(ContentBuilder.java:80)
at hudson.plugins.emailext.ExtendedEmailPublisher.setSubject(ExtendedEmailPublisher.java:706)
at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:595)
at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:355)
at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:345)
at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:253)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
at hudson.model.Build$BuildExecution.cleanUp(Build.java:195)
at hudson.model.Run.execute(Run.java:1791)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
Finished: FAILURE

Rachel Moreno

unread,
Oct 20, 2016, 8:45:31 AM10/20/16
to Jenkins Users
Hi Bubunia,

I think Log Parser Plugin only checks build console output, but not post build actions.

Best regards,
Rachel
Reply all
Reply to author
Forward
0 new messages