Skip to content

Commit a14f0ad

Browse files
authored
Add reachability-metadata.json to all Log4j modules (#3053)
* Add `reachability-metadata.json` to all Log4j modules This PR adds a plugin processor that generates a GraalVM reachability metadata file and bundles it with each Log4j module. After this change, GraalVM will be able to handle Log4j Core without any user intervention. **Note**: I also added a static `resource-config.json` file that specifies that all resources starting with `log4j2` and the plugin descriptor must be included in the GraalVM image. This also includes a small change to Log4j API to include in the GraalVM image the following 3 resource: * `log4j2.component.properties`, * `log4j2.simplelog.properties`, * `log4j2.StatusLogger.properties`
1 parent f90dee8 commit a14f0ad

File tree

12 files changed

+1149
-30
lines changed

12 files changed

+1149
-30
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"resources": {
3+
"includes": [
4+
{
5+
"pattern": "log4j2\\.(component|simplelog|StatusLogger)\\.properties"
6+
}
7+
]
8+
}
9+
}

log4j-core-test/pom.xml

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,60 +63,73 @@
6363

6464
<!-- Additional version of LMAX Disruptor to test -->
6565
<disruptor4.version>4.0.0</disruptor4.version>
66+
<json-unit.version>2.40.1</json-unit.version>
6667
</properties>
6768

