log: Uses the parent Agent's log level.

This commit is contained in:
Boris Grozev 2016-12-09 09:01:44 -06:00
parent 9a2fe509d4
commit 75e8948f4b
3 changed files with 39 additions and 10 deletions

View File

@ -161,9 +161,11 @@ public class Component
this.componentID = componentID;
this.parentStream = mediaStream;
Logger agentLogger = mediaStream.getParentAgent().getLogger();
try
{
componentSocket = new ComponentSocket(this);
componentSocket = new ComponentSocket(this, agentLogger);
socket = new MultiplexingDatagramSocket(componentSocket);
socketWrapper = new IceUdpSocketWrapper(socket);
}
@ -172,8 +174,7 @@ public class Component
throw new RuntimeException(se);
}
logger
= new Logger(classLogger, mediaStream.getParentAgent().getLogger());
logger = new Logger(classLogger, agentLogger);
}
/**

View File

@ -24,7 +24,7 @@ import java.beans.*;
import java.net.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.logging.*;
import org.ice4j.util.*; //Disambiguation
/**
* Extends {@link MergingDatagramSocket} with functionality specific to
@ -38,8 +38,9 @@ public class ComponentSocket
* The {@link Logger} used by the {@link MergingDatagramSocket} class and
* its instances for logging output.
*/
private static final Logger logger
= Logger.getLogger(MergingDatagramSocket.class.getName());
private static final java.util.logging.Logger classLogger
= java.util.logging.Logger.getLogger
(MergingDatagramSocket.class.getName());
/**
* Controls access to {@link #authorizedAddresses}.
@ -65,15 +66,22 @@ public class ComponentSocket
*/
private boolean initializedActive = false;
/**
* The {@link Logger} used by {@link MergingDatagramSocket} instances.
*/
private final Logger logger;
/**
* Initializes a new {@link MergingDatagramSocket} instance.
* @throws SocketException
*/
ComponentSocket(Component component)
ComponentSocket(Component component, Logger levelDelegate)
throws SocketException
{
super(levelDelegate);
this.component = component;
this.logger = new Logger(classLogger, levelDelegate);
component.getParentStream().addPairChangeListener(this);
}

View File

@ -24,6 +24,7 @@ import java.net.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.logging.*;
import org.ice4j.util.Logger; //Disambiguation
/**
* A {@link DatagramSocket} implementation which merges a set of sockets.
@ -47,8 +48,9 @@ public class MergingDatagramSocket
* The {@link Logger} used by the {@link MergingDatagramSocket} class and
* its instances for logging output.
*/
private static final Logger logger
= Logger.getLogger(MergingDatagramSocket.class.getName());
private static final java.util.logging.Logger classLogger
= java.util.logging.Logger.getLogger(
MergingDatagramSocket.class.getName());
/**
* Used to control access to {@link #socketContainers}.
@ -92,6 +94,10 @@ public class MergingDatagramSocket
*/
private int numDiscardedPackets = 0;
/**
* The {@link Logger} used by {@link MergingDatagramSocket} instances.
*/
private final Logger logger;
/**
* Initializes a new {@link MergingDatagramSocket} instance.
@ -99,7 +105,21 @@ public class MergingDatagramSocket
*/
public MergingDatagramSocket()
throws SocketException
{}
{
this(null);
}
/**
* Initializes a new {@link MergingDatagramSocket} instance.
* @param levelDelegate the {@link Logger} instance which dictates the
* logging level for the new {@link MergingDatagramSocket} instance.
* @throws SocketException
*/
public MergingDatagramSocket(Logger levelDelegate)
throws SocketException
{
logger = new Logger(classLogger, levelDelegate);
}
/**
* {@inheritDoc}