Package org.apache.log4j

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


            Assert.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


        lookup.setConfiguration(config);
        String str = lookup.lookup(PATTERN1);
        assertTrue(str.startsWith("Goodbye"));
        str = lookup.lookup(PATTERN2);
        assertTrue("Incorrect value: " + str, str.equals("value Some text"));
        logger.removeAppender(app);

    }

    public static class Utility
    {
View Full Code Here

        verify("1001", config, 15);
        String xml = writer.getBuffer().toString();
        assertNotNull("No XML returned", xml);
        assertTrue("Incorect configuration data", xml.indexOf("<rowsPerPage>15</rowsPerPage>") >= 0);
        logger.removeAppender(app);
        logger.setLevel(Level.OFF);
        verify("1002", config, 25);
        verify("1003", config, 35);
        verify("1004", config, 50);
        verify("1005", config, 50);
View Full Code Here

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

    log.removeAppender(listAppender);
  }

  public interface TestRpc extends VersionedProtocol {
    public static final long VERSION = 1L;
    int test(boolean delay);
View Full Code Here

        // Delete the file.
        file.delete();
        //Old value should still be returned.
        assertEquals("Initial value", "value1", config.getString("string"));
        logger.removeAppender(appender);
        String str = os.toString();
        //System.out.println(str);
        assertTrue("No error was logged", str != null && str.length() > 0);
    }
}
View Full Code Here

          Logger l = (Logger) loggers.elementAt(i);
          LogLog.debug("FB: Searching for ["+primary.getName()+"] in logger ["
           +l.getName() + "].");
          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

          Appender appender = logger.getAppender("ASYNC");
          if (null != appender) {
            log.info("Closing log-forwarding appender");
            appender.close();
            log.info("Removing log-forwarding appender");
            logger.removeAppender(appender);
            loggingDisabled = true;
          }
        }
      }
    } catch (IllegalArgumentException e) {
View Full Code Here

  /**
   * 将此appender从logger中清除.
   */
  public void removeFromLogger(String loggerName) {
    Logger logger = Logger.getLogger(loggerName);
    logger.removeAppender(this);
  }

  /**
   * 将此appender从logger中清除.
   */
 
View Full Code Here

  /**
   * 将此appender从logger中清除.
   */
  public void removeFromLogger(Class<?> loggerClass) {
    Logger logger = Logger.getLogger(loggerClass);
    logger.removeAppender(this);
  }

  /**
   * 实现AppenderSkeleton的append函数, 将log事件加入到内部的List.
   */
 
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

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.