Package org.apache.log4j

Examples of org.apache.log4j.Appender


       
        String logMessagesFile = "TestGrunt-testExplainScript2-stderr.txt";
        // add a file based appender to the root logger so we can parse the
        // messages logged by grunt and verify that grunt commands are ignored
        // in explain -script mode
        Appender fileAppender = new FileAppender(new PatternLayout(), logMessagesFile);
       
        try {
            org.apache.log4j.LogManager.getRootLogger().addAppender(fileAppender);
            Grunt grunt = new Grunt(new BufferedReader(reader), context);
            grunt.exec();
View Full Code Here


    Enumeration<Logger> allLoggers = LogManager.getCurrentLoggers();
    while (allLoggers.hasMoreElements()) {
      Logger l = allLoggers.nextElement();
      Enumeration<Appender> allAppenders = l.getAllAppenders();
      while (allAppenders.hasMoreElements()) {
        Appender a = allAppenders.nextElement();
        if (a instanceof TaskLogAppender) {
          ((TaskLogAppender)a).flush();
        }
      }
    }
View Full Code Here

    logger.setLevel(Level.OFF);

    // Close the appenders and force all logs to be flushed
    Enumeration<?> appenders = logger.getAllAppenders();
    while (appenders.hasMoreElements()) {
      Appender appender = (Appender)appenders.nextElement();
      appender.close();
    }

    BufferedReader reader = new BufferedReader(new FileReader(auditLogFile));
    String line = null;
    boolean ret = true;
View Full Code Here

    logger.setLevel(Level.OFF);

    // Close the appenders and force all logs to be flushed
    Enumeration<?> appenders = logger.getAllAppenders();
    while (appenders.hasMoreElements()) {
      Appender appender = (Appender)appenders.nextElement();
      appender.close();
    }

    BufferedReader reader = new BufferedReader(new FileReader(auditLogFile));
    String line = null;
    boolean ret = true;
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

    public void testFileDeletion() throws Exception
    {
        Logger logger = Logger.getLogger(FileChangedReloadingStrategy.class.getName());
        Layout layout = new PatternLayout("%p - %m%n");
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        Appender appender = new WriterAppender(layout, os);
        logger.addAppender(appender);
        logger.setLevel(Level.WARN);
        logger.setAdditivity(false);
        // create a new configuration
        File file = new File("target/testReload.properties");
View Full Code Here

       
        String logMessagesFile = "TestGrunt-testExplainScript2-stderr.txt";
        // add a file based appender to the root logger so we can parse the
        // messages logged by grunt and verify that grunt commands are ignored
        // in explain -script mode
        Appender fileAppender = new FileAppender(new PatternLayout(), logMessagesFile);
       
        try {
            org.apache.log4j.LogManager.getRootLogger().addAppender(fileAppender);
            Grunt grunt = new Grunt(new BufferedReader(reader), context);
            grunt.exec();
View Full Code Here

        ConsoleAppender consoleAppender = null;
        for(Enumeration<Appender> e = (Enumeration<Appender>)rootLogger.getAllAppenders();
            e.hasMoreElements();) {
       
          Appender a = e.nextElement();
          if(a instanceof ConsoleAppender) {
            consoleAppender = (ConsoleAppender)a;
            break;
          }
        }
View Full Code Here

        ConsoleAppender consoleAppender = null;
        for(Enumeration<Appender> e = (Enumeration<Appender>)rootLogger.getAllAppenders();
            e.hasMoreElements();) {
       
          Appender a = e.nextElement();
          if(a instanceof ConsoleAppender) {
            consoleAppender = (ConsoleAppender)a;
            break;
          }
        }
View Full Code Here

        ConsoleAppender consoleAppender = null;
        for(Enumeration<Appender> e = (Enumeration<Appender>)rootLogger.getAllAppenders();
            e.hasMoreElements();) {
       
          Appender a = e.nextElement();
          if(a instanceof ConsoleAppender) {
            consoleAppender = (ConsoleAppender)a;
            break;
          }
        }
View Full Code Here

TOP

Related Classes of org.apache.log4j.Appender

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.