Package org.apache.log4j

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


        try {
            logger.addAppender(appender);
            //now create an EMF which should trigger the createSObjects call
            Persistence.createEntityManagerFactory(TestContext.get().getPersistenceUnitName());
        } finally {
            logger.removeAppender(appender);
            logger.setLevel(origLevel);
        }
    }
   
   
View Full Code Here


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


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

            logEntry = log.get(3);
            assertTrue(logEntry.getMessage().toString()
                    .contains("APP[myapp-other] JOB[jobid-other] ACTION[-] Queueing event : ID: jobid-other"));
        }
        finally {
            logger.removeAppender(appender);
        }
    }

    private EventHandlerService _testEventHandlerService() throws Exception {
        Services services = Services.get();
View Full Code Here

        root.addAppender(appender);
    }

    public void doStop() {
        Logger root = Logger.getRootLogger();
        root.removeAppender(appender);
    }

    public void doFail() {
        doStop();
    }
View Full Code Here

        root.addAppender(appender);
    }

    public void doStop() {
        Logger root = Logger.getRootLogger();
        root.removeAppender(appender);
    }

    public void doFail() {
        doStop();
    }
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

      }

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

      log.removeAppender(listAppender);
    } finally {
      rpcClient.stop();
    }
  }
View Full Code Here

    public static void removeLogAppender(Class clazz, String appenderName) {
        Logger logger = Logger.getLogger(clazz);
        Appender appender = logger.getAppender(appenderName);
        appender.close();
        logger.removeAppender(appenderName);
    }
}
View Full Code Here

      catch(Exception e) { return; }
      if(i == -1) break;
      if(i == 'q') break;
      if(i == 'r') {
  System.out.println("Removing appender S");
  root.removeAppender("S");
      }
    }
  }

  static
View Full Code Here

        logger.setLevel(Level.ERROR);
        try {
            slaService.runSLAWorker();
        }
        finally {
            logger.removeAppender(appender);
        }

        List<LoggingEvent> log = appender.getLog();
        LoggingEvent firstLogEntry = log.get(0);
        assertEquals(Level.ERROR, firstLogEntry.getLevel());
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.