Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native-image #5

Open
debuglevel opened this issue Jan 24, 2021 · 5 comments
Open

native-image #5

debuglevel opened this issue Jan 24, 2021 · 5 comments

Comments

@debuglevel
Copy link
Owner

Branch feature-graalvm tries to make this template work with native-image. But unclear if it's worth the effort (especially as further dependencies could easily break the whole thing)

@debuglevel
Copy link
Owner Author

master includes a gradle target nativeCompile which works. feature-graalvm additionally includes an adapted Dockerfile.

@debuglevel
Copy link
Owner Author

debuglevel commented Feb 22, 2022

liquibase stuff does not work yet.
/edit maybe see https://build-native-java-apps.cc/native-image/resources/

@debuglevel
Copy link
Owner Author

Current feature-graalvm Dockerfile should work (tested on github actions). But merging master failed with

#23 62.21 Error: Classes that should be initialized at run time got initialized during image building:
#23 62.21  kotlin.jvm.internal.Reflection was unintentionally initialized at build time. To see why kotlin.jvm.internal.Reflection got initialized use --trace-class-initialization=kotlin.jvm.internal.Reflection
#23 62.21 kotlin.KotlinVersion was unintentionally initialized at build time. To see why kotlin.KotlinVersion got initialized use --trace-class-initialization=kotlin.KotlinVersion

Maybe update each dependency on their own to find out what was causing it.

@debuglevel
Copy link
Owner Author

IIRC, the problem is somewhere in LogstashEncoder

diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index c0f15a5..5114e27 100644
--- a/src/main/resources/logback.xml
+++ b/src/main/resources/logback.xml
@@ -39,8 +39,8 @@
     </appender>
 
     <!-- Logs in JSON, which can be useful in combination with e.g. Elasticstack -->
-    <!-- <appender name="json-stdout" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder class="net.logstash.logback.encoder.LogstashEncoder"> -->
+    <appender name="json-stdout" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder class="net.logstash.logback.encoder.LogstashEncoder">
             <!-- Slows down logging but includes where the logging was called from -->
             <!-- <includeCallerData>true</includeCallerData> -->
             
@@ -48,12 +48,12 @@
             <!-- <customFields>{"appname":"myWebservice","roles":["customerorder","auth"],"buildinfo":{"version":"Version 0.1.0-SNAPSHOT","lastcommit":"75473700d5befa953c45f630c6d9105413c16fe1"}}</customFields> -->
 
             <!-- Pretty print JSON as it should not hurt performance but easens debugging -->
-            <!-- <jsonGeneratorDecorator class="net.logstash.logback.decorate.PrettyPrintingJsonGeneratorDecorator"/> -->
+            <jsonGeneratorDecorator class="net.logstash.logback.decorate.PrettyPrintingJsonGeneratorDecorator"/>
 
             <!-- Timestamp is already in ISO-8601, so no customization should be needed. -->
             <!-- <timestampPattern>yyyy-MM-dd'T'HH:mm:ss.SSS</timestampPattern> -->
-    <!--    </encoder>
-    </appender> -->
+        </encoder>
+    </appender>
 
     <root level="info">
         <!-- Use the appender defined by the environment variable LOG_APPENDER or use a default -->

@debuglevel
Copy link
Owner Author

debuglevel commented Aug 1, 2022

Maybe use --no-parallel as it might reduce memory usage?
/edit: nevermind, that is a gradle option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant