Skip to content

Commit 0b99e22

Browse files
configure detailed log files
1 parent 789b5c2 commit 0b99e22

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

apps/bfd-server-ng/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,23 @@ The Swagger UI is available at `/v3/fhir/swagger-ui`
9494

9595
## Tests
9696

97-
Note that certain Postgres environment variables can interfere with the database connection in the tests, namely `PGSSLMODE`.
97+
Note that certain Postgres environment variables can interfere with the database connection in the tests,
98+
namely `PGSSLMODE`.
9899

99100
You'll probably want to unset these when running the tests from the terminal.
100101

101102
### Regenerating snapshots
102103

103104
Run with `-DupdateSnapshot=` to update the snapshots (yes, the trailing equals is required, unfortunately).
104105

105-
If snapshot tests fail, they will generate a `.patch` file with the difference that can be viewed using your diff tool of choice.
106+
If snapshot tests fail, they will generate a `.patch` file with the difference that can be viewed using your diff tool
107+
of choice.
106108

107109
```sh
108110
mvn clean verify -DupdateSnapshot=
109111
```
112+
113+
### Debugging Tests
114+
115+
Log messages from the server process will not be shown in the console output.
116+
To see detailed log info, look at the files created under `target/failsafe-reports/logs`.

apps/bfd-server-ng/src/main/java/gov/cms/bfd/server/ng/interceptor/ExceptionHandlingInterceptor.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,13 @@
99
import jakarta.servlet.http.HttpServletResponse;
1010
import java.io.IOException;
1111
import lombok.RequiredArgsConstructor;
12-
import org.slf4j.Logger;
13-
import org.slf4j.LoggerFactory;
1412

1513
/***
1614
* Custom exception handling interceptor since the default one is not very customizable.
1715
*/
1816
@RequiredArgsConstructor
1917
@Interceptor
2018
public class ExceptionHandlingInterceptor {
21-
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionHandlingInterceptor.class);
22-
2319
/**
2420
* Handles the server exception.
2521
*

apps/bfd-server-ng/src/test/resources/application.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ spring.jpa.show-sql=true
77
# Generally recommended to disable this in order to prevent database transactions from staying open longer than necessary
88
# See https://www.baeldung.com/spring-open-session-in-view
99
spring.jpa.open-in-view=false
10+
logging.level.root=INFO
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
4+
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
5+
<include resource="org/springframework/boot/logging/logback/file-appender.xml"/>
6+
7+
<property name="LOG_FILE" value="target/failsafe-reports/logs/integration-tests-${PID:-0}.log"/>
8+
9+
<root level="${logback.level:-info}">
10+
<appender-ref ref="CONSOLE"/>
11+
<appender-ref ref="FILE"/>
12+
</root>
13+
</configuration>

0 commit comments

Comments
 (0)