The spring-native sample cloud-function-netty has this in the POM:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
When running with mvn spring-boot:run, it starts up (and even logs something).
When I compile it to a native-image, i get this error:
Exception in thread "main" java.lang.IllegalStateException: No suitable logging system located
at org.springframework.util.Assert.state(Assert.java:76)
at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:160)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:231)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:213)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:79)
at org.springframework.boot.SpringApplicationRunListeners.lambda$starting$0(SpringApplicationRunListeners.java:56)
at java.util.ArrayList.forEach(ArrayList.java:1511)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:56)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:301)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
at com.example.demo.DemoApplication.main(DemoApplication.java:13)
This can be fixed by removing the exclusion, I just wonder why it runs in JVM mode but not on a native-image.
Feel free to close if the use-case is somewhat strange and not supported (expect logging when excluding the logging-starter).
Comment From: wilkinsona
Without the logging starter, we'll fall back to using JavaLoggingSystem. There's a reflective check for the presence of java.util.logging.LogManager and I suspect we're missing a hint for it. I don't see why we wouldn't want to support this on native at some point. If it requires more than a hint for that class, it might be worth deferring it for now.
Comment From: sdeleuze
I suspect this exclusion is coming from a copy and paste from the commandlinerunner sample where we added this exclusion because this use case was broken initially so that makes sense to fix it IMO.
I have refined Spring Framework constant field handling via https://github.com/sdeleuze/spring-framework/commit/5397d4721bfe0790967364bb6e453b9f1d497455 in order to recognize PRESENT fields like used in Spring Boot classes like org.springframework.boot.logging.logback.LogbackLoggingSystem.Factory#PRESENT.
With that change, I just had to add a resource hint for org/springframework/boot/logging/java/logging.properties to make it work. Could you please add that on Spring Boot side like you did for other resources in 1efa474a91bbdcb9ce2fe12772ecbf779160ac3f for example?
Comment From: mhalbritter
Done. @sdeleuze can you please ping me when https://github.com/sdeleuze/spring-framework/commit/5397d4721bfe0790967364bb6e453b9f1d497455 is in SF main?
Comment From: mhalbritter
Nvm, it's already in main. Sorry for the noise.