Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit dfee895

Browse files
committed
Provide meaningful error message when logback.xml is detected
Closes gh-1415
1 parent d6a07ec commit dfee895

File tree

1 file changed

+11
-0
lines changed
  • spring-native-configuration/src/main/java/org/springframework/boot/logging

1 file changed

+11
-0
lines changed

spring-native-configuration/src/main/java/org/springframework/boot/logging/LogbackHints.java

+11
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.springframework.boot.logging.logback.ColorConverter;
3535
import org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter;
3636
import org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter;
37+
import org.springframework.core.io.ClassPathResource;
3738
import org.springframework.nativex.AotOptions;
3839
import org.springframework.nativex.hint.TypeAccess;
3940
import org.springframework.nativex.hint.MethodHint;
@@ -63,6 +64,9 @@ public class LogbackHints implements NativeConfiguration {
6364

6465
@Override
6566
public void computeHints(NativeConfigurationRegistry registry, AotOptions aotOptions) {
67+
if (new ClassPathResource("logback.xml").exists()) {
68+
throw new LogbackXmlException("Embedded logback.xml file is not supported yet with Spring Native, read the support section of the documentation for more details");
69+
}
6670
if (!aotOptions.isRemoveXmlSupport() &&
6771
ClassUtils.isPresent("org.codehaus.janino.ScriptEvaluator", null) &&
6872
ClassUtils.isPresent("ch.qos.logback.classic.Level", null)) {
@@ -84,4 +88,11 @@ public void computeHints(NativeConfigurationRegistry registry, AotOptions aotOpt
8488
.add(NativeResourcesEntry.of("org/springframework/boot/logging/logback/file-appender.xml"));
8589
}
8690
}
91+
92+
static class LogbackXmlException extends RuntimeException {
93+
94+
public LogbackXmlException(String message) {
95+
super(message, null, true, false);
96+
}
97+
}
8798
}

0 commit comments

Comments
 (0)