-
Notifications
You must be signed in to change notification settings - Fork 355
Logback's File Appender in build time causes failed native image creation #8
Comments
Native image generation forbids file descriptors because they won't exist at runtime. |
Hey. If I were exploring this, I'd look at where the If initialization can't control it you can look at using a substitution to patch behaviour (see the source files in the project that start |
Hi. Thanks for the reply. I've added several On the other hand, the use of substitutions might help. I'll try to take a look on that. |
help!! any update on this issue? |
What happens here is that One way to fix that would be performing late initialization of the logging subsystem in Spring. The other would be to switch back to runtime initialization by default. We need to evaluate if they are other use cases (Socket?), if that's mainly limited to Spring (likely since Spring bootstrap the application) and if other Spring portfolio projects would be ok to switch to lazy logging system initialization or not (let start by Boot, Data and Security). |
After more thoughts and discussion within the team, we have decided to move toward runtime class initialization to increase compatibility and avoid this kind of non trivial issue. I have updated non Netty based samples to use runtime init. We will update Netty samples as well only in 0.7 since it is currently not possible to use Netty with runtime init. I have updated our documentation accordingly to provide guidance about that. |
Hi. I'm working on a project involving Spring Boot with WebSockets, and using Logback Classic as the logging implementation API.
The project is packaged on a war file with an embedded Tomcat.
Here are the logging dependencies in
pom.xml
:and this is the
logback.xml
located atsrc/main/resources
As you can see above, the logging configuration file defines a File Appender (specifically the
RollingFileAppender
) which will create a file when the logging backend is instanciated at boot time.The problem is that I'm not able to create a native image with file creation during native image build time.
After collecting every class involved in build time for the reflective instantiation of logback's file appender and put them into respective Spring Graal Feature files:
initialization.json, proxies.json, reflect.json, resources.json
(see attached file
native-image-missing-features.txt
)I get the next message:
Which is due to the attempt of a file creation given the
File Appender
configured inlogback.properties
.See file attached file
native-image-missing-features.txt
to get an idea of all the missing features I had to add.Is this caused by a misconfiguration on my project? Or is it a missing feature to allow logback's file appender correctly create a file descriptor in build time?
Aside note: if I use an empty logback.xml (I mean no appenders) then the error message disappears.
native-image-missing-features.txt
The text was updated successfully, but these errors were encountered: