Package java.util.logging

Examples of java.util.logging.FileHandler


  public StrategySSS(String heroName) {
      super(heroName);
      try {
          logger = Logger.getLogger("General");
          fh = new FileHandler("c:\\temp\\poker\\sss.log", true);
          logger.addHandler(fh);
          logger.setLevel(Level.ALL);
          SimpleFormatter formatter = new SimpleFormatter();
                fh.setFormatter(formatter);
            } catch (IOException e) {
View Full Code Here


      System.getProperties().put("java.util.logging.config.file", LoggingTest.class.getResource("/logging.properties").getFile());
    logger = Logger.getLogger(LoggingTest.class.getName());
    Handler handler1;
    Handler handler2;
    try {
      handler1 = new FileHandler("./target/test/logs/1.log");
      handler2 = new FileHandler("./target/test/logs/2.log");
    } catch (SecurityException e) {
      throw new RuntimeException(e);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }   
View Full Code Here

         throw new Exception("mkdirs for logs directory return false");
      }

      Logger logger = Logger.getLogger(PGETaskInstance.class.getName()
            + "." + workflowInstId);
      FileHandler handler = new FileHandler(
            new File(logDir, createLogFileName()).getAbsolutePath());
      handler.setFormatter(new SimpleFormatter());
      logger.addHandler(handler);
      return logger;
   }
View Full Code Here

                + this.pgeMetadata.getMetadataValue(PgeTaskMetadataKeys.NAME);
    }

    protected Handler initializePgeLogHandler() throws SecurityException,
      IOException {
      FileHandler handler = null;
    String logFilePattern = this.pgeMetadata
        .getMetadataValue(PgeTaskMetadataKeys.LOG_FILE_PATTERN);
    if (logFilePattern != null) {
      LOG.log(Level.INFO, "Creating Log Handler to capture pge output to file '"
              + logFilePattern + "'");
      new File(logFilePattern).getParentFile().mkdirs();
      handler = new FileHandler(logFilePattern);
      handler.setFormatter(new SimpleFormatter());

    }
    return handler;
  }
View Full Code Here

      consoleHandler.setLevel(Level.FINEST);
      consoleHandler.setFormatter(new VerySimpleFormatter());

      // Add a file handler
      new File("log").mkdir();
      Handler fileHandler = new FileHandler("log/datamanager.log", 50000, 2, true);
      fileHandler.setLevel(Level.INFO);
      mainLogger.addHandler(fileHandler);
    }
    catch (IOException exc) {
      System.out.println("Can't create log file");
      exc.printStackTrace();
View Full Code Here

      consoleHandler.setLevel(Level.FINEST);
      consoleHandler.setFormatter(new VerySimpleFormatter());
     
      // Add a file handler
      new File("log").mkdir();
      Handler fileHandler = new FileHandler("log/mirrorupdater.log", 50000, 2, true);
      fileHandler.setLevel(Level.INFO);
      mainLogger.addHandler(fileHandler);
    }
    catch (IOException exc) {
      System.out.println("Can't create log file");
    }
View Full Code Here

          logPath = new String(tmp);
        }
        if (logPath.lastIndexOf(System.getProperty("file.separator")) != logPath.length()) {
          logPath = logPath + System.getProperty("file.separator");
        }
        Handler fh = new FileHandler(logPath + getName().replace(' ', '_') + ".log");
        Logger.getLogger("").addHandler(fh);
      } catch (Exception e) {
        logger = null;
        e.printStackTrace();
      }
View Full Code Here

    if (enable) {
      Handler[] handlers = getLogger().getHandlers();
      if (handlers == null || handlers.length == 0) {
        // add default file handler
        try {
          FileHandler fileHandler = new FileHandler(LOG_FILE, false);
          fileHandler.setLevel(Level.ALL);
          fileHandler.setFormatter(new PMLogFormatter());
          getLogger().addHandler(fileHandler);
        } catch (Throwable err) {
          System.err.println("Error initializing log file " + PMController.class.getName() + ": "
                  + err.toString());
        }
View Full Code Here

        initProps();
        File file = new File(TEMPPATH + SEP + "log");
        file.mkdir();
        manager.readConfiguration(EnvironmentHelper
                .PropertiesToInputStream(props));
        handler = new FileHandler();
        r = new LogRecord(Level.CONFIG, "msg");
        errSubstituteStream = new NullOutputStream();
        System.setErr(new PrintStream(errSubstituteStream));
    }
View Full Code Here

    }

    public void testLock() throws Exception {
        FileOutputStream output = new FileOutputStream(TEMPPATH + SEP + "log"
                + SEP + "java1.test.0");
        FileHandler h = new FileHandler();
        h.publish(r);
        h.close();
        assertFileContent(TEMPPATH + SEP + "log", "java1.test.0", h
                .getFormatter());
        output.close();
    }
View Full Code Here

TOP

Related Classes of java.util.logging.FileHandler

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.