File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
jooby/src/main/java/org/jooby Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 5757
5858import java .io .File ;
5959import java .lang .reflect .Type ;
60+ import java .net .URL ;
6061import java .nio .charset .Charset ;
6162import java .nio .file .Path ;
6263import java .nio .file .Paths ;
@@ -3196,11 +3197,12 @@ static String logback(final Config conf) {
31963197 if (conf .hasPath ("logback.configurationFile" )) {
31973198 logback = conf .getString ("logback.configurationFile" );
31983199 } else {
3200+ String env = conf .hasPath ("application.env" ) ? conf .getString ("application.env" ) : null ;
3201+ URL cpconf = Jooby .class .getResource ("/logback." + env + ".xml" );
31993202 ImmutableList .Builder <File > files = ImmutableList .builder ();
32003203 File userdir = new File (System .getProperty ("user.dir" ));
32013204 File confdir = new File (userdir , "conf" );
3202- if (conf .hasPath ("application.env" )) {
3203- String env = conf .getString ("application.env" );
3205+ if (env != null ) {
32043206 files .add (new File (userdir , "logback." + env + ".xml" ));
32053207 files .add (new File (confdir , "logback." + env + ".xml" ));
32063208 }
@@ -3211,7 +3213,7 @@ static String logback(final Config conf) {
32113213 .filter (f -> f .exists ())
32123214 .map (f -> f .getAbsolutePath ())
32133215 .findFirst ()
3214- .orElse ("logback.xml" );
3216+ .orElse (( cpconf != null ) ? cpconf . toString () : "logback.xml" );
32153217 }
32163218 return logback ;
32173219 }
You can’t perform that action at this time.
0 commit comments