我正在使用当前版本的社区版本:graalvm/native-image 22.1.0
的项目对记录框架logback(版本1.2.3)具有依赖性
我 graalvm本地形象抱怨:
错误:java.util.concurrent.executionException:
com.oracle.graal.pointsto.constraints.unsupportedfeatureexception:否
图像中允许CH.QOS.LOGBACK.CLASSIC.LOGGER的实例
堆由于该类应在图像运行时初始化。看看如何
该对象有实例化使用
-Trace-Object-Instantiation = CH.QOS.LOGBACK.CLASSIC.LOGGER。
我播放了许多不同的设置排列,例如 - initialize-at-run time = \< logback class \>
and and - initialize-at-at-run-完整列表时间
我尝试使用 java -agentlib生成反射配置文件
:native-image-agent = config-out-agent = config-output-dir = meta-inf/native-imimage -jar build-jar build/myjar-all.jar < /code>
并将其添加到配置文件中
-H:ReflectionConfigurationFiles = Reflect-config.json
但没有成功。始终获取不同的错误消息,全部与记录有关。
所以我的问题是:
有人在以前与Graalvm成功编译了Rogback?
I'm using the current version of community edition: GraalVM/native-image 22.1.0
My project has a dependency to the logging framework logback (version 1.2.3)
If I want to compile my "all-in-one" jar with graalVM the native-image complains:
Error: java.util.concurrent.ExecutionException:
com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No
instances of ch.qos.logback.classic.Logger are allowed in the image
heap as this class should be initialized at image runtime. To see how
this object got instantiated use
--trace-object-instantiation=ch.qos.logback.classic.Logger.
I played around with many different permutations of settings e.g. --initialize-at-run-time=\<complete list of logback classes\>
and --initialize-at-run-time
I tried to generate a reflection configuration file with
java -agentlib:native-image-agent=config-output-dir=META-INF/native-image -jar build/myjar-all.jar
and added it to the config file with
-H:ReflectionConfigurationFiles=reflect-config.json
But without success. Always getting different error messages all related to logback.
So my question:
Has anyone got logback successfully compiled with graalvm before?
发布评论
评论(2)
简短答案 - 您应该将
ch.qos.logback
添加到- initialize-at-at-at-at-at-at-at-time
:有关详细信息,我想发布我所做的工作来制作
logback
与Graalvm一起工作。在
build.gradle
文件中,我添加了有关在构建时间,运行时以及文件路径中应包含的内容的指令,其中包含反射配置:这是
reflection-config的内容.json
文件:我使用此
logback.xml
文件:Short answer - you should add
ch.qos.logback
to--initialize-at-build-time
:For details, I would like to post what I have done to make
logback
working with GraalVM.In the
build.gradle
file, I added instructions about what should be included at build time, at run time and also path to the file contains reflection configuration:Here is the content of
reflection-config.json
file:I use this
logback.xml
file:也许我迟到了回答,但这可能会对某人有所帮助。我还面临着
logback.xml
初始化的问题。在搜索解决方案时,我发现Spring建议将文件命名为
logback-spring.xml
而不是logback.xml
请参阅此处
Maybe I am late to answer but this may help someone. I was also facing issues with
logback.xml
initialisation.While searching for solution I found that spring suggests to name the file as
logback-spring.xml
instead oflogback.xml
See here https://docs.spring.io/spring-boot/docs/2.1.13.RELEASE/reference/html/boot-features-logging.html