Skip to content

Commit a395d82

Browse files
committed
Clean logging configuration in tests
Use log4j (2) consistently and remove old log4j 1 configuration. Closes gh-1476
1 parent 0aa6d3b commit a395d82

File tree

15 files changed

+85
-47
lines changed

15 files changed

+85
-47
lines changed

spring-ws-core/build.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ dependencies {
1717
api("org.springframework:spring-web")
1818
api("org.springframework:spring-webmvc")
1919

20-
optional("commons-httpclient:commons-httpclient")
20+
optional("commons-httpclient:commons-httpclient") {
21+
exclude(group: "commons-logging", module: "commons-logging")
22+
}
2123
optional("jakarta.mail:jakarta.mail-api")
2224
optional("jakarta.servlet:jakarta.servlet-api")
23-
optional("org.apache.httpcomponents:httpclient")
25+
optional("org.apache.httpcomponents:httpclient") {
26+
exclude(group: "commons-logging", module: "commons-logging")
27+
}
2428
optional("org.apache.httpcomponents.client5:httpclient5")
2529
optional("org.apache.ws.xmlschema:xmlschema-core")
2630
optional("org.dom4j:dom4j")
@@ -40,6 +44,7 @@ dependencies {
4044
testImplementation("commons-io:commons-io")
4145
testImplementation("net.minidev:json-smart:jar")
4246
testImplementation("org.apache.logging.log4j:log4j-core")
47+
testImplementation("org.apache.logging.log4j:log4j-slf4j2-impl")
4348
testImplementation("org.assertj:assertj-core")
4449
testImplementation("org.aspectj:aspectjrt")
4550
testImplementation("org.aspectj:aspectjweaver")
Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Configuration status="INFO">
3-
<Appenders>
4-
<Console name="console" target="SYSTEM_OUT">
5-
<PatternLayout
6-
pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{5} - %msg%n" />
7-
</Console>
8-
</Appenders>
9-
<Loggers>
10-
<Root level="info" additivity="false">
11-
<AppenderRef ref="console" />
12-
</Root>
13-
<!-- <Logger name="org.eclipse.jetty" additivity="false" level="debug">-->
14-
<!-- <AppenderRef ref="console" />-->
15-
<!-- </Logger>-->
16-
<!-- <Logger name="org.springframework.ws" additivity="false" level="debug">-->
17-
<!-- <AppenderRef ref="console" />-->
18-
<!-- </Logger>-->
19-
<!-- <Logger name="org.springframework.web" additivity="false" level="debug">-->
20-
<!-- <AppenderRef ref="console" />-->
21-
<!-- </Logger>-->
22-
</Loggers>
3+
<Appenders>
4+
<Console name="console" target="SYSTEM_OUT">
5+
<PatternLayout pattern="%-5level [%t] %c{5} - %msg%n"/>
6+
</Console>
7+
</Appenders>
8+
<Loggers>
9+
<Root level="info" additivity="false">
10+
<AppenderRef ref="console"/>
11+
</Root>
12+
</Loggers>
2313
</Configuration>

spring-ws-platform/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ javaPlatform {
77
}
88

99
dependencies {
10+
api(platform("org.apache.logging.log4j:log4j-bom:2.19.0"))
1011
api(platform("org.eclipse.jetty:jetty-bom:12.0.16"))
1112
api(platform("org.eclipse.jetty.ee10:jetty-ee10-bom:12.0.16"))
1213
api(platform("org.junit:junit-bom:5.11.0"))
14+
api(platform("org.slf4j:slf4j-bom:2.0.17"))
1315
api(platform("org.springframework:spring-framework-bom:6.0.23"))
1416
api(platform("org.springframework.security:spring-security-bom:6.1.9"))
1517
constraints {
@@ -34,7 +36,6 @@ dependencies {
3436
api("org.apache.commons:commons-collections4:4.4")
3537
api("org.apache.httpcomponents.client5:httpclient5:5.2.3")
3638
api("org.apache.httpcomponents:httpclient:4.5.14")
37-
api("org.apache.logging.log4j:log4j-core:2.19.0")
3839
api("org.apache.santuario:xmlsec:3.0.4")
3940
api("org.apache.wss4j:wss4j-ws-security-dom:2.4.3")
4041
api("org.apache.ws.xmlschema:xmlschema-core:2.3.1")
@@ -51,7 +52,6 @@ dependencies {
5152
api("org.jdom:jdom2:2.0.6.1")
5253
api("org.jvnet.staxex:stax-ex:2.1.0")
5354
api("org.mockito:mockito-core:4.11.0")
54-
api("org.slf4j:slf4j-api:2.0.6")
5555
api("org.springframework.hateoas:spring-hateoas:2.1.5")
5656
api("org.xmlunit:xmlunit-assertj:2.10.0")
5757
api("org.xmlunit:xmlunit-core:2.10.0")

spring-ws-security/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ dependencies {
2424
optional("com.sun.xml.messaging.saaj:saaj-impl")
2525
optional("net.sf.ehcache:ehcache")
2626

27+
testImplementation("org.apache.logging.log4j:log4j-core")
28+
testImplementation("org.apache.logging.log4j:log4j-slf4j2-impl")
2729
testImplementation("org.assertj:assertj-core")
2830
testImplementation("org.easymock:easymock")
2931
testImplementation("org.junit.jupiter:junit-jupiter")

spring-ws-security/src/test/resources/log4j.properties

Lines changed: 0 additions & 6 deletions
This file was deleted.
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 status="INFO">
3+
<Appenders>
4+
<Console name="console" target="SYSTEM_OUT">
5+
<PatternLayout pattern="%-5level [%t] %c{5} - %msg%n"/>
6+
</Console>
7+
</Appenders>
8+
<Loggers>
9+
<Root level="info" additivity="false">
10+
<AppenderRef ref="console"/>
11+
</Root>
12+
</Loggers>
13+
</Configuration>

spring-ws-support/build.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ dependencies {
2626
testImplementation("com.icegreen:greenmail")
2727
testImplementation("com.icegreen:greenmail-junit5")
2828
testImplementation("com.icegreen:greenmail-spring")
29-
testImplementation("commons-httpclient:commons-httpclient")
29+
testImplementation("commons-httpclient:commons-httpclient") {
30+
exclude(group: "commons-logging", module: "commons-logging")
31+
}
3032
testImplementation("jakarta.annotation:jakarta.annotation-api")
31-
testImplementation("org.apache.activemq:artemis-jakarta-server")
33+
testImplementation("org.apache.activemq:artemis-jakarta-server") {
34+
exclude(group: "commons-logging", module: "commons-logging")
35+
}
36+
testImplementation("org.apache.logging.log4j:log4j-core")
37+
testImplementation("org.apache.logging.log4j:log4j-slf4j2-impl")
3238
testImplementation("org.assertj:assertj-core")
3339
testImplementation("org.junit.jupiter:junit-jupiter")
3440
testImplementation("org.slf4j:slf4j-api")

spring-ws-support/src/test/resources/log4j.properties

Lines changed: 0 additions & 5 deletions
This file was deleted.
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 status="INFO">
3+
<Appenders>
4+
<Console name="console" target="SYSTEM_OUT">
5+
<PatternLayout pattern="%-5level [%t] %c{5} - %msg%n"/>
6+
</Console>
7+
</Appenders>
8+
<Loggers>
9+
<Root level="info" additivity="false">
10+
<AppenderRef ref="console"/>
11+
</Root>
12+
</Loggers>
13+
</Configuration>

spring-ws-test/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ dependencies {
1414
api("org.xmlunit:xmlunit-legacy")
1515
api("org.xmlunit:xmlunit-placeholders")
1616

17+
testImplementation("org.apache.logging.log4j:log4j-core")
18+
testImplementation("org.apache.logging.log4j:log4j-slf4j2-impl")
1719
testImplementation("org.assertj:assertj-core")
1820
testImplementation("org.easymock:easymock")
1921
testImplementation("org.junit.jupiter:junit-jupiter")

0 commit comments

Comments
 (0)