Skip to content

Commit 596675d

Browse files
committed
Switch to 2.25.0-SNAPSHOT
1 parent fc13835 commit 596675d

File tree

3 files changed

+42
-30
lines changed

3 files changed

+42
-30
lines changed

.github/workflows/graalvm-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
strategy:
3131
fail-fast: false
3232
matrix:
33-
backend: [ jul, log4j-core, logback, simple]
34-
log4j-version: [ "2.24.1" ]
33+
backend: [ jul, log4j-core-minimal, log4j-core, logback, simple]
34+
log4j-version: [ "2.25.0-SNAPSHOT" ]
3535
uses: apache/logging-log4j-samples/.github/workflows/graalvm-reusable-test.yaml@main
3636
with:
3737
backend: ${{ matrix.backend }}

log4j-samples-graalvm/README.adoc

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ In order to use it:
3333
where `<backend>` can be:
3434
3535
`log4j-core`::
36-
This profile uses Log4j Core as logging backend.
36+
This profile uses Log4j Core as logging backend with its out-of-the-box reachability metadata.
37+
38+
`log4j-core-minimal`::
39+
This profile uses Log4j Core a logging backend with an external reachability metadata source optimized for size.
3740
3841
`logback`::
3942
This profile uses Logback as logging backend.
@@ -95,25 +98,25 @@ Using GraalVM 21.0.4 on Linux x64, the native binaries have the following size:
9598
====
9699
Since this is a trivial Java application, the difference between the binary size without and with Log4j is large: when Log4j is added GraalVM must compile many additional `java.base` classes.
97100
98-
In a typical application those classes are already required, so the difference should be smaller.
101+
In a typical application, those classes are already required, so the difference should be smaller.
99102
====
100103
101104
[cols="1,1"]
102105
|===
103106
| Configuration | Size
104107
105-
| With Log4j Core (minimal reachability metadata)
106-
| 36.13 MiB
108+
| With Log4j Core (manually optimized reachability metadata)
109+
| 36.19 MiB
107110
108-
| With Log4j Core (full reachability metadata)
109-
| Unknown (≥ 38.5 MiB)
111+
| With Log4j Core (embedded full reachability metadata)
112+
| 46.80 MiB
110113
111114
| With Logback
112-
| 30.59 MiB
115+
| 30.62 MiB
113116
114117
| With `java.util.logging`
115-
| 14.03 MiB
118+
| 14.10 MiB
116119
117120
| With `SimpleLogger`
118-
| 13.84 MiB
121+
| 13.90 MiB
119122
|===

log4j-samples-graalvm/pom.xml

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<!-- Dependencies (alphabetical) -->
4444
<assertj.version>3.26.3</assertj.version>
4545
<junit.version>5.11.1</junit.version>
46-
<log4j.version>2.24.1</log4j.version>
46+
<log4j.version>2.25.0-SNAPSHOT</log4j.version>
4747
<logback.version>1.5.8</logback.version>
4848
<slf4j.version>2.0.16</slf4j.version>
4949

@@ -291,10 +291,10 @@
291291
</profile>
292292

293293
<!--
294-
~ Enable this profile to use Log4j Core as logging implementation.
294+
~ Enable this profile to use Log4j Core as logging implementation with a manually crafted metadata file.
295295
-->
296296
<profile>
297-
<id>use-log4j-core</id>
297+
<id>use-log4j-core-minimal</id>
298298

299299
<properties>
300300
<integration-tests-include>**/StandardIT.class</integration-tests-include>
@@ -311,12 +311,17 @@
311311
<build>
312312
<plugins>
313313
<!--
314-
~ Log4j Core needs additional metadata
314+
~ Use a different source of Log4j Core metadata.
315315
-->
316316
<plugin>
317317
<groupId>org.graalvm.buildtools</groupId>
318318
<artifactId>native-maven-plugin</artifactId>
319319
<configuration>
320+
<buildArgs>
321+
<arg>--exclude-config</arg>
322+
<arg>log4j-core.*jar</arg>
323+
<arg>META-INF/native-image/org\.apache\.logging\.log4j/log4j-core/reflect-config\.json</arg>
324+
</buildArgs>
320325
<metadataRepository>
321326
<enabled>true</enabled>
322327
<localPath>${project.basedir}/src/reachability-metadata/minimal</localPath>
@@ -327,6 +332,25 @@
327332
</build>
328333
</profile>
329334

335+
<!--
336+
~ Enable this profile to use Log4j Core as logging implementation with a full metadata file.
337+
-->
338+
<profile>
339+
<id>use-log4j-core</id>
340+
341+
<properties>
342+
<integration-tests-include>**/StandardIT.class</integration-tests-include>
343+
</properties>
344+
345+
<dependencies>
346+
<dependency>
347+
<groupId>org.apache.logging.log4j</groupId>
348+
<artifactId>log4j-core</artifactId>
349+
<scope>runtime</scope>
350+
</dependency>
351+
</dependencies>
352+
</profile>
353+
330354
<!--
331355
~ Enable this profile to use Logback as logging implementation.
332356
-->
@@ -383,21 +407,6 @@
383407

384408
<build>
385409
<plugins>
386-
<!--
387-
~ SimpleLog needs a configuration file
388-
-->
389-
<plugin>
390-
<groupId>org.graalvm.buildtools</groupId>
391-
<artifactId>native-maven-plugin</artifactId>
392-
<configuration>
393-
<metadataRepository>
394-
<enabled>true</enabled>
395-
</metadataRepository>
396-
<buildArgs>
397-
<arg>-H:IncludeResources=log4j2.simplelog.properties</arg>
398-
</buildArgs>
399-
</configuration>
400-
</plugin>
401410
<!--
402411
~ SimpleLogger needs some system properties
403412
-->

0 commit comments

Comments
 (0)