Skip to content

Reconfigure test logging to show error messages#803

Closed
dennisvang wants to merge 4 commits intodevelopfrom
maintenance/test-logging
Closed

Reconfigure test logging to show error messages#803
dennisvang wants to merge 4 commits intodevelopfrom
maintenance/test-logging

Conversation

@dennisvang
Copy link
Copy Markdown
Contributor

@dennisvang dennisvang commented Nov 13, 2025

Current test logging config log4j2.xml does not produce any useful output at all during tests, except for the rudimentary output from the test framework itself. Normal log messages, like those we see when running the app, are suppressed:

<Root level="off"/>

This complicates "debugging" issues on the remote test runners. At the very least we should have some basic error logging.

For this reason:

  • renamed log4j2.xml to log4j2-test.xml, to be more explicit and conformant to log4j autoconfig
  • enable error level logs during tests

Also added an explicit logger for data.repository to illustrate how to change levels for individual packages.

Note

One drawback is that tests which expect an exception to be raised, such as SecurityTest, will generate error messages in the test output. This could be confusing, because you see an error message but the test summary says Failures: 0, Errors: 0. For example, we'll see output like this, which is actually correct:

[INFO] Running POST /search/query
Error:  2025-11-13 15:38:24.621 [http-nio-8088-exec-2] ExceptionControllerAdvice - Invalid SPARQL query
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.035 s -- in POST /search/query

These messages can be suppressed by setting

<Logger name="org.fairdatapoint.api.controller.exception" level="fatal"/>

@dennisvang
Copy link
Copy Markdown
Contributor Author

dennisvang commented Nov 13, 2025

Closing this because it is likely to be confusing.

Actually it is not really necessary either, because often the information we are looking for is already displayed in the surefire output, but obscured by all the clutter.

Just search the test output for the words caused by.

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.

1 participant