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

Commit

Permalink
Refine logback support
Browse files Browse the repository at this point in the history
This commit restores and refines the LogBack substitution to relax
the check on XML files since there is already a check at build
time in LogbackHints and @aclement found a related issue.

The documentation has been updated to recommend using embedded
logback-spring.xml and the logger sample is now mentioned.

Closes gh-1505
  • Loading branch information
sdeleuze committed Mar 1, 2022
1 parent 78f1ac4 commit 0e62dcb
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion samples/logger/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

${PWD%/*samples/*}/scripts/compileWithMaven.sh $* && ${PWD%/*samples/*}/scripts/test.sh $* --logging.config=src/main/resources/logback-config.xml
${PWD%/*samples/*}/scripts/compileWithMaven.sh $* && ${PWD%/*samples/*}/scripts/test.sh $*
4 changes: 2 additions & 2 deletions spring-native-docs/src/main/asciidoc/support.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ implementation("org.springframework.boot:spring-boot-starter-actuator") {
* `spring-boot-starter-jdbc`
* `spring-boot-starter-logging`
** Logback is supported with some limitations
*** Configuration with `logback.xml` embedded in the application https://github.com/spring-projects-experimental/spring-native/issues/625[is not supported yet].
*** Logback XML configuration via `myapp -Dlogging.config=logback-config.xml` or `myapp --logging.config==logback-config.xml` is supported but you need to enable <<spring-aot-configuration, XML support>> and add https://search.maven.org/artifact/org.codehaus.janino/janino[`org.codehaus.janino:janino` dependency].
*** Configuration with embedded `logback.xml` https://github.com/spring-projects-experimental/spring-native/issues/625[is not supported yet].
*** Configuration with embedded `logback-spring.xml`, via `myapp -Dlogging.config=logback-config.xml` or `myapp --logging.config=logback-config.xml` is supported but you need to enable <<aot-build-setup-configuration, XML support>> and add https://search.maven.org/artifact/org.codehaus.janino/janino[`org.codehaus.janino:janino` dependency] (see the `logger` sample).
*** http://logback.qos.ch/manual/configuration.html#conditional[Conditional processing in Logback] configuration with Janino library has limited support. Only simple expressions of `isDefined()` and `isNull()` having string literal as argument are supported.
*** See <<logback-workaround, this workaround>> to configure it programmatically.
** Log4j2 is not supported yet, see https://github.com/spring-projects-experimental/spring-native/issues/115[#115].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ public void configureByResource(URL url) throws JoranException {
final String urlString = url.toString();
if (urlString.endsWith("groovy")) {
throw new LogbackException("Logback Groovy configuration is not supported on native");
} else if (urlString.endsWith("xml")) {
throw new LogbackException("Logback XML configuration is not supported yet, see https://github.com/spring-projects-experimental/spring-native/issues/625");
}
}
}

0 comments on commit 0e62dcb

Please sign in to comment.