Skip to content

Commit

Permalink
Switch to 2.25.0-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
ppkarwasz committed Oct 4, 2024
1 parent fc13835 commit 596675d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/graalvm-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
strategy:
fail-fast: false
matrix:
backend: [ jul, log4j-core, logback, simple]
log4j-version: [ "2.24.1" ]
backend: [ jul, log4j-core-minimal, log4j-core, logback, simple]
log4j-version: [ "2.25.0-SNAPSHOT" ]
uses: apache/logging-log4j-samples/.github/workflows/graalvm-reusable-test.yaml@main
with:
backend: ${{ matrix.backend }}
Expand Down
21 changes: 12 additions & 9 deletions log4j-samples-graalvm/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ In order to use it:
where `<backend>` can be:
`log4j-core`::
This profile uses Log4j Core as logging backend.
This profile uses Log4j Core as logging backend with its out-of-the-box reachability metadata.
`log4j-core-minimal`::
This profile uses Log4j Core a logging backend with an external reachability metadata source optimized for size.
`logback`::
This profile uses Logback as logging backend.
Expand Down Expand Up @@ -95,25 +98,25 @@ Using GraalVM 21.0.4 on Linux x64, the native binaries have the following size:
====
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.
In a typical application those classes are already required, so the difference should be smaller.
In a typical application, those classes are already required, so the difference should be smaller.
====
[cols="1,1"]
|===
| Configuration | Size
| With Log4j Core (minimal reachability metadata)
| 36.13 MiB
| With Log4j Core (manually optimized reachability metadata)
| 36.19 MiB
| With Log4j Core (full reachability metadata)
| Unknown (≥ 38.5 MiB)
| With Log4j Core (embedded full reachability metadata)
| 46.80 MiB
| With Logback
| 30.59 MiB
| 30.62 MiB
| With `java.util.logging`
| 14.03 MiB
| 14.10 MiB
| With `SimpleLogger`
| 13.84 MiB
| 13.90 MiB
|===
47 changes: 28 additions & 19 deletions log4j-samples-graalvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<!-- Dependencies (alphabetical) -->
<assertj.version>3.26.3</assertj.version>
<junit.version>5.11.1</junit.version>
<log4j.version>2.24.1</log4j.version>
<log4j.version>2.25.0-SNAPSHOT</log4j.version>
<logback.version>1.5.8</logback.version>
<slf4j.version>2.0.16</slf4j.version>

Expand Down Expand Up @@ -291,10 +291,10 @@
</profile>

<!--
~ Enable this profile to use Log4j Core as logging implementation.
~ Enable this profile to use Log4j Core as logging implementation with a manually crafted metadata file.
-->
<profile>
<id>use-log4j-core</id>
<id>use-log4j-core-minimal</id>

<properties>
<integration-tests-include>**/StandardIT.class</integration-tests-include>
Expand All @@ -311,12 +311,17 @@
<build>
<plugins>
<!--
~ Log4j Core needs additional metadata
~ Use a different source of Log4j Core metadata.
-->
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<buildArgs>
<arg>--exclude-config</arg>
<arg>log4j-core.*jar</arg>
<arg>META-INF/native-image/org\.apache\.logging\.log4j/log4j-core/reflect-config\.json</arg>
</buildArgs>
<metadataRepository>
<enabled>true</enabled>
<localPath>${project.basedir}/src/reachability-metadata/minimal</localPath>
Expand All @@ -327,6 +332,25 @@
</build>
</profile>

<!--
~ Enable this profile to use Log4j Core as logging implementation with a full metadata file.
-->
<profile>
<id>use-log4j-core</id>

<properties>
<integration-tests-include>**/StandardIT.class</integration-tests-include>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>

<!--
~ Enable this profile to use Logback as logging implementation.
-->
Expand Down Expand Up @@ -383,21 +407,6 @@

<build>
<plugins>
<!--
~ SimpleLog needs a configuration file
-->
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<metadataRepository>
<enabled>true</enabled>
</metadataRepository>
<buildArgs>
<arg>-H:IncludeResources=log4j2.simplelog.properties</arg>
</buildArgs>
</configuration>
</plugin>
<!--
~ SimpleLogger needs some system properties
-->
Expand Down

0 comments on commit 596675d

Please sign in to comment.