Get access to current build log from within a script step


I would like to get access to the current build log from a script step in order to analyse the log at the end of the build. Depending on the result, particular actions will be executed. Our main use case for this is the following: We run tests during the build which are likely to fail. If a test fails or if another exception let the build fail, we want to automatically create a ticket in our ticket system with all the available information from the build log:

  1. “normal” build steps where executed as before
  2. the step is the “evaluation” step which takes the build log and searches e.g. for exceptions
  3. if an exception has been found, a ticket containing the build log will be created in a foreign ticket system using e.g. a REST call

Get access to the current build log in a script step
Get access to the current build log in a script step

Thanks for creating the #feature-request and for all the details @stefan.hennig!

We’ll have to discuss this quite a bit, to make sure this is the best solution for the use case you described, or come up with something easier than requiring you to write your own log parser just to find the section of information you’re interested in.

Right now we can’t promise that this feature will be prioritized in the near future, but if it gets enough attention (votes) then of course we’ll prioritize it accordingly.



Just an example why this might be a bit misleading if implemented just as a pure “expose the step logs” feature: what if your team mate changes the output tool of the Xcode Test step for example (xcpretty formatted <-> raw xcode log output)?

That will break your parser immediately most likely, and might do it silently, possibly causing a long debugging / “what happened??” session when you start to see strange logs (either incredibly long or completely empty in this case) in your ticketing system.



Just to be sure: I do love your use case, just not sure if this (exposing the logs) would be the best solution, but I don’t have a better idea right now.



@viktorbenei I don’t have a better idea either. However, I expect this being the most easiest solution which will do for sure. Replacing log output tools does not happen spontaneously, and when they do so, they will have an instant feedback… :wink:

For us it would really be enough to just exposing the logs. If it’s not a big deal for you then I would prefer it over a shiny solution, which won’t most likely be implemented…

1 Like


Thanks for the infos @stefan.hennig, we’ll definitely find a solution one way or another, as soon as possible :wink:



Thanks, @viktorbenei! I’m really looking forward to it…



Right now it’s in our backlog, but if it gets enough votes we’ll definitely bump its priority.



I guess I have a similar issue. Is this already solved? I want to log the error reason into slack. As this seems to be a pretty important information to the user, I thought this should be super easy. However. Its not! I tried now several different approaches.

How to get the error reason why the build failed and then put it into a slack message?

I tried by
envman add --key LOG_ERROR --value “grep --color 'error:' mybitrise.log

However, where to get the current log?



@hhamm you can’t get the build log that way right now. You can use the API to fetch the logs once the build is finished as well as use the Outgoing Webhooks to hook build events into your own system, but there’s no built in way to get the build log during the build in a step - that’s what this #feature-request is for! :wink: Vote on it to bump its priority!



I have the same use case, need to parse the error message from current build log in a shell script. where to get the current log in a shell script?



I need to parse error message from build log, and send error info to slack channel before the build is finished. How can I do it?
How to use " Outgoing Webhooks to hook build events into your own system"?



Is this actually ever solved? I have the same issue…