Package org.apache.log4j.varia

Examples of org.apache.log4j.varia.ListAppender


   *
   * @param repository
   */
  protected void attachListAppender(LoggerRepository repository) {
    Logger ll = repository.getLogger(Constants.LOG4J_PACKAGE_NAME);
    Appender appender = new ListAppender();
    appender.setName(Constants.TEMP_LIST_APPENDER_NAME);
    ll.addAppender(appender);
    ll.setAdditivity(false);
  }
View Full Code Here


    // FIXME: What happens if the users wanted to set the additivity flag
    // for "org.apahce.log4j" to false in the config file? We are now
    // potentially overriding her wishes but I don't see any other way.
    ll.setAdditivity(true);
   
    ListAppender listAppender = (ListAppender) ll.getAppender(Constants.TEMP_LIST_APPENDER_NAME);
    if(listAppender == null) {
      String errMsg = "Could not find appender "+Constants.TEMP_LIST_APPENDER_NAME;
      getLogger(repository).error(errMsg);
      addError(new ErrorItem(errMsg));
      return;
    }
   
    List eventList = listAppender.getList();
    int size = eventList.size();
    for(int i = 0; i < size; i++) {
      LoggingEvent event = (LoggingEvent) eventList.get(i);
      Logger xLogger = event.getLogger();
      if (event.getLevel().isGreaterOrEqual(xLogger.getEffectiveLevel())) {
        xLogger.callAppenders(event);
      }
    }
    listAppender.clearList();
    listAppender.close();
    ll.removeAppender(listAppender);
  }
View Full Code Here

   *
   * @param repository
   */
  protected void attachListAppender(LoggerRepository repository) {
    Logger ll = repository.getLogger(Constants.LOG4J_PACKAGE_NAME);
    Appender appender = new ListAppender();
    appender.setName(Constants.TEMP_LIST_APPENDER_NAME);
    ll.addAppender(appender);
    ll.setAdditivity(false);
  }
View Full Code Here

    // FIXME: What happens if the users wanted to set the additivity flag
    // for "org.apahce.log4j" to false in the config file? We are now
    // potentially overriding her wishes but I don't see any other way.
    ll.setAdditivity(true);
   
    ListAppender listAppender = (ListAppender) ll.getAppender(Constants.TEMP_LIST_APPENDER_NAME);
    if(listAppender == null) {
      String errMsg = "Could not find appender "+Constants.TEMP_LIST_APPENDER_NAME;
      getLogger(repository).error(errMsg);
      addError(new ErrorItem(errMsg));
      return;
    }
   
    List eventList = listAppender.getList();
    int size = eventList.size();
    for(int i = 0; i < size; i++) {
      LoggingEvent event = (LoggingEvent) eventList.get(i);
      Logger xLogger = event.getLogger();
      if (event.getLevel().isGreaterOrEqual(xLogger.getEffectiveLevel())) {
        xLogger.callAppenders(event);
      }
    }
    listAppender.clearList();
    listAppender.close();
    ll.removeAppender(listAppender);
  }
View Full Code Here

   *
   * @param repository
   */
  protected void attachListAppender(LoggerRepository repository) {
    Logger ll = repository.getLogger(Constants.LOG4J_PACKAGE_NAME);
    Appender appender = new ListAppender();
    appender.setName(Constants.TEMP_LIST_APPENDER_NAME);
    ll.addAppender(appender);
    ll.setAdditivity(false);
  }
View Full Code Here

    // FIXME: What happens if the users wanted to set the additivity flag
    // for "org.apahce.log4j" to false in the config file? We are now
    // potentially overriding her wishes but I don't see any other way.
    ll.setAdditivity(true);
   
    ListAppender listAppender = (ListAppender) ll.getAppender(Constants.TEMP_LIST_APPENDER_NAME);
    if(listAppender == null) {
      String errMsg = "Could not find appender "+Constants.TEMP_LIST_APPENDER_NAME;
      getLogger(repository).error(errMsg);
      addError(new ErrorItem(errMsg));
      return;
    }
   
    List eventList = listAppender.getList();
    int size = eventList.size();
    for(int i = 0; i < size; i++) {
      LoggingEvent event = (LoggingEvent) eventList.get(i);
      Logger xLogger = event.getLogger();
      if (event.getLevel().isGreaterOrEqual(xLogger.getEffectiveLevel())) {
        xLogger.callAppenders(event);
      }
    }
    listAppender.clearList();
    listAppender.close();
    ll.removeAppender(listAppender);
  }
View Full Code Here

   *
   * @param repository
   */
  protected void attachListAppender(LoggerRepository repository) {
    Logger ll = repository.getLogger(Constants.LOG4J_PACKAGE_NAME);
    Appender appender = new ListAppender();
    appender.setName(Constants.TEMP_LIST_APPENDER_NAME);
    ll.addAppender(appender);
    ll.setAdditivity(false);
  }
View Full Code Here

    // FIXME: What happens if the users wanted to set the additivity flag
    // for "org.apahce.log4j" to false in the config file? We are now
    // potentially overriding her wishes but I don't see any other way.
    ll.setAdditivity(true);
   
    ListAppender listAppender = (ListAppender) ll.getAppender(Constants.TEMP_LIST_APPENDER_NAME);
    if(listAppender == null) {
      String errMsg = "Could not find appender "+Constants.TEMP_LIST_APPENDER_NAME;
      getLogger(repository).error(errMsg);
      addError(new ErrorItem(errMsg));
      return;
    }
   
    List eventList = listAppender.getList();
    int size = eventList.size();
    for(int i = 0; i < size; i++) {
      LoggingEvent event = (LoggingEvent) eventList.get(i);
      Logger xLogger = event.getLogger();
      if (event.getLevel().isGreaterOrEqual(xLogger.getEffectiveLevel())) {
        xLogger.callAppenders(event);
      }
    }
    listAppender.clearList();
    listAppender.close();
    ll.removeAppender(listAppender);
  }
View Full Code Here

TOP

Related Classes of org.apache.log4j.varia.ListAppender

Copyright © 2018 www.massapicom. 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.