Package org.apache.log4j

Examples of org.apache.log4j.RollingFileAppender


  public final void setNotifier(final WriteNotifier notifier) {
    this.notifier = notifier;
  }

  private void configure() throws IOException {
    appender = new RollingFileAppender(layout, recordToFile, false);
    logger = createLogger();
    appender.setMaxFileSize(fileSize);
    appender.setMaxBackupIndex(fileMax);
    appender.setImmediateFlush(true);
    logger.removeAllAppenders();
View Full Code Here


        }

        // file appender
        if (usedOptions.log_target.equals(MolgenisOptions.LogTarget.FILE))
        {
          RollingFileAppender fa = new RollingFileAppender(pattern, "logger.out");
          fa.setMaximumFileSize(100000000); // 100MB
          rootLogger.addAppender(fa);
          System.out.println("Log4j FILE appender added with level " + usedOptions.log_level
              + ", writing to: " + new File(fa.getFile()).getAbsolutePath());
        }

        // add no appender at all
        if (usedOptions.log_target.equals(MolgenisOptions.LogTarget.OFF))
        {
View Full Code Here

    {
        try
        {
            // to add the appender
            PatternLayout layout = new PatternLayout("%d - %m%n");
            this.appender = new RollingFileAppender(layout, file, true);

            // if we successfully created the file appender,
            // configure it and set the logger to use only it
            appender.setMaxBackupIndex(1);
            appender.setMaximumFileSize(100000);
View Full Code Here

      // need to create a new log4j hierarchy so values in log4j.xml are ignored
      observerLogger = new Hierarchy(new RootLogger(Level.DEBUG)).getLogger(this.getClass().getName());
      PatternLayout layout = new PatternLayout();
      layout.setConversionPattern(conversionPattern);
      try {
        appender = new RollingFileAppender(layout, baseLogPath + jobRunId + ".log");
        appender.setMaxBackupIndex(maxBackupIndex);
        log.info("Log file for this run will be located at: " + appender.getFile());
        observerLogger.addAppender(appender);
      } catch (IOException e) {
        log.error(e);
View Full Code Here

            appender = (Appender)filesTable.get(path);
            if (appender == null)
            {
                try
                {
                    appender = new RollingFileAppender(layout, path, true);
                    ((RollingFileAppender)appender)
                        .setMaxBackupIndex(loggingConfig.getBackupFiles());
                    //finding file size
                    if (loggingConfig.getFileSize() > -1)
                    {
View Full Code Here

    }
    Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
    // disable logging while the cluster startup preps files
    logger.setLevel(Level.OFF);
    PatternLayout layout = new PatternLayout("%m%n");
    RollingFileAppender appender = new RollingFileAppender(layout, auditLogFile);
    logger.addAppender(appender);
  }
View Full Code Here

      file.delete();
    }
    Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
    logger.setLevel(Level.INFO);
    PatternLayout layout = new PatternLayout("%m%n");
    RollingFileAppender appender = new RollingFileAppender(layout, auditLogFile);
    logger.addAppender(appender);
  }
View Full Code Here

      file.delete();
    }
    Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
    logger.setLevel(Level.INFO);
    PatternLayout layout = new PatternLayout("%m%n");
    RollingFileAppender appender = new RollingFileAppender(layout, auditLogFile);
    logger.addAppender(appender);
  }
View Full Code Here

      String logPath = CmsPropertyHandler.getLogPath();
     
      Enumeration enumeration = Logger.getLogger("org.infoglue.cms").getAllAppenders();
          while(enumeration.hasMoreElements())
          {
            RollingFileAppender appender = (RollingFileAppender)enumeration.nextElement();
              if(appender.getName().equalsIgnoreCase("INFOGLUE-FILE"))
              {
            appender.setFile(logPath);
            appender.activateOptions();
                Logger.getLogger(ComponentBasedHTMLPageInvoker.class).addAppender(appender);
                break;
              }
          }
View Full Code Here

      String logPath = CmsPropertyHandler.getLogPath();
     
      Enumeration enumeration = Logger.getLogger("org.infoglue.cms").getAllAppenders();
          while(enumeration.hasMoreElements())
          {
            RollingFileAppender appender = (RollingFileAppender)enumeration.nextElement();
              if(appender.getName().equalsIgnoreCase("INFOGLUE-FILE"))
              {
                appender.setFile(logPath);
            appender.activateOptions();
                Logger.getLogger("org.infoglue.deliver.invokers.ComponentBasedHTMLPageInvoker").addAppender(appender);
                break;
              }
          }
View Full Code Here

TOP

Related Classes of org.apache.log4j.RollingFileAppender

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.