Skip to content

Conversation

@yws-tracy
Copy link
Contributor

@yws-tracy yws-tracy commented Feb 12, 2023

Fixes #19494

Motivation

when we use RollingFile, we found log4j2 delete strategy does not work, because the configuration item IfFileName: glob: "*/${sys:pulsar.log.file}*log.gz" in log4j2.yaml has wrong dir path, "*/" of IfFileName should be removed to make log4j2 delete strategy work.

in the log4j2.yaml :

fileName: "${sys:pulsar.log.dir}/${sys:pulsar.log.file}
 DefaultRolloverStrategy:
          Delete:
            basePath: ${sys:pulsar.log.dir}
            maxDepth: 2
            IfFileName:
              glob: "*/${sys:pulsar.log.file}*log.gz"
            IfLastModified:
              age: 30d

DefaultRolloverStrategy's IfFileName has different dir path with log fileName, the "*/" of IfFileName in should be removed, when we change it into glob: "${sys:pulsar.log.file}*log.gz", delete strategy works!

Modifications

remove "*/" of IfFileName in log4j2.yaml

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions
Copy link

@yws-tracy Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Feb 12, 2023
@AnonHxy
Copy link
Contributor

AnonHxy commented Feb 13, 2023

LGTM

@codelipenghui
Copy link
Contributor

/pulsarbot run-failure-checks

@codelipenghui codelipenghui added this to the 3.0.0 milestone Feb 13, 2023
@yws-tracy yws-tracy changed the title [Fix][broker]: make log4j2 delete strategy work [fix][broker]: make log4j2 delete strategy work Feb 13, 2023
@jiazhai
Copy link
Member

jiazhai commented Feb 13, 2023

/pulsarbot run-failure-checks

@yws-tracy
Copy link
Contributor Author

/pulsarbot run-failure-checks

@codelipenghui codelipenghui merged commit 70c4003 into apache:master Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs ready-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] log4j2 delete logs strategy does not work

6 participants