Skip to content

Exclude logback-test.xml from published testing-utils library - #593

Merged
andreaslochbihler-da merged 1 commit into
digital-asset:mainfrom
mrdziuban:logback-test-config
Sep 9, 2026
Merged

andreaslochbihler-da merged 1 commit into
digital-asset:mainfrom
mrdziuban:logback-test-config

Conversation

@mrdziuban

@mrdziuban mrdziuban commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Fixes canton-network/splice#5942.

#535 moved community/util-observability/src/test/resources/logback-test.xml to base/testing-utils/src/main/resources/logback-test.xml, resulting in logback-test.xml being bundled in the com.daml::testing-utils JAR file. This conflicts with the logback-test.xml in the splice repo (at canton/community/util-observability/src/test/resources/logback-test.xml) and causes logback to log warnings:

Resource [logback-test.xml] occurs multiple times on the classpath.
Resource [logback-test.xml] occurs at [jar:file:/home/matt/.cache/coursier/v1/https/repo1.maven.org/maven2/com/daml/testing-utils_2.13/3.5.3/testing-utils_2.13-3.5.3.jar!/logback-test.xml]
Resource [logback-test.xml] occurs at [file:/home/matt/Projects/splice/canton/community/util-observability/target/scala-2.13/test-classes/logback-test.xml]

This updates the testing-utils project to modify Compile / packageBin / mappings and exclude log back-test.xml from the published JAR.

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

✅ All required contributors have signed the CLA for this PR. Thank you!
Posted by the CLA Assistant Lite bot.

@mrdziuban

Copy link
Copy Markdown
Contributor Author

I have hereby read the Digital Asset CLA and agree to its terms

@andreaslochbihler-da andreaslochbihler-da left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear @mrdziuban,

Thanks for this suggestion to move the logback-test.xml file. While this prevents the packaging of logback-test.xml, it also destroys the log config for all the tests. For example, if I run a unit test in the sbt shell prior to this PR, the logback-test.xml file ensures that the logs are written to log/canton-test.log. With this PR, this doesn't happen any more on my machine.

Can you look into why this is the case and figure out how to retain the old behavior?

@mrdziuban
mrdziuban force-pushed the logback-test-config branch from f1d3d68 to e648c1f Compare August 13, 2026 15:23
@mrdziuban mrdziuban changed the title Move logback-test.xml to test scope so it's not included in the published library Exclude logback-test.xml from published testing-utils library Aug 13, 2026
@mrdziuban

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look @andreaslochbihler-da. I've updated this to keep logback-test.xml in src/main/resources but to modify the project's Compile / packageBin / mappings to exclude it from the published JAR. This ensures that the file is still on the classpath for tests in other projects (so logs are written), but that it won't affect downstream users of the published JAR.

@mrdziuban
mrdziuban force-pushed the logback-test-config branch from e648c1f to b4be0f2 Compare August 13, 2026 15:24
@mrdziuban

Copy link
Copy Markdown
Contributor Author

Hi @andreaslochbihler-da, I just wanted to check back in on this -- would you mind taking another look when you have a chance? Thanks.

@andreaslochbihler-da

andreaslochbihler-da commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Thanks for taking a look @andreaslochbihler-da. I've updated this to keep logback-test.xml in src/main/resources but to modify the project's Compile / packageBin / mappings to exclude it from the published JAR. This ensures that the file is still on the classpath for tests in other projects (so logs are written), but that it won't affect downstream users of the published JAR.

This seems to work indeed. Thanks. Sorry for taking so long to come back to this.

Can you merge/rebase on the latest main? Then I can trigger a CI run and we can get this merged soon. Thank you

Fixes canton-network/splice#5942.

digital-asset#535 moved `community/util-observability/src/test/resources/logback-test.xml` to `base/testing-utils/src/main/resources/logback-test.xml`, resulting in `logback-test.xml` being bundled in the `com.daml::testing-utils` JAR file. This conflicts with the `logback-test.xml` in the splice repo (at `canton/community/util-observability/src/test/resources/logback-test.xml`) and causes logback to log warnings:

```
Resource [logback-test.xml] occurs multiple times on the classpath.
Resource [logback-test.xml] occurs at [jar:file:/home/matt/.cache/coursier/v1/https/repo1.maven.org/maven2/com/daml/testing-utils_2.13/3.5.3/testing-utils_2.13-3.5.3.jar!/logback-test.xml]
Resource [logback-test.xml] occurs at [file:/home/matt/Projects/splice/canton/community/util-observability/target/scala-2.13/test-classes/logback-test.xml]
```

This updates the `testing-utils` project to modify `Compile / packageBin / mappings` and exclude `logback-test.xml` from the published JAR.

Signed-off-by: Matt Dziuban <mrdziuban@gmail.com>
@mrdziuban

Copy link
Copy Markdown
Contributor Author

This seems to work indeed. Thanks. Sorry for taking so long to come back to this.

Can you merge/rebase on the latest main? Then I can trigger a CI run and we can get this merged soon. Thank you

No problem! Thanks for taking a look. I just rebased on main.

@andreaslochbihler-da andreaslochbihler-da left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot. This should solve the problem.

@andreaslochbihler-da
andreaslochbihler-da merged commit dd2ce77 into digital-asset:main Sep 9, 2026
178 of 182 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 9, 2026
@mrdziuban
mrdziuban deleted the logback-test-config branch September 9, 2026 14:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logback config in tests seems slightly messed up

2 participants