# buildDiscarder options directive on declarative pipeline

**URL:** https://community.jenkins.io/t/builddiscarder-options-directive-on-declarative-pipeline/2723
**Category:** Ask a question
**Created:** [June 14, 2022, 5:34pm UTC](https://community.jenkins.io/t/builddiscarder-options-directive-on-declarative-pipeline/2723 "2022-06-14T17:34:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![marioja](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/marioja/32/1669_2.png) [@marioja](https://community.jenkins.io/u/marioja)
#### Post date: [June 14, 2022, 5:34pm UTC](https://community.jenkins.io/t/builddiscarder-options-directive-on-declarative-pipeline/2723/1 "2022-06-14T17:34:13Z")

</div>

My question is related to the buildDiscarder option. I am aware that jenkins core contains the LogRotator as a default buildDiscarder extension implementation. I have observed that if I include buildDiscarder in my declarative pipeline options directive, the LOGGER.log(FINE message at line 149 of the LogRotator will display information twice to the logger. I have observed that if I do not include buildDiscarder in my options directive the message does not appear in the logger.

I do not understand the extension mechanism and I have a couple questions. I see LogRotator extend BuildDiscarder but I do not understand what happens to the LogRotator class when the options directive appears or does not appear. When I say what happens I mean whether the LogRotator class is instantiated or not, what happens to the buildDiscarder extension point with respect to the 4 num to keep and days to keep value and how that affects the logs and artifacts for that job, i.e. is there a jenkins global default when the LogRotator is not instantiated.

I thank you for your time.
