Search in sources :

Example 81 with SimpleFormatter

use of java.util.logging.SimpleFormatter in project jain-sip.ha by RestComm.

the class B2BUAEarlyDialogRecoveryOn1xxTest method testEarlyDialogFailoverOn1xxForwardACK.

/**
 * UA1			B2BUA (Engine1)			B2BUA (Engine2)			UA2
 * INVITE (CSeq 1)
 * --------------------->
 *
 * 				INVITE (CSeq 1)
 * 				------------------------------------------------->
 *
 * 											INVITE (CSeq 1)
 * 								             <---------------------
 * 					INVITE (CSeq 1)
 * <------------------------------------------
 *
 *  BYE (CSeq 2)
 *  ------------------------------------------->
 *  												BYE (CSeq 2)
 *  											-------------------->
 */
public void testEarlyDialogFailoverOn1xxForwardACK() throws Exception {
    balancer = new BalancerRunner();
    Handler fh = new FileHandler("logs/sipbalancer_util.log");
    fh.setFormatter(new SimpleFormatter());
    Logger.getLogger("org.mobicents").addHandler(fh);
    Logger.getLogger("org.mobicents").setLevel(Level.FINEST);
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "SipBalancerForwarder");
    properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "logs/sipbalancerforwarderdebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "logs/sipbalancerforwarder.xml");
    properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", "8");
    properties.setProperty("gov.nist.javax.sip.REENTRANT_LISTENER", "true");
    properties.setProperty("gov.nist.javax.sip.CANCEL_CLIENT_TRANSACTION_CHECKED", "false");
    // properties.setProperty("algorithmClass", InviteTransactionFailover.class.getName());
    properties.setProperty("host", IP_ADDRESS);
    properties.setProperty("internalPort", "5065");
    properties.setProperty("externalPort", "5060");
    balancer.start(properties);
    shootist = new Shootist("shootist_reinvite", true);
    shootme = new Shootme("shootme_reinvite", 5070, true);
    b2buaNode1 = new SimpleB2BUA("b2buaNode1_reinvite", 5080, IP_ADDRESS, ListeningPoint.UDP, ReplicationStrategy.EarlyDialog, true);
    Thread.sleep(5000);
    b2buaNode2 = new SimpleB2BUA("b2buaNode2_reinvite", 5081, IP_ADDRESS, ListeningPoint.UDP, ReplicationStrategy.EarlyDialog, true);
    b2buaNode1.getB2buaHandler().setSendAckOn2xx(false);
    b2buaNode2.getB2buaHandler().setSendAckOn2xx(false);
    Thread.sleep(5000);
    b2buaNode1.pingBalancer();
    Thread.sleep(1000);
    b2buaNode2.pingBalancer();
    Thread.sleep(1000);
    shootist.setFailoverOn1xx(true);
    shootme.init();
    shootist.init("ReInvite");
    Thread.sleep(100000);
    shootme.checkState(false);
    shootist.checkState(false);
    // make sure dialogs are removed on both nodes
    // non regression for Issue 1418
    // http://code.google.com/p/restcomm/issues/detail?id=1418
    assertTrue(b2buaNode1.checkDialogsRemoved());
    assertTrue(b2buaNode2.checkDialogsRemoved());
    assertTrue(b2buaNode1.checkTransactionsRemoved());
    assertTrue(b2buaNode2.checkTransactionsRemoved());
    balancer.stop();
    b2buaNode1.stop();
    b2buaNode2.stop();
    shootist.stop();
    shootme.stop();
    Thread.sleep(5000);
}
Also used : BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) SimpleFormatter(java.util.logging.SimpleFormatter) FileHandler(java.util.logging.FileHandler) Handler(java.util.logging.Handler) Properties(java.util.Properties) FileHandler(java.util.logging.FileHandler)

Example 82 with SimpleFormatter

use of java.util.logging.SimpleFormatter in project jain-sip.ha by RestComm.

the class B2BUAEarlyDialogRecoveryOn1xxTest method testEarlyDialogFailoverOn1xxStopNodeOnReinvite.

/**
 * UA1			B2BUA (Engine1)			B2BUA (Engine2)			UA2
 * INVITE (CSeq 1)
 * --------------------->
 *
 * 				INVITE (CSeq 1)
 * 				------------------------------------------------->
 *
 * 											INVITE (CSeq 1)
 * 								             <---------------------
 * 					INVITE (CSeq 1)
 * <------------------------------------------
 *
 *  BYE (CSeq 2)
 *  ------------------------------------------->
 *  												BYE (CSeq 2)
 *  											-------------------->
 */
