Skip to content

Suppress logback status logging in tests#6477

Open
mrdziuban wants to merge 1 commit into
canton-network:mainfrom
obsidiansystems:mrdziuban/logback-test/5942
Open

Suppress logback status logging in tests#6477
mrdziuban wants to merge 1 commit into
canton-network:mainfrom
obsidiansystems:mrdziuban/logback-test/5942

Conversation

@mrdziuban

Copy link
Copy Markdown

Fixes #5942

digital-asset/canton#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 this 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 adds a statusListener of ch.qos.logback.core.status.NopStatusListener to the config to suppress the logs, but it doesn't actually fix the issue of there being two logback-test.xml files on the classpath.

If that's not a sufficient fix, there are a couple other alternatives:

  1. Specify the correct config file via Test / javaOptions += "-Dlogback.configurationFile=.../logback-test.xml" -- this would need to be set on every affected sbt project
  2. Move logback-test.xml in the canton repo to src/test/resources (instead of src/main/resources) so it's not bundled in the JAR -- this would then require an update to com.daml::testing-utils once the upstream change is released

Pull Request Checklist

Cluster Testing

  • If a cluster test is required, comment /cluster_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If an upgrade test is required, comment /upgrade_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a hard-migration test is required (from the latest release), comment /hdm_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a logical synchronizer upgrade test is required (from canton-3.5), comment /lsu_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release notes.
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n
  • Include a screenshot for frontend-related PRs - see README or use your favorite screenshot tool

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

Fixes canton-network#5942.

digital-asset/canton#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 this 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 adds a `statusListener` of `ch.qos.logback.core.status.NopStatusListener` to the config to suppress the logs, but it doesn't actually fix the issue of there being two `logback-test.xml` files on the classpath.

Signed-off-by: Matt Dziuban <mrdziuban@gmail.com>
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

5 participants