Skip to content

Commit db8ebef

Browse files
Make classpath Logback config a fallback.
1 parent 6d8e969 commit db8ebef

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

jooby/src/main/java/org/jooby/Jooby.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3198,12 +3198,7 @@ static String logback(final Config conf) {
31983198
logback = conf.getString("logback.configurationFile");
31993199
} else {
32003200
String env = conf.hasPath("application.env") ? conf.getString("application.env") : null;
3201-
if (env != null) {
3202-
URL classpathLogback = Thread.currentThread().getContextClassLoader().getResource("logback." + env + ".xml");
3203-
if (classpathLogback != null) {
3204-
return classpathLogback.toString();
3205-
}
3206-
}
3201+
URL cpconf = Thread.currentThread().getContextClassLoader().getResource("logback." + env + ".xml");
32073202
ImmutableList.Builder<File> files = ImmutableList.builder();
32083203
File userdir = new File(System.getProperty("user.dir"));
32093204
File confdir = new File(userdir, "conf");
@@ -3218,7 +3213,7 @@ static String logback(final Config conf) {
32183213
.filter(f -> f.exists())
32193214
.map(f -> f.getAbsolutePath())
32203215
.findFirst()
3221-
.orElse("logback.xml");
3216+
.orElse((cpconf != null) ? cpconf.toString() : "logback.xml");
32223217
}
32233218
return logback;
32243219
}

0 commit comments

Comments
 (0)