Package org.apache.log4j

Examples of org.apache.log4j.Logger.removeAppender()


    } finally {
      txn.close();
    }

    source.stop();
    logger.removeAppender(appender);

    Assert.assertNotNull(e);
    Assert.assertEquals(e.getHeaders().get(SyslogUtils.SYSLOG_FACILITY), String.valueOf(SyslogAppender.LOG_FTP));
    Assert.assertArrayEquals(e.getBody(),"test flume syslog".getBytes());
  }
View Full Code Here


      LogLog.debug("FB: Searching for ["+primary.getName()+"] in logger"
       +l.getName());
      //if(l.isAttached(primary)) {
      LogLog.debug("FB: Replacing ["+primary.getName()+"] by ["
       + backup.getName() + " in logger"+ l);
      l.removeAppender(primary);
      LogLog.debug("FB: Adding appender ["+backup.getName()+"] to logger "
       +  l.getName());
      l.addAppender(backup);
    }   
  }
View Full Code Here

            assertTrue("waiting for server 1 down",
                    ClientBase.waitForServerDown("127.0.0.1:" + CLIENT_PORT_QP1,
                            ClientBase.CONNECTION_TIMEOUT));

        } finally {
            qlogger.removeAppender(appender);
        }

        LineNumberReader r = new LineNumberReader(new StringReader(os.toString()));
        String line;
        boolean found = false;
View Full Code Here

            assertTrue("waiting for server 2 down",
                    ClientBase.waitForServerDown("127.0.0.1:" + CLIENT_PORT_QP2,
                            ClientBase.CONNECTION_TIMEOUT));

        } finally {
            zlogger.removeAppender(appender);
        }
        os.close();
        LineNumberReader r = new LineNumberReader(new StringReader(os.toString()));
        String line;
        boolean found = false;
View Full Code Here

      LogLog.debug("FB: Searching for ["+primary.getName()+"] in logger ["
       +l.getName() + "].");
      //if(l.isAttached(primary)) {
      LogLog.debug("FB: Replacing ["+primary.getName()+"] by ["
       + backup.getName() + "] in logger ["+ l.getName() +"].");
      l.removeAppender(primary);
      LogLog.debug("FB: Adding appender ["+backup.getName()+"] to logger "
       +  l.getName());
      l.addAppender(backup);
    }   
  }
View Full Code Here

            assertTrue("waiting for server 1 down",
                    ClientBase.waitForServerDown("localhost:" + CLIENT_PORT_QP1,
                            ClientBase.CONNECTION_TIMEOUT));

        } finally {
            qlogger.removeAppender(appender);
        }

        LineNumberReader r = new LineNumberReader(new StringReader(os.toString()));
        String line;
        boolean found = false;
View Full Code Here

            assertTrue("waiting for server 2 down",
                    ClientBase.waitForServerDown("localhost:" + CLIENT_PORT_QP2,
                            ClientBase.CONNECTION_TIMEOUT));

        } finally {
            zlogger.removeAppender(appender);
        }
        os.close();
        LineNumberReader r = new LineNumberReader(new StringReader(os.toString()));
        String line;
        boolean found = false;
View Full Code Here

      assertFalse(listAppender.getMessages().isEmpty());
      assertTrue(listAppender.getMessages().get(0).startsWith(
          "Too many delayed calls"));

      log.removeAppender(listAppender);
    } finally {
      clientEngine.close();
    }
  }
View Full Code Here

   @AfterMethod
   public void tearDownTest() {
      Logger log4jLogger = Logger.getRootLogger();
      log4jLogger.setLevel(oldLevel);
      log4jLogger.removeAppender(appender);
      appender.close();
   }


   public void testConfigWarnings() throws Exception {
View Full Code Here

    if (!appenders.isEmpty() && !(appenders.get(0) instanceof AsyncAppender)) {
      AsyncAppender asyncAppender = new AsyncAppender();
      // change logger to have an async appender containing all the
      // previously configured appenders
      for (Appender appender : appenders) {
        logger.removeAppender(appender);
        asyncAppender.addAppender(appender);
      }
      logger.addAppender(asyncAppender);       
    }
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.