# Change log group expand behavior on failed jobs

**URL:** <https://forum.buildkite.community/t/change-log-group-expand-behavior-on-failed-jobs/2775>\
**Category:** Features Requests\
**Created:** [March 31, 2023, 4:54am UTC](https://forum.buildkite.community/t/change-log-group-expand-behavior-on-failed-jobs/2775 "2023-03-31T04:54:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![spark](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/spark/32/852_2.png) [@spark](https://forum.buildkite.community/u/spark)\
**Post date:** [March 31, 2023, 4:54am UTC](https://forum.buildkite.community/t/change-log-group-expand-behavior-on-failed-jobs/2775/1 "2023-03-31T04:54:48Z")

</div>

Consider a pipeline like:

```yml
steps:
  - commands:
      - echo --- asd
      - echo asd2
      - echo ~~~ zxc
      - echo zxc2
      - exit 1

```

When this job fails, the `zxc` log group is automatically expanded in the CI logs. IMO, if I’ve explicitly stated a log group is to be de-emphasized, I intend it to always be that way, even in failures. Rather, I think the last _emphasized_ log group should be expanded.

In my pipelines, I generally have a lot of de-emphasized log groups printing out diagnostic information and running some cleanup code at the end of the job. In the case of most pipeline failures, I generally do not want that stuff expanded bc the useful logs would most likely be in the last emphasized group.

---

<div class="post-metadata">

**Author:** ![james.s](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/james.s/32/1305_2.png) [@james.s](https://forum.buildkite.community/u/james.s)\
**Post date:** [March 31, 2023, 5:44am UTC](https://forum.buildkite.community/t/change-log-group-expand-behavior-on-failed-jobs/2775/2 "2023-03-31T05:44:58Z")

</div>

Hey @spark !

Thanks for reaching out to us 👋

Is this usually from when you generally have multiple commands in the same command step and you attempt to emphasise the logs?

---

<div class="post-metadata">

**Author:** ![spark](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/spark/32/852_2.png) [@spark](https://forum.buildkite.community/u/spark)\
**Post date:** [March 31, 2023, 5:48am UTC](https://forum.buildkite.community/t/change-log-group-expand-behavior-on-failed-jobs/2775/3 "2023-03-31T05:48:32Z")

</div>

No, these log groups are coming from test scripts which are invoked in the step command.

More realistically, I have something like:

```yaml
steps:
  - command: run_tests.py

```

And in my script:

```py
print('~~~ test setup')
...
try:
  print('--- running tests')
  ...
finally:
  print('~~~ cleanup')
  ...

```

---

<div class="post-metadata">

**Author:** ![james.s](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/james.s/32/1305_2.png) [@james.s](https://forum.buildkite.community/u/james.s)\
**Post date:** [March 31, 2023, 6:47am UTC](https://forum.buildkite.community/t/change-log-group-expand-behavior-on-failed-jobs/2775/4 "2023-03-31T06:47:56Z")

</div>

Understood 🙂

In that script case, you’d only want to potentially see the Running tests (emphasised) vs the others - even if they fail the script run?

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [March 31, 2023, 4:19pm UTC](https://forum.buildkite.community/t/change-log-group-expand-behavior-on-failed-jobs/2775/5 "2023-03-31T16:19:22Z")

</div>

Hey @spark!

By default, the group that failed will be expanded in the log output.  
You can find that logic in the agent [agent/bootstrap.go at 573d4bf878378c2fb9f0e37de8ae09345a7e6063 · buildkite/agent · GitHub](https://github.com/buildkite/agent/blob/573d4bf878378c2fb9f0e37de8ae09345a7e6063/bootstrap/bootstrap.go#L1631-L1634)

Unfortunately, it’s not a behavior we can change at the moment.

Best,
