diff --git a/logs/app.log b/logs/app.log new file mode 100644 index 0000000..bb14502 --- /dev/null +++ b/logs/app.log @@ -0,0 +1,59 @@ +2025-04-19 13:21:49.922 [main] INFO com.tuoheng.steam.StreamApplication - Starting StreamApplication using Java 11.0.25 on sunpengdeMacBook-Pro.local with PID 12739 (/Users/sunpeng/workspace/ideaproject/stream_server/target/classes started by sunpeng in /Users/sunpeng/workspace/ideaproject/stream_server) +2025-04-19 13:21:49.923 [main] INFO com.tuoheng.steam.StreamApplication - No active profile set, falling back to 1 default profile: "default" +2025-04-19 13:21:50.252 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 9011 (http) +2025-04-19 13:21:50.255 [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-9011"] +2025-04-19 13:21:50.255 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat] +2025-04-19 13:21:50.255 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.83] +2025-04-19 13:21:50.290 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext +2025-04-19 13:21:50.291 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 350 ms +2025-04-19 13:21:50.447 [main] INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-9011"] +2025-04-19 13:21:50.465 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 9011 (http) with context path '' +2025-04-19 13:21:50.472 [main] INFO com.tuoheng.steam.StreamApplication - Started StreamApplication in 0.757 seconds (JVM running for 1.236) +2025-04-19 13:21:56.475 [scheduling-1] INFO com.tuoheng.steam.schedule.Scheduler - 舱内外无需录制 +2025-04-19 13:22:21.580 [main] INFO com.tuoheng.steam.StreamApplication - Starting StreamApplication using Java 11.0.25 on sunpengdeMacBook-Pro.local with PID 12750 (/Users/sunpeng/workspace/ideaproject/stream_server/target/classes started by sunpeng in /Users/sunpeng/workspace/ideaproject/stream_server) +2025-04-19 13:22:21.581 [main] INFO com.tuoheng.steam.StreamApplication - No active profile set, falling back to 1 default profile: "default" +2025-04-19 13:22:21.909 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 9011 (http) +2025-04-19 13:22:21.912 [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-9011"] +2025-04-19 13:22:21.913 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat] +2025-04-19 13:22:21.913 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.83] +2025-04-19 13:22:21.953 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext +2025-04-19 13:22:21.953 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 354 ms +2025-04-19 13:22:22.115 [main] INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-9011"] +2025-04-19 13:22:22.132 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 9011 (http) with context path '' +2025-04-19 13:22:22.140 [main] INFO com.tuoheng.steam.StreamApplication - Started StreamApplication in 0.767 seconds (JVM running for 1.254) +2025-04-19 13:22:28.140 [scheduling-1] INFO com.tuoheng.steam.schedule.Scheduler - 舱内外无需录制 +2025-04-19 13:30:19.451 [main] INFO com.tuoheng.steam.StreamApplication - Starting StreamApplication using Java 11.0.25 on sunpengdeMacBook-Pro.local with PID 12998 (/Users/sunpeng/workspace/ideaproject/stream_server/target/classes started by sunpeng in /Users/sunpeng/workspace/ideaproject/stream_server) +2025-04-19 13:30:19.452 [main] INFO com.tuoheng.steam.StreamApplication - No active profile set, falling back to 1 default profile: "default" +2025-04-19 13:30:19.790 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 9011 (http) +2025-04-19 13:30:19.794 [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-9011"] +2025-04-19 13:30:19.794 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat] +2025-04-19 13:30:19.794 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.83] +2025-04-19 13:30:19.832 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext +2025-04-19 13:30:19.832 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 361 ms +2025-04-19 13:30:19.990 [main] INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-9011"] +2025-04-19 13:30:20.008 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 9011 (http) with context path '' +2025-04-19 13:30:20.015 [main] INFO com.tuoheng.steam.StreamApplication - Started StreamApplication in 0.768 seconds (JVM running for 1.252) +2025-04-19 13:30:26.018 [scheduling-1] INFO com.tuoheng.steam.schedule.Scheduler - 舱内外无需录制 +2025-04-19 14:05:16.707 [main] INFO com.tuoheng.steam.StreamApplication - Starting StreamApplication using Java 11.0.25 on sunpengdeMacBook-Pro.local with PID 13714 (/Users/sunpeng/workspace/ideaproject/stream_server/target/classes started by sunpeng in /Users/sunpeng/workspace/ideaproject/stream_server) +2025-04-19 14:05:16.709 [main] INFO com.tuoheng.steam.StreamApplication - No active profile set, falling back to 1 default profile: "default" +2025-04-19 14:05:17.074 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 9011 (http) +2025-04-19 14:05:17.078 [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-9011"] +2025-04-19 14:05:17.078 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat] +2025-04-19 14:05:17.078 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.83] +2025-04-19 14:05:17.118 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext +2025-04-19 14:05:17.118 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 389 ms +2025-04-19 14:05:17.284 [main] INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-9011"] +2025-04-19 14:05:17.302 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 9011 (http) with context path '' +2025-04-19 14:05:17.310 [main] INFO com.tuoheng.steam.StreamApplication - Started StreamApplication in 0.831 seconds (JVM running for 1.34) +2025-04-19 14:05:23.309 [scheduling-1] INFO com.tuoheng.steam.schedule.Scheduler - 舱内外无需录制 +2025-04-19 14:06:08.792 [http-nio-9011-exec-1] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring DispatcherServlet 'dispatcherServlet' +2025-04-19 14:06:08.792 [http-nio-9011-exec-1] INFO o.s.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet' +2025-04-19 14:06:08.792 [http-nio-9011-exec-1] INFO o.s.web.servlet.DispatcherServlet - Completed initialization in 0 ms +2025-04-19 14:06:11.948 [http-nio-9011-exec-1] INFO c.t.s.c.StreamRecordController - 启动录制 :rtmp://stream.t-aaron.com/live/livestream +2025-04-19 14:06:11.949 [http-nio-9011-exec-1] INFO c.tuoheng.steam.service.TaskService - streamUrl rtmp://stream.t-aaron.com/live/livestream startTask 1 +2025-04-19 14:06:11.951 [http-nio-9011-exec-1] INFO c.t.s.s.innerService.ProcessService - recordStream ffmpeg -i rtmp://stream.t-aaron.com/live/livestream -c copy -f mpegts -reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 2 /data/java/srs/stream_server/temp/59795526-a0eb-44ff-9fab-e0919abbbe36.ts +2025-04-19 14:06:11.970 [http-nio-9011-exec-1] INFO c.tuoheng.steam.service.TaskService - streamUrl rtmp://stream.t-aaron.com/live/livestream taskId 1 startProcess 13724 +2025-04-19 14:06:11.995 [ForkJoinPool.commonPool-worker-19] INFO c.tuoheng.steam.service.TaskService - streamUrl rtmp://stream.t-aaron.com/live/livestream taskId 1 Process 13724 Over +2025-04-19 14:06:11.995 [ForkJoinPool.commonPool-worker-19] INFO c.t.s.s.innerService.ProcessService - recordStream ffmpeg -i rtmp://stream.t-aaron.com/live/livestream -c copy -f mpegts -reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 2 /data/java/srs/stream_server/temp/247afde2-70b3-4951-b3b0-85fd02d99045.ts +2025-04-19 14:06:12.000 [ForkJoinPool.commonPool-worker-19] INFO c.tuoheng.steam.service.TaskService - streamUrl rtmp://stream.t-aaron.com/live/livestream taskId 1 startProcess 13725 +2025-04-19 14:06:12.023 [http-nio-9011-exec-1] INFO c.t.s.c.StreamRecordController - 启动录制返回 :{"code":200,"data":{"startTime":"2025-04-19 14:06:11.948","strStartTime":"2025-04-19 14:06:11","streamProcesses":[{"createTime":"2025-04-19 14:06:11.969","fileName":"/data/java/srs/stream_server/temp/59795526-a0eb-44ff-9fab-e0919abbbe36.ts","innerProcessId":13724,"processType":"RECORD","stopTime":"2025-04-19 14:06:11"},{"createTime":"2025-04-19 14:06:11.999","fileName":"/data/java/srs/stream_server/temp/247afde2-70b3-4951-b3b0-85fd02d99045.ts","innerProcessId":13725,"processType":"RECORD"}],"streamUrl":"rtmp://stream.t-aaron.com/live/livestream","taskId":1}} diff --git a/pid.txt b/pid.txt index e69de29..49f1deb 100644 --- a/pid.txt +++ b/pid.txt @@ -0,0 +1 @@ +13725=2025-04-19 14:06:11 diff --git a/pom.xml b/pom.xml index 8a34a1a..27bea7d 100644 --- a/pom.xml +++ b/pom.xml @@ -35,11 +35,6 @@ spring-boot-starter-web - - org.springframework.boot - spring-boot-starter-test - test - io.minio @@ -51,7 +46,18 @@ fastjson2 2.0.53 + + + org.apache.skywalking + apm-toolkit-logback-1.x + 8.6.0 + + + org.apache.skywalking + apm-toolkit-trace + 8.6.0 + diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0415365..39962c5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,25 +1,26 @@ -#测试环境 -spring.application.name=demo -server.port = 9011 +#公司环境 +#spring.application.name=stream_server +#server.port = 9011 +#srs.splitPath=/data/java/srs/stream_server/temp +#srs.targetPath=/data/java/srs/srs/trunk/objs/nginx/html/recording +#ffmpeg=ffmpeg +#recordPath=/data/java/srs/srs/trunk/objs/nginx/html/record +#livedates=8 +#cangneiwai=false + +#大数据局 +spring.application.name=stream_server +server.port = 8989 srs.splitPath=/data/java/srs/stream_server/temp srs.targetPath=/data/java/srs/srs/trunk/objs/nginx/html ffmpeg=ffmpeg recordPath=/data/java/srs/srs/trunk/objs/nginx/html/record livedates=8 -cangneiwai=false - -#大数据局 -#spring.application.name=demo -#server.port = 8989 -#srs.splitPath=/data/java/srs/stream_server/temp -#srs.targetPath=/data/java/srs/srs/trunk/objs/nginx/html -#ffmpeg=ffmpeg -#recordPath=/data/java/srs/srs/trunk/objs/nginx/html/record -#livedates=8 -#cangneiwai=true +cangneiwai=true #本地测试 -#server.port = 8080 +#spring.application.name=stream_server +#server.port = 9011 #srs.splitPath=/Users/sunpeng/workspace/stream/temp #srs.targetPath=/Users/sunpeng/workspace/stream/html #ffmpeg=ffmpeg diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..32c84bb --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,40 @@ + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + ./logs/app.log + + ./logs/app.%d{yyyy-MM-dd}.log + 7 + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + [th-airport] %d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/com/tuoheng/steam/StreamApplicationTests.java b/src/test/java/com/tuoheng/steam/StreamApplicationTests.java deleted file mode 100644 index 06ed5b3..0000000 --- a/src/test/java/com/tuoheng/steam/StreamApplicationTests.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.tuoheng.steam; - -import com.tuoheng.steam.service.TaskService; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class StreamApplicationTests { - - @Autowired - TaskService taskService; - - @Test - void contextLoads() { - taskService.startTask("rtmp://stream.t-aaron.com/live/123"); - - boolean stop = false; - - while (!stop) { - - try { - Thread.sleep(60000L); - }catch (Exception e){ - - } - - } - - - taskService.stopAllTask(); - } - -}