Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Parse Build Log #3722

allerasouza ·
Hi, I am working in a job to monitor finished builds. It will search for builds with error, get the error message and analyse it. The problem is that I need the full error message, but using:
eachBuild.getStepRuntimes().get(failed_step)).getErrorMessage();
return a truncated message. There is any way to get the full message or to load the build log to a String?
Thank you and best regards!
  • solved #6
  • replies 6
  • views 1351
  • stars 0
robinshen ADMIN ·
You may call build.renderLogAsText() to get the full log content.
allerasouza ·
Hi, The build "2442631" is one of the builds that I want to check.
I have the following code:

groovy:

import com.pmease.quickbuild.model.Build;
import com.pmease.quickbuild.entitymanager.ConfigurationManager;
import com.pmease.quickbuild.Quickbuild;
import com.pmease.quickbuild.util.MiscUtils;

logger.warn("AAS Inicio");
for (eachBuild in system.buildManager.getAll()) {
if ((eachBuild.id.toString() == "2442631")){
logger.error(eachBuild.renderLogAsText());
}
}
logger.warn("AAS Fim");

But the log of my build is showing nothing. Am I doing something wrong?

Build Log:


Executing pre-execute action...
Running step...
Checking step execute condition...
Step execute condition satisfied, executing...
Executing pre-execute action...
Running step...
AAS Inicio
AAS Fim
Executing post-execute action...
Executing post-execute action...

robinshen ADMIN ·
Where are you running this script, and the build "2442631" represents currently running build?
allerasouza ·

I am running this script at a step "Misc > Execute Script" using groovy language. The build "2442631" is not the current build. It is a finished build with a specific error. It shows me some files that had the error that I will analyse. I am using this static build only for test, but after I will look for all builds with this error. For this reason that I need to parse the build log.

robinshen ADMIN ·

Your script works fine at my side as long as the build id to process is a finished build. Make sure that this step runs on server node as only server node can access build logs.

allerasouza ·

Hi robinshen, thanks for your help. The problem was that I wasn't running it at the server node. I change it and now it is working fine. Thank you for your support!