如果 Tomcat 下部署多个项目的时候 logPath 会出现项目之间串用问题,所以启用 customLogPath 名字
This commit is contained in:
@@ -218,6 +218,10 @@ public class PropertiesUtils {
|
|||||||
*/
|
*/
|
||||||
private static Logger initLogger(){
|
private static Logger initLogger(){
|
||||||
String logPath = null;
|
String logPath = null;
|
||||||
|
if (StringUtils.isNotBlank(System.getProperty("customLogPath"))){
|
||||||
|
// 如果 Tomcat 下部署多个项目的时候 logPath 会出现项目之间串用问题,所以启用 customLogPath 名字
|
||||||
|
logPath = System.getProperty("customLogPath");
|
||||||
|
}else{
|
||||||
try {
|
try {
|
||||||
// 获取当前classes目录
|
// 获取当前classes目录
|
||||||
logPath = ResourceUtils.getResource("/").getFile().getPath();
|
logPath = ResourceUtils.getResource("/").getFile().getPath();
|
||||||
@@ -230,9 +234,8 @@ public class PropertiesUtils {
|
|||||||
if (new File(classesLogPath).exists()){
|
if (new File(classesLogPath).exists()){
|
||||||
logPath = classesLogPath;
|
logPath = classesLogPath;
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(System.getProperty("logPath"))){
|
|
||||||
System.setProperty("logPath", FileUtils.path(logPath));
|
|
||||||
}
|
}
|
||||||
|
System.setProperty("logPath", FileUtils.path(logPath));
|
||||||
return LoggerFactory.getLogger(PropertiesUtils.class);
|
return LoggerFactory.getLogger(PropertiesUtils.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user