Skip to content

Commit

Permalink
Polish alibaba#94 : adapter modular logback whether current applicati…
Browse files Browse the repository at this point in the history
…on is Spring or Spring Boot
  • Loading branch information
mercyblitz committed Oct 2, 2018
1 parent e91ccc9 commit 0424a4a
Show file tree
Hide file tree
Showing 10 changed files with 423 additions and 338 deletions.
1 change: 0 additions & 1 deletion config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@
</plugins>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>application.properties</exclude>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package com.alibaba.nacos.config.server.utils;

import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.core.joran.spi.JoranException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -28,30 +25,6 @@
*/
public class LogUtil {

static {
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
lc.reset();

JoranConfigurator configurator = new JoranConfigurator();

String nacosDir = System.getProperty("nacos.home");
if (StringUtils.isBlank(nacosDir)) {
configurator.setContext(lc);
try {
configurator.doConfigure(LogUtil.class.getResource("/nacos-config-logback.xml"));
} catch (JoranException e) {
System.err.println("init logger fail by nacos-config-logback.xml");
}
} else {
configurator.setContext(lc);
try {
configurator.doConfigure(nacosDir + "/conf/nacos-logback.xml");
} catch (JoranException e) {
System.err.println("init logger fail by " + nacosDir + "/conf/nacos-logback.xml");
}
}
}

/**
* 默认的日志
*/
Expand Down
Loading

0 comments on commit 0424a4a

Please sign in to comment.