Skip to content

Commit

Permalink
Improve jibri logs (#888)
Browse files Browse the repository at this point in the history
* log: Inherit log context in JibriSession.

* log: Log when at jibri IQ is dropped.

* log: Log all received jibri requests.
  • Loading branch information
bgrozev authored Mar 8, 2022
1 parent 34e5b4d commit f63d169
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/org/jitsi/jicofo/jibri/JibriSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ static private boolean isStartingStatus(JibriIq.Status status)
* @param youTubeBroadcastId the YouTube broadcast id (optional)
* @param applicationData a JSON-encoded string containing application-specific
* data for Jibri
* @param logLevelDelegate logging level delegate which will be used to
* select logging level for this instance {@link #logger}.
* @param parentLogger the parent logger whose context will be inherited by {@link #logger}.
*/
JibriSession(
StateListener stateListener,
Expand All @@ -201,7 +200,7 @@ static private boolean isStartingStatus(JibriIq.Status status)
String youTubeBroadcastId,
String sessionId,
String applicationData,
Logger logLevelDelegate)
Logger parentLogger)
{
this.stateListener = stateListener;
this.roomName = roomName;
Expand All @@ -217,7 +216,7 @@ static private boolean isStartingStatus(JibriIq.Status status)
this.sessionId = sessionId;
this.applicationData = applicationData;
jibriDetector.addHandler(jibriEventHandler);
logger = new LoggerImpl(getClass().getName(), logLevelDelegate.getLevel());
logger = parentLogger.createChildLogger(getClass().getName());
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/org/jitsi/jicofo/jibri/BaseJibri.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ abstract class BaseJibri internal constructor(

fun handleJibriRequest(request: JibriRequest): IqProcessingResult =
if (accept(request.iq)) {
logger.info("Accepted jibri request: ${request.iq.toXML()}")
incomingIqQueue.add(request)
AcceptedWithNoResponse()
} else {
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/org/jitsi/jicofo/xmpp/JibriIqHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.jitsi.jicofo.jibri.BaseJibri
import org.jitsi.jicofo.xmpp.IqProcessingResult.AcceptedWithNoResponse
import org.jitsi.jicofo.xmpp.IqProcessingResult.AcceptedWithResponse
import org.jitsi.jicofo.xmpp.IqProcessingResult.RejectedWithError
import org.jitsi.utils.logging2.createLogger
import org.jitsi.xmpp.extensions.jibri.JibriIq
import org.jivesoftware.smack.AbstractXMPPConnection
import org.jivesoftware.smack.iqrequest.IQRequestHandler
Expand All @@ -43,6 +44,7 @@ class JibriIqHandler(
setOf(IQ.Type.set),
IQRequestHandler.Mode.sync
) {
val logger = createLogger()

/**
* {@inheritDoc}
Expand All @@ -60,6 +62,7 @@ class JibriIqHandler(
}

// No conference accepted the request.
logger.warn("Jibri IQ not accepted by any conference: ${request.iq.toXML()}")
return RejectedWithError(request, StanzaError.Condition.item_not_found)
}
}

0 comments on commit f63d169

Please sign in to comment.