diff --git a/pom.xml b/pom.xml
index 092cef6771834fa65ce3587393f3f2ba4160a886..76ace9448c6d538d8d30398723e9b55f0393dac6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.example
websocket
- 0.0.1-SNAPSHOT
+ 1.0.0
jar
websocket
@@ -21,7 +21,7 @@
UTF-8
UTF-8
- 1.8
+ 1.7
@@ -40,6 +40,15 @@
spring-boot-starter-test
test
+
+ com.jfinal
+ jfinal
+ 3.3
+
+
+ org.springframework.boot
+ spring-boot-starter-freemarker
+
@@ -48,7 +57,28 @@
org.springframework.boot
spring-boot-maven-plugin
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.7
+ 1.7
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 1.5.7.RELEASE
+
+
+
+ repackage
+
+
+
+
+
diff --git a/src/main/java/com/kl/websocket/CONSTANT.java b/src/main/java/com/kl/websocket/CONSTANT.java
new file mode 100644
index 0000000000000000000000000000000000000000..915965a10c51b3c3c5a33eecf40fc887c56c59b2
--- /dev/null
+++ b/src/main/java/com/kl/websocket/CONSTANT.java
@@ -0,0 +1,12 @@
+package com.kl.websocket;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by dw on 2018/01/15
+ */
+public class CONSTANT {
+ //master分支提交1
+}
diff --git a/src/main/java/com/kl/websocket/FileLogListening.java b/src/main/java/com/kl/websocket/FileLogListening.java
index 3f0136db07e2c2c2765d57101b6ddd182bc27830..463e11b8aed7216fcd6d40ae25cb231f921c3bcd 100644
--- a/src/main/java/com/kl/websocket/FileLogListening.java
+++ b/src/main/java/com/kl/websocket/FileLogListening.java
@@ -29,6 +29,11 @@ public class FileLogListening {
@PostConstruct
public void start() throws IOException {
String logPath = environment.getProperty("weblogPath");
+ if (logPath.contains(",")) {
+ logPath = logPath.split(",")[0];
+ } else if (logPath.contains(";")) {
+ logPath = logPath.split(",")[0];
+ }
File logFile = ResourceUtils.getFile(logPath);
//指定文件可读可写
final RandomAccessFile randomFile = new RandomAccessFile(logFile, "rw");
@@ -39,7 +44,7 @@ public class FileLogListening {
randomFile.seek(lastTimeFileSize);
String tmp = "";
while ((tmp = randomFile.readLine()) != null) {
- String log=new String(tmp.getBytes("ISO8859-1"));
+ String log = new String(tmp.getBytes("ISO-8859-1"), "utf8");
LoggerQueue.getInstance().pushFileLog(log);
}
diff --git a/src/main/java/com/kl/websocket/WebsocketApplication.java b/src/main/java/com/kl/websocket/WebsocketApplication.java
index 430a6414c067d45dc324a1d3ee7ecfb7dba57206..31a0544b5c5ac48b1e0fb670dae3afdbe8b9185f 100644
--- a/src/main/java/com/kl/websocket/WebsocketApplication.java
+++ b/src/main/java/com/kl/websocket/WebsocketApplication.java
@@ -2,17 +2,23 @@ package com.kl.websocket;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
@SpringBootApplication
@EnableScheduling
@RestController
-public class WebsocketApplication {
+public class WebsocketApplication extends SpringBootServletInitializer {
+
private Logger logger = LoggerFactory.getLogger(WebsocketApplication.class);
public static void main(String[] args) {
@@ -21,15 +27,11 @@ public class WebsocketApplication {
int info = 1;
- @Scheduled(fixedRate = 1000)
- public void outputLogger() {
- logger.info("测试日志输出" + info++);
- throw new RuntimeException();
+ @RequestMapping("/")
+ public ModelAndView index() {
+ ModelAndView mv = new ModelAndView("index");
+ return mv;
}
- @RequestMapping("/hello")
- public String hello() {
- logger.debug("访问了hello");
- return "hello!";
- }
+
}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index eb99a99c70c43761b13f5c7a68a5ac6d2c03cc00..b5acabe02dfbcda867efd44f6340b0b7e254cad6 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,5 +1,10 @@
-server.port=8087
+server.port=8081
+spring.http.encoding.force=true
logging.level.com.example.websocket=debug
-#ָļ
-weblogPath=${logging.path}\\spring.log
-logging.path=E:\\yudianWorkingspace\\yudian-frontend-salesplatform\\dist
+#\u76D1\u542C\u5916\u90E8\u65E5\u5FD7\u6587\u4EF6
+weblogPath=C://log//testlog.log
+#\u5185\u90E8\u65E5\u5FD7
+logging.path=log\
+
+#\u8BBE\u5B9Aftl\u6587\u4EF6\u8DEF\u5F84
+spring.freemarker.template-loader-path=classpath:/templates
\ No newline at end of file
diff --git a/src/main/resources/static/index.html b/src/main/resources/static/back.html
similarity index 48%
rename from src/main/resources/static/index.html
rename to src/main/resources/static/back.html
index 725c692a39de3184f0e9bfa33cc424415bf89f8e..99129ccee4608619f8cdbc3fb327b8c0a401581f 100644
--- a/src/main/resources/static/index.html
+++ b/src/main/resources/static/back.html
@@ -3,51 +3,63 @@
WebSocket Logger
-
-
-
+
+
+
-jvm进程内的日志
-
-
+
指定监听日志文件的日志
-
-
+
+
+
diff --git a/src/main/resources/static/index.jsp b/src/main/resources/static/index.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..84d6920ef6adaa894618c672134b4ec5b6e2928f
--- /dev/null
+++ b/src/main/resources/static/index.jsp
@@ -0,0 +1,74 @@
+<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
+
+
+
+
+
+
+
线上日志调试输出
+
+
+
+
+
+
+
+
指定监听日志文件的日志
+<%--
+
--%>
+<%--
--%>
+
+
+
+
+
+