Merge pull request #3265 from ritzalam/cleanup-screenshare-logging

Logging
This commit is contained in:
Richard Alam 2016-08-05 13:55:01 -04:00 committed by GitHub
commit dd79c2537f
5 changed files with 100 additions and 12 deletions

View File

@ -343,7 +343,8 @@ public class JnlpFileHandler {
jnlpTemplate = substitute(jnlpTemplate, "$$site", urlprefix);
log.debug(jnlpTemplate);
log.info("JNLP Response: " + jnlpTemplate);
return jnlpTemplate;
}

View File

@ -11,8 +11,11 @@ import org.bigbluebutton.app.screenshare.events.StreamStartedEvent;
import org.bigbluebutton.app.screenshare.events.StreamStoppedEvent;
import com.google.gson.Gson;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
public class EventListenerImp implements IEventListener {
private static Logger log = Red5LoggerFactory.getLogger(EventListenerImp.class, "screenshare");
private ConnectionInvokerService sender;
@Override
@ -40,6 +43,15 @@ public class EventListenerImp implements IEventListener {
BroadcastClientMessage msg = new BroadcastClientMessage(event.meetingId, "screenShareStartedMessage", message);
sender.sendMessage(msg);
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", event.meetingId);
logData.put("streamId", event.streamId);
gson = new Gson();
String logStr = gson.toJson(logData);
log.info("Screenshare started message: data={}", logStr);
}
private void sendShareStoppedEvent(ShareStoppedEvent event) {
@ -53,6 +65,16 @@ public class EventListenerImp implements IEventListener {
BroadcastClientMessage msg = new BroadcastClientMessage(event.meetingId, "screenShareStoppedMessage", message);
sender.sendMessage(msg);
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", event.meetingId);
logData.put("streamId", event.streamId);
gson = new Gson();
String logStr = gson.toJson(logData);
log.info("Screenshare stopped message: data={}", logStr);
}
private void sendStreamStartedEvent(StreamStartedEvent event) {
@ -69,6 +91,18 @@ public class EventListenerImp implements IEventListener {
BroadcastClientMessage msg = new BroadcastClientMessage(event.meetingId, "screenStreamStartedMessage", message);
sender.sendMessage(msg);
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", event.meetingId);
logData.put("streamId", event.streamId);
logData.put("width", event.width);
logData.put("height", event.height);
logData.put("url", event.url);
gson = new Gson();
String logStr = gson.toJson(logData);
log.info("Screenshare stream started message: data={}", logStr);
}
private void sendStreamStoppedEvent(StreamStoppedEvent event) {
@ -82,6 +116,15 @@ public class EventListenerImp implements IEventListener {
BroadcastClientMessage msg = new BroadcastClientMessage(event.meetingId, "screenStreamStoppedMessage", message);
sender.sendMessage(msg);
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", event.meetingId);
logData.put("streamId", event.streamId);
gson = new Gson();
String logStr = gson.toJson(logData);
log.info("Screenshare stream stopped message: data={}", logStr);
}
public void setMessageSender(ConnectionInvokerService sender) {

View File

@ -171,6 +171,17 @@ public class Red5AppAdapter extends MultiThreadedApplicationAdapter {
stream.addStreamListener(listener);
streamListeners.put(conn.getScope().getName() + "-" + stream.getPublishedName(), listener);
}
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", meetingId);
logData.put("streamId", streamId);
logData.put("url", url);
logData.put("recorded", recordVideoStream);
Gson gson = new Gson();
String logStr = gson.toJson(logData);
log.info("ScreenShare broadcast started: data={}", logStr);
} else {
log.error("Invalid streamid format [{}]", streamId);
}
@ -216,7 +227,7 @@ public class Red5AppAdapter extends MultiThreadedApplicationAdapter {
filename = filename.concat(meetingId).concat("/").concat(stream.getPublishedName()).concat(".flv");
long publishDuration = (System.currentTimeMillis() - stream.getCreationTime()) / 1000;
log.info("streamBroadcastClose " + stream.getPublishedName() + " " + System.currentTimeMillis() + " " + scopeName);
Map<String, String> event = new HashMap<String, String>();
event.put("module", "Deskshare");
event.put("timestamp", genTimestamp().toString());
@ -227,6 +238,16 @@ public class Red5AppAdapter extends MultiThreadedApplicationAdapter {
event.put("eventName", "DeskshareStoppedEvent");
recordingService.record(scopeName, event);
}
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", meetingId);
logData.put("streamId", streamId);
logData.put("recorded", recordVideoStream);
Gson gson = new Gson();
String logStr = gson.toJson(logData);
log.info("ScreenShare broadcast stopped: data={}", logStr);
} else {
log.error("Invalid streamid format [{}]", streamId);
}

View File

@ -57,9 +57,24 @@ public class Red5AppHandler {
Gson gson = new Gson();
message.put("msg", gson.toJson(data));
log.info("Sending startShareRequestResponse to client, meetingId=" + meetingId + " userid=" + userId);
DirectClientMessage msg = new DirectClientMessage(meetingId, userId, "startShareRequestResponse", message);
sender.sendMessage(msg);
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", meetingId);
logData.put("userId", userId);
if (resp.error != null) {
logData.put("error", resp.error.reason);
} else {
logData.put("authToken", resp.token);
logData.put("jnlp", resp.jnlp);
}
Gson gson2 = new Gson();
String logStr = gson2.toJson(logData);
log.info("Start ScreenShare request response: data={}", logStr);
}
public void stopShareRequest(String meetingId, String streamId) {
@ -76,9 +91,17 @@ public class Red5AppHandler {
Gson gson = new Gson();
message.put("msg", gson.toJson(data));
log.info("Sending stopShareRequest to client, meetingId=" + meetingId + " streamId=" + streamId);
BroadcastClientMessage msg = new BroadcastClientMessage(meetingId, "stopViewingStream", message);
sender.sendMessage(msg);
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", meetingId);
logData.put("streamId", streamId);
Gson gson2 = new Gson();
String logStr = gson2.toJson(logData);
log.info("Stop viewing ScreenShare broadcast message: data={}", logStr);
}
public void setApplication(IScreenShareApplication app) {

View File

@ -96,7 +96,7 @@ public class HttpTunnelStreamController extends MultiActionController {
String meetingId = request.getParameterValues("meetingId")[0];
String streamId = request.getParameterValues("streamId")[0];
log.debug("Received stream update message for meetingId={} streamId={}", meetingId, streamId);
//log.debug("Received stream update message for meetingId={} streamId={}", meetingId, streamId);
if (! hasSessionManager) {
screenShareApplication = getScreenShareApplication();