diff --git a/readme.md b/readme.md index aa12589..bb2435d 100644 --- a/readme.md +++ b/readme.md @@ -40,4 +40,11 @@ webssh 和 评测的pod分别放到不同的namespace下 **pod命名规则** 1. 评测:environment-tpi 2. webssh: webssh-environment-tpi -3. webssh+评测: evassh-environment-tpi \ No newline at end of file +3. webssh+评测: evassh-environment-tpi + +**多profile配置** +在tomcat/bin目录下的setenv.sh文件中设置了启动时使用的profile, +如: `-Dspring.profiles.active=test` + +**日志** +正式版按天生成,测试版记入catalina.out文件中 \ No newline at end of file diff --git a/src/main/java/com/educoder/bridge/common/settings/AppConfig.java b/src/main/java/com/educoder/bridge/common/settings/AppConfig.java index 33a30c9..d2a8cff 100644 --- a/src/main/java/com/educoder/bridge/common/settings/AppConfig.java +++ b/src/main/java/com/educoder/bridge/common/settings/AppConfig.java @@ -8,7 +8,7 @@ import org.springframework.context.annotation.PropertySource; * Created by guange on 18/02/2017. */ @Configuration("AppConfig") -@PropertySource("classpath:config.properties") +@PropertySource("classpath:config_${spring.profiles.active}.properties") public class AppConfig { @Value("${educoderURL}") diff --git a/src/main/java/com/educoder/bridge/common/utils/RedisPool.java b/src/main/java/com/educoder/bridge/common/utils/RedisPool.java index 6f37da5..129da39 100644 --- a/src/main/java/com/educoder/bridge/common/utils/RedisPool.java +++ b/src/main/java/com/educoder/bridge/common/utils/RedisPool.java @@ -30,7 +30,8 @@ public final class RedisPool { static { try { Properties prop = new Properties(); - prop.load(RedisPool.class.getClassLoader().getResourceAsStream("config.properties")); + String active = System.getProperty("spring.profiles.active"); + prop.load(RedisPool.class.getClassLoader().getResourceAsStream("config_" + active + ".properties")); String ADDR = prop.getProperty("redisAddress"); int PORT = Integer.parseInt(prop.getProperty("redisPort")); diff --git a/src/main/resources/config.properties b/src/main/resources/config_production.properties similarity index 100% rename from src/main/resources/config.properties rename to src/main/resources/config_production.properties diff --git a/src/main/resources/config.properties.test b/src/main/resources/config_test.properties similarity index 100% rename from src/main/resources/config.properties.test rename to src/main/resources/config_test.properties diff --git a/src/main/resources/logback.xml b/src/main/resources/logback_production.xml similarity index 92% rename from src/main/resources/logback.xml rename to src/main/resources/logback_production.xml index d87d79d..d65ddbc 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback_production.xml @@ -7,7 +7,7 @@ %d{MM-dd HH:mm:ss} [%thread] %-5level -- %msg%n - DEBUG + INFO ${log_path}bridge.%d{yyyy-MM-dd}.log @@ -23,7 +23,7 @@ - + diff --git a/src/main/resources/logback_test.xml b/src/main/resources/logback_test.xml new file mode 100644 index 0000000..78a9011 --- /dev/null +++ b/src/main/resources/logback_test.xml @@ -0,0 +1,29 @@ + + + + + + + %d{MM-dd HH:mm:ss} [%thread] %-5level -- %msg%n + + + + DEBUG + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index e6741fa..01c9084 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -21,7 +21,7 @@ logbackConfigLocation - classpath:logback.xml + classpath:logback_${spring.profiles.active}.xml