6869
<dependencies>
69-
<!-- Pull in useful test classes from API -->
70+
7071
<dependency>
7172
<groupId>org.apache.logging.log4j</groupId>
7273
<artifactId>log4j-api-test</artifactId>
7374
</dependency>
75+
7476
<dependency>
7577
<groupId>org.apache.logging.log4j</groupId>
7678
<artifactId>log4j-core</artifactId>
7779
</dependency>
80+
7881
<dependency>
7982
<groupId>org.assertj</groupId>
8083
<artifactId>assertj-core</artifactId>
8184
</dependency>
85+
8286
<dependency>
8387
<groupId>org.awaitility</groupId>
8488
<artifactId>awaitility</artifactId>
8589
</dependency>
90+
8691
<dependency>
8792
<groupId>commons-io</groupId>
8893
<artifactId>commons-io</artifactId>
8994
</dependency>
95+
9096
<dependency>
9197
<groupId>org.apache.commons</groupId>
9298
<artifactId>commons-lang3</artifactId>
9399
</dependency>
100+
94101
<dependency>
95102
<groupId>org.hamcrest</groupId>
96103
<artifactId>hamcrest</artifactId>
97104
</dependency>
105+
98106
<!-- GC-free -->
99107
<dependency>
100108
<groupId>com.google.code.java-allocation-instrumenter</groupId>
101109
<artifactId>java-allocation-instrumenter</artifactId>
102110
</dependency>
111+
103112
<dependency>
104113
<groupId>junit</groupId>
105114
<artifactId>junit</artifactId>
106115
</dependency>
116+
107117
<dependency>
108118
<groupId>org.junit.jupiter</groupId>
109119
<artifactId>junit-jupiter-api</artifactId>
110120
</dependency>
121+
111122
<dependency>
112123
<groupId>org.junit.platform</groupId>
113124
<artifactId>junit-platform-commons</artifactId>
114125
</dependency>
126+
115127
<!-- Needed for JNDI mocks using `org.springframework.mock.jndi` -->
116128
<dependency>
117129
<groupId>org.springframework</groupId>
118130
<artifactId>spring-test</artifactId>
119131
</dependency>
132+
120133
<!-- JNDI and JMS tests -->
121134
<dependency>
122135
<groupId>org.apache.activemq</groupId>
@@ -129,102 +142,120 @@
129142
</exclusion>
130143
</exclusions>
131144
</dependency>
145+
132146
<dependency>
133147
<groupId>org.apache-extras.beanshell</groupId>
134148
<artifactId>bsh</artifactId>
135149
<scope>test</scope>
136150
</dependency>
151+
137152
<!-- Other -->
138153
<dependency>
139154
<groupId>commons-codec</groupId>
140155
<artifactId>commons-codec</artifactId>
141156
<scope>test</scope>
142157
</dependency>
158+
143159
<!-- Used for compressing to formats other than zip and gz -->
144160
<dependency>
145161
<groupId>org.apache.commons</groupId>
146162
<artifactId>commons-compress</artifactId>
147163
<scope>test</scope>
148164
</dependency>
165+
149166
<dependency>
150167
<groupId>org.apache.commons</groupId>
151168
<artifactId>commons-csv</artifactId>
152169
<scope>test</scope>
153170
</dependency>
171+
154172
<dependency>
155173
<groupId>commons-logging</groupId>
156174
<artifactId>commons-logging</artifactId>
157175
<scope>test</scope>
158176
</dependency>
177+
159178
<!-- Alternative implementation of BlockingQueue using Conversant Disruptor for AsyncAppender -->
160179
<dependency>
161180
<groupId>com.conversantmedia</groupId>
162181
<artifactId>disruptor</artifactId>
163182
<scope>test</scope>
164183
</dependency>
184+
165185
<!-- Required for AsyncLoggers -->
166186
<dependency>
167187
<groupId>com.lmax</groupId>
168188
<artifactId>disruptor</artifactId>
169189
<scope>test</scope>
170190
</dependency>
191+
171192
<dependency>
172193
<groupId>org.zapodot</groupId>
173194
<artifactId>embedded-ldap-junit</artifactId>
174195
<scope>test</scope>
175196
</dependency>
197+
176198
<dependency>
177199
<groupId>org.apache.groovy</groupId>
178200
<artifactId>groovy-dateutil</artifactId>
179201
<scope>test</scope>
180202
</dependency>
203+
181204
<dependency>
182205
<groupId>org.apache.groovy</groupId>
183206
<artifactId>groovy-jsr223</artifactId>
184207
<scope>test</scope>
185208
</dependency>
209+
186210
<dependency>
187211
<groupId>com.h2database</groupId>
188212
<artifactId>h2</artifactId>
189213
<scope>test</scope>
190214
</dependency>
215+
191216
<!-- Embedded JDBC drivers for database appender tests -->
192217
<dependency>
193218
<groupId>org.hsqldb</groupId>
194219
<artifactId>hsqldb</artifactId>
195220
<classifier>jdk8</classifier>
196221
<scope>test</scope>
197222
</dependency>
223+
198224
<!-- Required for JSON support -->
199225
<dependency>
200226
<groupId>com.fasterxml.jackson.core</groupId>
201227
<artifactId>jackson-databind</artifactId>
202228
<scope>test</scope>
203229
</dependency>
230+
204231
<!-- Required for XML layout and receiver support -->
205232
<dependency>
206233
<groupId>com.fasterxml.jackson.dataformat</groupId>
207234
<artifactId>jackson-dataformat-xml</artifactId>
208235
<scope>test</scope>
209236
</dependency>
237+
210238
<!-- Required for YAML support (including JSON requirements) -->
211239
<dependency>
212240
<groupId>com.fasterxml.jackson.dataformat</groupId>
213241
<artifactId>jackson-dataformat-yaml</artifactId>
214242
<scope>test</scope>
215243
</dependency>
244+
216245
<!-- Required for console color support in Windows -->
217246
<dependency>
218247
<groupId>org.fusesource.jansi</groupId>
219248
<artifactId>jansi</artifactId>
220249
<scope>test</scope>
221250
</dependency>
251+
222252
<!-- Used for JMS appenders (needs an implementation of course) -->
223253
<dependency>
224254
<groupId>javax.jms</groupId>
225255
<artifactId>javax.jms-api</artifactId>
226256
<scope>test</scope>
227257
</dependency>
258+
228259
<dependency>
229260
<groupId>org.jspecify</groupId>
230261
<artifactId>jspecify</artifactId>
@@ -235,110 +266,138 @@
235266
<artifactId>javax.mail</artifactId>
236267
<scope>test</scope>
237268
</dependency>
269+
238270
<dependency>
239271
<groupId>javax.mail</groupId>
240272
<artifactId>javax.mail-api</artifactId>
241273
<scope>test</scope>
242274
</dependency>
275+
243276
<!-- Alternative implementation of BlockingQueue using JCTools for AsyncAppender -->
244277
<dependency>
245278
<groupId>org.jctools</groupId>
246279
<artifactId>jctools-core</artifactId>
247280
<scope>test</scope>
248281
</dependency>
282+
249283
<!-- Used for ZeroMQ JeroMQ appender -->
250284
<dependency>
251285
<groupId>org.zeromq</groupId>
252286
<artifactId>jeromq</artifactId>
253287
<scope>test</scope>
254288
</dependency>
289+
255290
<!-- Zeroconf advertiser tests -->
256291
<dependency>
257292
<groupId>org.jmdns</groupId>
258293
<artifactId>jmdns</artifactId>
259294
<scope>test</scope>
260295
</dependency>
261-
<!-- GELF -->
296+
297+
<!-- GELF and other tests that use JSON -->
298+
<dependency>
299+
<groupId>net.javacrumbs.json-unit</groupId>
300+
<artifactId>json-unit-assertj</artifactId>
301+
<version>${json-unit.version}</version>
302+
<scope>test</scope>
303+
</dependency>
304+
262305
<dependency>
263306
<groupId>net.javacrumbs.json-unit</groupId>
264307
<artifactId>json-unit</artifactId>
308+
<version>${json-unit.version}</version>
265309
<scope>test</scope>
266310
</dependency>
311+
267312
<dependency>
268313
<groupId>org.junit.jupiter</groupId>
269314
<artifactId>junit-jupiter-engine</artifactId>
270315
<scope>test</scope>
271316
</dependency>
317+
272318
<dependency>
273319
<groupId>org.junit.jupiter</groupId>
274320
<artifactId>junit-jupiter-params</artifactId>
275321
<scope>test</scope>
276322
</dependency>
323+
277324
<dependency>
278325
<groupId>org.junit-pioneer</groupId>
279326
<artifactId>junit-pioneer</artifactId>
280327
<scope>test</scope>
281328
</dependency>
329+
282330
<!-- JUnit, naturally -->
283331
<dependency>
284332
<groupId>org.junit.vintage</groupId>
285333
<artifactId>junit-vintage-engine</artifactId>
286334
<scope>test</scope>
287335
</dependency>
336+
288337
<!-- Used for Kafka appender -->
289338
<dependency>
290339
<groupId>org.apache.kafka</groupId>
291340
<artifactId>kafka-clients</artifactId>
292341
<scope>test</scope>
293342
</dependency>
343+
294344
<dependency>
295345
<groupId>org.apache.maven</groupId>
296346
<artifactId>maven-core</artifactId>
297347
<scope>test</scope>
298348
</dependency>
349+
299350
<!-- Mocking framework for use with JUnit -->
300351
<dependency>
301352
<groupId>org.mockito</groupId>
302353
<artifactId>mockito-core</artifactId>
303354
<scope>test</scope>
304355
</dependency>
356+
305357
<dependency>
306358
<groupId>org.mockito</groupId>
307359
<artifactId>mockito-junit-jupiter</artifactId>
308360
<scope>test</scope>
309361
</dependency>
362+
310363
<dependency>
311364
<groupId>org.codehaus.plexus</groupId>
312365
<artifactId>plexus-utils</artifactId>
313366
<scope>test</scope>
314367
</dependency>
368+
315369
<!-- Used for testing HttpAppender -->
316370
<dependency>
317371
<groupId>com.github.tomakehurst</groupId>
318372
<artifactId>wiremock-jre8</artifactId>
319373
<scope>test</scope>
320374
</dependency>
375+
321376
<dependency>
322377
<groupId>org.xmlunit</groupId>
323378
<artifactId>xmlunit-core</artifactId>
324379
<scope>test</scope>
325380
</dependency>
381+
326382
<dependency>
327383
<groupId>org.xmlunit</groupId>
328384
<artifactId>xmlunit-matchers</artifactId>
329385
<scope>test</scope>
330386
</dependency>
387+
331388
<!-- Apache Commons Compress -->
332389
<dependency>
333390
<groupId>org.tukaani</groupId>
334391
<artifactId>xz</artifactId>
335392
<scope>test</scope>
336393
</dependency>
394+
337395
<dependency>
338396
<groupId>com.github.luben</groupId>
339397
<artifactId>zstd-jni</artifactId>
340398
<scope>test</scope>
341399
</dependency>
400+
342401
</dependencies>
343402

344403
<build>

0 commit comments

Comments
 (0)