public void testEarlyDialogFailoverOn1xxStopNodeOnReinvite() throws Exception {
    stopNodeOnReinvite = true;
    balancer = new BalancerRunner();
    Handler fh = new FileHandler("logs/sipbalancer_util.log");
    fh.setFormatter(new SimpleFormatter());
    Logger.getLogger("org.mobicents").addHandler(fh);
    Logger.getLogger("org.mobicents").setLevel(Level.FINEST);
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "SipBalancerForwarder");
    properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "logs/sipbalancerforwarderdebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "logs/sipbalancerforwarder.xml");
    properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", "8");
    properties.setProperty("gov.nist.javax.sip.REENTRANT_LISTENER", "true");
    properties.setProperty("gov.nist.javax.sip.CANCEL_CLIENT_TRANSACTION_CHECKED", "false");
    // properties.setProperty("algorithmClass", InviteTransactionFailover.class.getName());
    properties.setProperty("host", IP_ADDRESS);
    properties.setProperty("internalPort", "5065");
    properties.setProperty("externalPort", "5060");
    balancer.start(properties);
    shootist = new Shootist("shootist_reinvite", true);
    shootme = new Shootme("shootme_reinvite", 5070, true);
    b2buaNode1 = new SimpleB2BUA("b2buaNode1_reinvite", 5080, IP_ADDRESS, ListeningPoint.UDP, ReplicationStrategy.EarlyDialog, true);
    Thread.sleep(5000);
    b2buaNode2 = new SimpleB2BUA("b2buaNode2_reinvite", 5081, IP_ADDRESS, ListeningPoint.UDP, ReplicationStrategy.EarlyDialog, true);
    b2buaNode1.getB2buaHandler().setSendAckOn2xx(true);
    b2buaNode2.getB2buaHandler().setSendAckOn2xx(true);
    Thread.sleep(5000);
    b2buaNode1.pingBalancer();
    Thread.sleep(1000);
    b2buaNode2.pingBalancer();
    Thread.sleep(1000);
    shootist.setFailoverOn1xx(true);
    shootme.init();
    shootist.init("ReInvite");
    Thread.sleep(100000);
    shootme.checkState(false);
    shootist.checkState(false);
    // make sure dialogs are removed on both nodes
    // non regression for Issue 1418
    // http://code.google.com/p/restcomm/issues/detail?id=1418
    assertTrue(b2buaNode1.checkDialogsRemoved());
    assertTrue(b2buaNode2.checkDialogsRemoved());
    assertTrue(b2buaNode1.checkTransactionsRemoved());
    assertTrue(b2buaNode2.checkTransactionsRemoved());
    balancer.stop();
    b2buaNode1.stop();
    b2buaNode2.stop();
    shootist.stop();
    shootme.stop();
    Thread.sleep(5000);
}
Also used : BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) SimpleFormatter(java.util.logging.SimpleFormatter) FileHandler(java.util.logging.FileHandler) Handler(java.util.logging.Handler) Properties(java.util.Properties) FileHandler(java.util.logging.FileHandler)

Example 83 with SimpleFormatter

use of java.util.logging.SimpleFormatter in project jain-sip.ha by RestComm.

the class B2BUAEarlyDialogRecoveryOn1xxTCPTest method testEarlyDialogFailoverOn1xxStopNodeOnReinvite.

/**
 * UA1			B2BUA (Engine1)			B2BUA (Engine2)			UA2
 * INVITE (CSeq 1)
 * --------------------->
 *
 * 				INVITE (CSeq 1)
 * 				------------------------------------------------->
 *
 * 											INVITE (CSeq 1)
 * 								             <---------------------
 * 					INVITE (CSeq 1)
 * <------------------------------------------
 *
 *  BYE (CSeq 2)
 *  ------------------------------------------->
 *  												BYE (CSeq 2)
 *  											-------------------->
 */
