Package java.util.logging

Examples of java.util.logging.FileHandler


    // Get own log file
    try {
      // Create an appending file handler
      new File(this.getDataFolder() + "/temp/").mkdir();
      FileHandler handler = new FileHandler(this.getDataFolder() + "/temp/war.log", true);

      // Add to War-specific logger
      Formatter formatter = new WarLogFormatter();
      handler.setFormatter(formatter);
      this.getLogger().addHandler(handler);
    } catch (IOException e) {
      this.getLogger().log(Level.WARNING, "Failed to create War log file");
    }
   
View Full Code Here


     */
  public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {
            ESeq argv = process_args(args);
            maybe_print_banner();

      Handler fh = new FileHandler("erjang.log");
      Logger.getLogger("").addHandler(fh);
     // Logger.getLogger("erjang").setLevel(Level.FINE);
      // Logger.getLogger("kilim.Task").setLevel(Level.FINEST);

    load_modules_and_drivers(Arrays.asList(MODULES), Arrays.asList(DRIVERS));
View Full Code Here

    LogManager manager = LogManager.getLogManager();
    String pattern = manager.getProperty(ErrorTriggeredFileHandler.class.getName() + ".pattern");
    if (pattern == null) {
      pattern = DEFAULT_PATTERN;
    }
    return new FileHandler(pattern);
  }
View Full Code Here

     * @throws SecurityException
     * @throws IOException
     */
    public MasterLoggingHandler(final String root, Level level) throws SecurityException,
                                                               IOException {
        this.fileHandler = new FileHandler(root + "/java.logging.bsfree.txt");

        //this.fh2.setFormatter(new SimpleFormatter());
        this.fileHandler.setFormatter(new SimpleAndWhatIWouldHaveLikedFormatter());

        // The output should appear in the files
View Full Code Here

    logger.setLevel(level);
    try {
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh-mma");
      Date currentTime_1 = new Date();
      String dateTime = sdf.format(currentTime_1);
      fileTxt = new FileHandler(dateTime + " log.txt");
    } catch (SecurityException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

            commandLog.setLevel(Level.ALL);

            log.log(Level.INFO, "Logging WorldEdit commands to " + file.getAbsolutePath());

            try {
                dynamicHandler.setHandler(new FileHandler(file.getAbsolutePath(), true));
            } catch (IOException e) {
                log.log(Level.WARNING, "Could not use command log file " + path + ": " + e.getMessage());
            }
        }
View Full Code Here

                }
            }
            else if(logFile.isDirectory()) {
                logFile = new File(logFile.getAbsolutePath()+ Config.getPathSeparator()+"aesh.log");
            }
            logHandler = new FileHandler(logFile.getAbsolutePath());
            logHandler.setFormatter(new SimpleFormatter());
        }
        catch (IOException e) {
            e.printStackTrace();
        }
View Full Code Here

    fLoggers.add(logger);
  }
 
  private void createFileHandler() throws AppException {
    try {
      fHandler = new FileHandler(getFileName(), MAX_BYTES, NUM_FILES, APPEND_TO_EXISTING);
      fHandler.setLevel(Level.FINEST);
      fHandler.setFormatter(new TimeSensitiveFormatter());
    }
    catch (IOException ex){
      throw new AppException("Cannot create FileHandler: " + ex.toString() , ex);
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(), "UTF-8");
        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.