Commit 5142851269ff901e30adda768b48c53fcad423b3
1 parent
6d2d8bdf
添加关键操作日志
Showing
5 changed files
with
66 additions
and
14 deletions
src/main/java/com/cnlive/mz/live/action/HttpPostArgumentTest2.java
| @@ -67,7 +67,7 @@ public class HttpPostArgumentTest2 { | @@ -67,7 +67,7 @@ public class HttpPostArgumentTest2 { | ||
| 67 | NameValuePair[] param = { new NameValuePair("relation_id", "283645"), new NameValuePair("video_type", "3"), | 67 | NameValuePair[] param = { new NameValuePair("relation_id", "283645"), new NameValuePair("video_type", "3"), |
| 68 | new NameValuePair("user_access_key", user_access_key), | 68 | new NameValuePair("user_access_key", user_access_key), |
| 69 | new NameValuePair("app_access_key", app_access_key) }; | 69 | new NameValuePair("app_access_key", app_access_key) }; |
| 70 | - String c = HttpReq.postRequestWidthResult("http://bc.cnlive.com/api/video/redirect", param); | 70 | + String c = HttpReq.postRequestWidthResult("http://localhost:8080/cnlive_live_web/api/video/redirect", param); |
| 71 | System.out.println(c); | 71 | System.out.println(c); |
| 72 | } | 72 | } |
| 73 | 73 |
src/main/java/com/cnlive/mz/live/action/VideoAction.java
| @@ -5,6 +5,7 @@ import java.util.LinkedHashMap; | @@ -5,6 +5,7 @@ import java.util.LinkedHashMap; | ||
| 5 | import java.util.Map; | 5 | import java.util.Map; |
| 6 | 6 | ||
| 7 | import org.apache.commons.lang3.StringUtils; | 7 | import org.apache.commons.lang3.StringUtils; |
| 8 | +import org.apache.log4j.Logger; | ||
| 8 | import org.smart4j.framework.dao.bean.Pager; | 9 | import org.smart4j.framework.dao.bean.Pager; |
| 9 | import org.smart4j.framework.ioc.annotation.Inject; | 10 | import org.smart4j.framework.ioc.annotation.Inject; |
| 10 | import org.smart4j.framework.mvc.DataContext; | 11 | import org.smart4j.framework.mvc.DataContext; |
| @@ -17,6 +18,7 @@ import org.smart4j.framework.mvc.bean.View; | @@ -17,6 +18,7 @@ import org.smart4j.framework.mvc.bean.View; | ||
| 17 | import org.smart4j.framework.util.CastUtil; | 18 | import org.smart4j.framework.util.CastUtil; |
| 18 | 19 | ||
| 19 | import com.cnlive.mz.commons.CnliveUtil; | 20 | import com.cnlive.mz.commons.CnliveUtil; |
| 21 | +import com.cnlive.mz.live.common.Constants; | ||
| 20 | import com.cnlive.mz.live.common.LiveUtils; | 22 | import com.cnlive.mz.live.common.LiveUtils; |
| 21 | import com.cnlive.mz.live.entity.TLive; | 23 | import com.cnlive.mz.live.entity.TLive; |
| 22 | import com.cnlive.mz.live.entity.TVideo; | 24 | import com.cnlive.mz.live.entity.TVideo; |
| @@ -27,6 +29,8 @@ import com.cnlive.mz.live.service.TVideoService; | @@ -27,6 +29,8 @@ import com.cnlive.mz.live.service.TVideoService; | ||
| 27 | 29 | ||
| 28 | @Action | 30 | @Action |
| 29 | public class VideoAction { | 31 | public class VideoAction { |
| 32 | + | ||
| 33 | + private Logger log = Logger.getLogger("action"); | ||
| 30 | @Inject | 34 | @Inject |
| 31 | private TDispatchServerService tDispatchServerService; | 35 | private TDispatchServerService tDispatchServerService; |
| 32 | @Inject | 36 | @Inject |
| @@ -63,6 +67,9 @@ public class VideoAction { | @@ -63,6 +67,9 @@ public class VideoAction { | ||
| 63 | String server_access_key = params.getString("server_access_key"); | 67 | String server_access_key = params.getString("server_access_key"); |
| 64 | String active_id = params.getString("active_id"); | 68 | String active_id = params.getString("active_id"); |
| 65 | String title = params.getString("title"); | 69 | String title = params.getString("title"); |
| 70 | + if (title.length() > 50) { | ||
| 71 | + title = title.substring(0, 50); | ||
| 72 | + } | ||
| 66 | String direct = params.getString("direct"); | 73 | String direct = params.getString("direct"); |
| 67 | String description = params.getString("description"); | 74 | String description = params.getString("description"); |
| 68 | String custom_args = params.getString("custom_args"); | 75 | String custom_args = params.getString("custom_args"); |
| @@ -99,10 +106,7 @@ public class VideoAction { | @@ -99,10 +106,7 @@ public class VideoAction { | ||
| 99 | } else { | 106 | } else { |
| 100 | tLive.setDirect(Integer.parseInt(direct)); | 107 | tLive.setDirect(Integer.parseInt(direct)); |
| 101 | } | 108 | } |
| 102 | - // tLive.setLive_url("http://cnlive.hlslive.ks-cdn.com/live/" + | ||
| 103 | - // tLive.getT_user_id() + "_" + uuid | ||
| 104 | - // + "/index.m3u8"); | ||
| 105 | - tLive.setLive_url("rtmp://cnlive.rtmplive.ks-cdn.com/live/" + tLive.getT_user_id() + "_" + uuid); | 109 | + tLive.setLive_url(Constants.KS_HOST_RTMP + tLive.getT_user_id() + "_" + uuid); |
| 106 | tLiveService.startLive(tLive); | 110 | tLiveService.startLive(tLive); |
| 107 | } | 111 | } |
| 108 | data.put("video_uuid", uuid); | 112 | data.put("video_uuid", uuid); |
| @@ -172,12 +176,14 @@ public class VideoAction { | @@ -172,12 +176,14 @@ public class VideoAction { | ||
| 172 | String upload_type = params.getString("upload_type"); | 176 | String upload_type = params.getString("upload_type"); |
| 173 | String video_type = params.getString("video_type"); | 177 | String video_type = params.getString("video_type"); |
| 174 | String state = params.getString("state"); | 178 | String state = params.getString("state"); |
| 179 | + String duration = params.getString("duration"); | ||
| 180 | + xLog("uploadNotify", "duration", duration, video_type, video_type,state); | ||
| 175 | if (video_type.equals("2")) { | 181 | if (video_type.equals("2")) { |
| 176 | // 点播通知 | 182 | // 点播通知 |
| 177 | tVideoService.notify(video_uuid); | 183 | tVideoService.notify(video_uuid); |
| 178 | } else if (video_type.equals("3")) { | 184 | } else if (video_type.equals("3")) { |
| 179 | - // 直播通知 | ||
| 180 | - tLiveService.notify(video_uuid); | 185 | + // 直播正常结束 |
| 186 | + tLiveService.notify(video_uuid, duration, 2); | ||
| 181 | } | 187 | } |
| 182 | ApiBean apiBean = new ApiBean(); | 188 | ApiBean apiBean = new ApiBean(); |
| 183 | apiBean.setCode(100); | 189 | apiBean.setCode(100); |
| @@ -186,9 +192,9 @@ public class VideoAction { | @@ -186,9 +192,9 @@ public class VideoAction { | ||
| 186 | } | 192 | } |
| 187 | 193 | ||
| 188 | @Request.Get("/api/video/error/{video_uuid}") | 194 | @Request.Get("/api/video/error/{video_uuid}") |
| 189 | - public ApiBean beat(String video_uuid) { | ||
| 190 | - // 直播通知 | ||
| 191 | - tLiveService.notify(video_uuid); | 195 | + public ApiBean error(String video_uuid) { |
| 196 | + // 直播异常结束 | ||
| 197 | + tLiveService.notify(video_uuid, "-1", -2); | ||
| 192 | ApiBean apiBean = new ApiBean(); | 198 | ApiBean apiBean = new ApiBean(); |
| 193 | apiBean.setCode(100); | 199 | apiBean.setCode(100); |
| 194 | apiBean.setMessage("请求成功"); | 200 | apiBean.setMessage("请求成功"); |
| @@ -207,4 +213,13 @@ public class VideoAction { | @@ -207,4 +213,13 @@ public class VideoAction { | ||
| 207 | apiBean.setMessage("请求成功"); | 213 | apiBean.setMessage("请求成功"); |
| 208 | return apiBean; | 214 | return apiBean; |
| 209 | } | 215 | } |
| 216 | + | ||
| 217 | + private void xLog(String... str) { | ||
| 218 | + StringBuffer sb = new StringBuffer(); | ||
| 219 | + for (int i = 0; i < str.length; i++) { | ||
| 220 | + sb.append(str); | ||
| 221 | + sb.append("|"); | ||
| 222 | + } | ||
| 223 | + log.info(sb.toString()); | ||
| 224 | + } | ||
| 210 | } | 225 | } |
src/main/resources/log4j.properties
| 1 | log4j.rootLogger=INFO,console,file | 1 | log4j.rootLogger=INFO,console,file |
| 2 | - | 2 | +log4j.logger.content=INFO,content |
| 3 | +log4j.logger.video=INFO,video | ||
| 3 | log4j.appender.console=org.apache.log4j.ConsoleAppender | 4 | log4j.appender.console=org.apache.log4j.ConsoleAppender |
| 4 | log4j.appender.console.Target=System.out | 5 | log4j.appender.console.Target=System.out |
| 5 | log4j.appender.console.layout=org.apache.log4j.PatternLayout | 6 | log4j.appender.console.layout=org.apache.log4j.PatternLayout |
| @@ -16,6 +17,24 @@ log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss,SSS} %p %c (%L) - %m%n | @@ -16,6 +17,24 @@ log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss,SSS} %p %c (%L) - %m%n | ||
| 16 | log4j.logger.org.smart4j=DEBUG | 17 | log4j.logger.org.smart4j=DEBUG |
| 17 | 18 | ||
| 18 | 19 | ||
| 20 | +#content | ||
| 21 | +log4j.appender.content=org.apache.log4j.DailyRollingFileAppender | ||
| 22 | +log4j.appender.content.File=${catalina.home}/logs/content.log | ||
| 23 | +log4j.appender.content.layout=org.apache.log4j.PatternLayout | ||
| 24 | +log4j.appender.content.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n | ||
| 25 | +log4j.appender.content.DatePattern='.'yyyy-MM-dd | ||
| 26 | +log4j.appender.content.Encoding=UTF-8 | ||
| 27 | + | ||
| 28 | + | ||
| 29 | +#video | ||
| 30 | +log4j.appender.video=org.apache.log4j.DailyRollingFileAppender | ||
| 31 | +log4j.appender.video.File=${catalina.home}/logs/video.log | ||
| 32 | +log4j.appender.video.layout=org.apache.log4j.PatternLayout | ||
| 33 | +log4j.appender.video.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n | ||
| 34 | +log4j.appender.video.DatePattern='.'yyyy-MM-dd | ||
| 35 | +log4j.appender.video.Encoding=UTF-8 | ||
| 36 | + | ||
| 37 | + | ||
| 19 | #log4j.logger.com.ksyun.ks3=DEBUG,stdout | 38 | #log4j.logger.com.ksyun.ks3=DEBUG,stdout |
| 20 | #log4j.logger.org.apache.http=DEBUG,stdout | 39 | #log4j.logger.org.apache.http=DEBUG,stdout |
| 21 | #log4j.logger.org.apache.http.wire=ERROR,stdout | 40 | #log4j.logger.org.apache.http.wire=ERROR,stdout |
target/classes/log4j.properties
| 1 | log4j.rootLogger=INFO,console,file | 1 | log4j.rootLogger=INFO,console,file |
| 2 | - | 2 | +log4j.logger.content=INFO,content |
| 3 | +log4j.logger.video=INFO,video | ||
| 3 | log4j.appender.console=org.apache.log4j.ConsoleAppender | 4 | log4j.appender.console=org.apache.log4j.ConsoleAppender |
| 4 | log4j.appender.console.Target=System.out | 5 | log4j.appender.console.Target=System.out |
| 5 | log4j.appender.console.layout=org.apache.log4j.PatternLayout | 6 | log4j.appender.console.layout=org.apache.log4j.PatternLayout |
| @@ -16,6 +17,24 @@ log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss,SSS} %p %c (%L) - %m%n | @@ -16,6 +17,24 @@ log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss,SSS} %p %c (%L) - %m%n | ||
| 16 | log4j.logger.org.smart4j=DEBUG | 17 | log4j.logger.org.smart4j=DEBUG |
| 17 | 18 | ||
| 18 | 19 | ||
| 20 | +#content | ||
| 21 | +log4j.appender.content=org.apache.log4j.DailyRollingFileAppender | ||
| 22 | +log4j.appender.content.File=${catalina.home}/logs/content.log | ||
| 23 | +log4j.appender.content.layout=org.apache.log4j.PatternLayout | ||
| 24 | +log4j.appender.content.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n | ||
| 25 | +log4j.appender.content.DatePattern='.'yyyy-MM-dd | ||
| 26 | +log4j.appender.content.Encoding=UTF-8 | ||
| 27 | + | ||
| 28 | + | ||
| 29 | +#video | ||
| 30 | +log4j.appender.video=org.apache.log4j.DailyRollingFileAppender | ||
| 31 | +log4j.appender.video.File=${catalina.home}/logs/video.log | ||
| 32 | +log4j.appender.video.layout=org.apache.log4j.PatternLayout | ||
| 33 | +log4j.appender.video.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n | ||
| 34 | +log4j.appender.video.DatePattern='.'yyyy-MM-dd | ||
| 35 | +log4j.appender.video.Encoding=UTF-8 | ||
| 36 | + | ||
| 37 | + | ||
| 19 | #log4j.logger.com.ksyun.ks3=DEBUG,stdout | 38 | #log4j.logger.com.ksyun.ks3=DEBUG,stdout |
| 20 | #log4j.logger.org.apache.http=DEBUG,stdout | 39 | #log4j.logger.org.apache.http=DEBUG,stdout |
| 21 | #log4j.logger.org.apache.http.wire=ERROR,stdout | 40 | #log4j.logger.org.apache.http.wire=ERROR,stdout |
target/m2e-wtp/web-resources/META-INF/maven/com.cnlive.mz.live.web/cnlive_live_web/pom.properties
| 1 | #Generated by Maven Integration for Eclipse | 1 | #Generated by Maven Integration for Eclipse |
| 2 | -#Tue Jun 14 14:04:42 CST 2016 | ||
| 3 | -#Sun Jun 12 10:48:48 CST 2016 | 2 | +#Thu Jun 16 09:01:40 CST 2016 |
| 4 | version=0.0.1-SNAPSHOT | 3 | version=0.0.1-SNAPSHOT |
| 5 | groupId=com.cnlive.mz.live.web | 4 | groupId=com.cnlive.mz.live.web |
| 6 | m2e.projectName=cnlive_live_web | 5 | m2e.projectName=cnlive_live_web |