public void testEarlyDialogFailoverOn1xxStopNodeOnReinvite() throws Exception {
    stopNodeOnReinvite = true;
    balancer = new BalancerRunner();
    Handler fh = new FileHandler("logs/sipbalancer_util.log");
    fh.setFormatter(new SimpleFormatter());
    Logger.getLogger("org.mobicents").addHandler(fh);
    Logger.getLogger("org.mobicents").setLevel(Level.FINEST);
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "SipBalancerForwarder");
    properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "logs/sipbalancerforwarderdebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "logs/sipbalancerforwarder.xml");
    properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", "8");
    properties.setProperty("gov.nist.javax.sip.REENTRANT_LISTENER", "true");
    properties.setProperty("gov.nist.javax.sip.CANCEL_CLIENT_TRANSACTION_CHECKED", "false");
    // properties.setProperty("algorithmClass", InviteTransactionFailover.class.getName());
    properties.setProperty("host", IP_ADDRESS);
    properties.setProperty("internalPort", "5065");
    properties.setProperty("externalPort", "5060");
    balancer.start(properties);
    shootist = new Shootist("shootist_reinvite", true);
    shootme = new Shootme("shootme_reinvite", 5070, true);
    b2buaNode1 = new SimpleB2BUA("b2buaNode1_reinvite", 5080, IP_ADDRESS, ListeningPoint.TCP, ReplicationStrategy.EarlyDialog, true);
    Thread.sleep(5000);
    b2buaNode2 = new SimpleB2BUA("b2buaNode2_reinvite", 5081, IP_ADDRESS, ListeningPoint.TCP, ReplicationStrategy.EarlyDialog, true);
    b2buaNode1.getB2buaHandler().setSendAckOn2xx(true);
    b2buaNode2.getB2buaHandler().setSendAckOn2xx(true);
    Thread.sleep(5000);
    b2buaNode1.pingBalancer();
    Thread.sleep(1000);
    b2buaNode2.pingBalancer();
    Thread.sleep(1000);
    shootist.setFailoverOn1xx(true);
    shootme.init();
    shootist.init("ReInvite");
    Thread.sleep(100000);
    shootme.checkState(false);
    shootist.checkState(false);
    // make sure dialogs are removed on both nodes
    // non regression for Issue 1418
    // http://code.google.com/p/restcomm/issues/detail?id=1418
    assertTrue(b2buaNode1.checkDialogsRemoved());
    assertTrue(b2buaNode2.checkDialogsRemoved());
    assertTrue(b2buaNode1.checkTransactionsRemoved());
    assertTrue(b2buaNode2.checkTransactionsRemoved());
    balancer.stop();
    b2buaNode1.stop();
    b2buaNode2.stop();
    shootist.stop();
    shootme.stop();
    Thread.sleep(5000);
}
Also used : BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) SimpleFormatter(java.util.logging.SimpleFormatter) FileHandler(java.util.logging.FileHandler) Handler(java.util.logging.Handler) Properties(java.util.Properties) FileHandler(java.util.logging.FileHandler)

Example 84 with SimpleFormatter

use of java.util.logging.SimpleFormatter in project jain-sip.ha by RestComm.

the class B2BUAEarlyDialogRecoveryOn1xxTCPTest method testEarlyDialogFailoverOn1xxForwardACK.

/**
 * UA1			B2BUA (Engine1)			B2BUA (Engine2)			UA2
 * INVITE (CSeq 1)
 * --------------------->
 *
 * 				INVITE (CSeq 1)
 * 				------------------------------------------------->
 *
 * 											INVITE (CSeq 1)
 * 								             <---------------------
 * 					INVITE (CSeq 1)
 * <------------------------------------------
 *
 *  BYE (CSeq 2)
 *  ------------------------------------------->
 *  												BYE (CSeq 2)
 *  											-------------------->
 */
