Skip to content

Commit

Permalink
[issue] #181
Browse files Browse the repository at this point in the history
 load logback config from classpath
  • Loading branch information
p_huityu committed Jan 27, 2022
1 parent 6e7dae8 commit 3cd6a13
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.core.joran.spi.JoranException;
import java.util.Objects;

public class LoggerFactory {
private static final LoggerContext logContext;
Expand All @@ -38,7 +39,9 @@ public static int resetLogBack() {
configurator.setContext(logContext);
logContext.reset();
try {
configurator.doConfigure("logback.xml");

configurator.doConfigure(
Objects.requireNonNull(LoggerFactory.class.getClassLoader().getResource("logback.xml")));
return 0;
} catch (JoranException e) {
e.printStackTrace();
Expand Down

0 comments on commit 3cd6a13

Please sign in to comment.