Skip to content

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

Open
mrdziuban wants to merge 1 commit into
digital-asset:mainfrom
mrdziuban:logback-test-config
Open

Exclude logback-test.xml from published testing-utils library#593
mrdziuban wants to merge 1 commit into
digital-asset:mainfrom
mrdziuban:logback-test-config

Conversation

@mrdziuban

@mrdziuban mrdziuban commented Jul 27, 2026

Copy link
Copy Markdown

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
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
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.

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
mrdziuban force-pushed the logback-test-config branch from e648c1f to b4be0f2 Compare August 13, 2026 15:24
@mrdziuban

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logback config in tests seems slightly messed up

2 participants