public void testEarlyDialogFailoverOn1xxForwardACK() throws Exception {
    balancer = new BalancerRunner();
    Handler fh = new FileHandler("logs/sipbalancer_util.log");
    fh.setFormatter(new SimpleFormatter());
    Logger.getLogger("org.mobicents").addHandler(fh);
    Logger.getLogger("org.mobicents").setLevel(Level.FINEST);
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "SipBalancerForwarder");
    properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "logs/sipbalancerforwarderdebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "logs/sipbalancerforwarder.xml");
    properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", "8");
    properties.setProperty("gov.nist.javax.sip.REENTRANT_LISTENER", "true");
    properties.setProperty("gov.nist.javax.sip.CANCEL_CLIENT_TRANSACTION_CHECKED", "false");
    // properties.setProperty("algorithmClass", InviteTransactionFailover.class.getName());
    properties.setProperty("host", IP_ADDRESS);
    properties.setProperty("internalPort", "5065");
    properties.setProperty("externalPort", "5060");
    balancer.start(properties);
    shootist = new Shootist("shootist_reinvite", true);
    shootme = new Shootme("shootme_reinvite", 5070, true);
    b2buaNode1 = new SimpleB2BUA("b2buaNode1_reinvite", 5080, IP_ADDRESS, ListeningPoint.TCP, ReplicationStrategy.EarlyDialog, true);
    Thread.sleep(5000);
    b2buaNode2 = new SimpleB2BUA("b2buaNode2_reinvite", 5081, IP_ADDRESS, ListeningPoint.TCP, ReplicationStrategy.EarlyDialog, true);
    b2buaNode1.getB2buaHandler().setSendAckOn2xx(false);
    b2buaNode2.getB2buaHandler().setSendAckOn2xx(false);
    Thread.sleep(5000);
    b2buaNode1.pingBalancer();
    Thread.sleep(1000);
    b2buaNode2.pingBalancer();
    Thread.sleep(1000);
    shootist.setFailoverOn1xx(true);
    shootme.init();
    shootist.init("ReInvite");
    Thread.sleep(100000);
    shootme.checkState(false);
    shootist.checkState(false);
    // make sure dialogs are removed on both nodes
    // non regression for Issue 1418
    // http://code.google.com/p/restcomm/issues/detail?id=1418
    assertTrue(b2buaNode1.checkDialogsRemoved());
    assertTrue(b2buaNode2.checkDialogsRemoved());
    assertTrue(b2buaNode1.checkTransactionsRemoved());
    assertTrue(b2buaNode2.checkTransactionsRemoved());
    balancer.stop();
    b2buaNode1.stop();
    b2buaNode2.stop();
    shootist.stop();
    shootme.stop();
    Thread.sleep(5000);
}
Also used : BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) SimpleFormatter(java.util.logging.SimpleFormatter) FileHandler(java.util.logging.FileHandler) Handler(java.util.logging.Handler) Properties(java.util.Properties) FileHandler(java.util.logging.FileHandler)

Example 85 with SimpleFormatter

use of java.util.logging.SimpleFormatter in project CoreNLP by stanfordnlp.

the class MachineReading method setConsoleLevel.

public static void setConsoleLevel(Level level) {
    // get the top Logger:
    Logger topLogger = java.util.logging.Logger.getLogger("");
    // Handler for console (reuse it if it already exists)
    Handler consoleHandler = null;
    // see if there is already a console handler
    for (Handler handler : topLogger.getHandlers()) {
        if (handler instanceof ConsoleHandler) {
            // found the console handler
            consoleHandler = handler;
            break;
        }
    }
    if (consoleHandler == null) {
        // there was no console handler found, create a new one
        consoleHandler = new ConsoleHandler();
        topLogger.addHandler(consoleHandler);
    }
    // set the console handler level:
    consoleHandler.setLevel(level);
    consoleHandler.setFormatter(new SimpleFormatter());
}
Also used : SimpleFormatter(java.util.logging.SimpleFormatter) ConsoleHandler(java.util.logging.ConsoleHandler) Handler(java.util.logging.Handler) Logger(java.util.logging.Logger) ConsoleHandler(java.util.logging.ConsoleHandler)

Aggregations

SimpleFormatter (java.util.logging.SimpleFormatter)100 FileHandler (java.util.logging.FileHandler)59 Logger (java.util.logging.Logger)36 File (java.io.File)28 Handler (java.util.logging.Handler)23 IOException (java.io.IOException)17 StreamHandler (java.util.logging.StreamHandler)16 Properties (java.util.Properties)15 ByteArrayOutputStream (java.io.ByteArrayOutputStream)14 LogRecord (java.util.logging.LogRecord)13 BalancerRunner (org.mobicents.tools.sip.balancer.BalancerRunner)13 Config (edu.neu.ccs.pyramid.configuration.Config)11 ConsoleHandler (java.util.logging.ConsoleHandler)10 Formatter (java.util.logging.Formatter)9 Test (org.junit.Test)7 MockResponse (com.google.mockwebserver.MockResponse)6 HttpClient (org.apache.http.client.HttpClient)6 HttpGet (org.apache.http.client.methods.HttpGet)6 DefaultHttpClient (org.apache.http.impl.client.DefaultHttpClient)6 Pair (edu.neu.ccs.pyramid.util.Pair)3