wangwei 5 tahun lalu
induk
melakukan
39ebf5bc4a

+ 16 - 0
src/main/java/cn/com/qmth/examcloud/web/config/SystemProperties.java

@@ -27,6 +27,8 @@ public class SystemProperties {
 
 	private String tempDataDir;
 
+	private String logDir;
+
 	/**
 	 * 构造函数
 	 *
@@ -45,6 +47,12 @@ public class SystemProperties {
 			tempDataDir = PathUtil.getCanonicalPath(new File(path));
 		}
 
+		if (StringUtils.isBlank(logDir)) {
+			String classpath = ClasspathHelper.getClasspath();
+			String path = new File(classpath).getParent() + File.separator + "logs";
+			logDir = PathUtil.getCanonicalPath(new File(path));
+		}
+
 		try {
 			FileUtils.forceMkdir(new File(dataDir));
 		} catch (IOException e) {
@@ -75,4 +83,12 @@ public class SystemProperties {
 		this.tempDataDir = tempDataDir;
 	}
 
+	public String getLogDir() {
+		return logDir;
+	}
+
+	public void setLogDir(String logDir) {
+		this.logDir = logDir;
+	}
+
 }