Package java.util.logging

Examples of java.util.logging.FileHandler


                    // could exit loop here, but keep on going for robustness (might be more than on handler)
                }
            }
            // set default logging
            Logger.getLogger("").setLevel(logLevel);
            Handler fileHandler = new FileHandler(logFilePath);
            fileHandler.setFormatter(DETAIL_FORMATTER);
            Logger.getLogger("").addHandler(fileHandler);
            logger.log(Level.INFO, "Logging Service configured");
        } catch (IOException ioe) {
            logger.log(Level.WARNING, "Could not set logging configuration", ioe);
        }
View Full Code Here


      // For more pattern info, see
      // http://docs.oracle.com/javase/6/docs/api/java/util/logging/FileHandler.html
      String logPattern = directory + File.separator + LOG_PREFIX
          + getTimestamp() + ".%u.%g.log";

      FileHandler handler = new FileHandler(logPattern, LIMIT_PER_FILE,
          MAX_NUM_LOG_FILES, APPEND);

      handler.setFormatter(new SimpleFormatter());
     

      this.logger = Logger.getLogger(LOGGER_NAME);
      this.logger.addHandler(handler);
      this.logger.setUseParentHandlers(SEND_TO_PARENT_LOGGER);
View Full Code Here

        // Setup file logger
        try
        {
            String pattern = getDefaultLogFilePattern();
            ensureParentDirectoryExists(pattern);
            FileHandler handler = new FileHandler(pattern, LOGGING_LIMIT, LOGGING_LOOP_COUNT);
            handler.setFormatter(new TinyFormatter());
            aLogger.addHandler(handler);
        } catch (IOException e)
        {
            System.err.println(MessageFormat.format(Strings.error("logging.failed.to.configure"),
                e.getLocalizedMessage()));
View Full Code Here

      myServer.setConsoleLoggingToMicro();
    }

    //setup logger to log to file
    Logger logger = null;
    FileHandler txtLog = null;
    final String logDir = CmpConfiguration.getTCPLogDir();
    final File logFile = new File(logDir + "/");
    if(!logFile.canRead()) {
      logFile.mkdir();
    }
    try  {
      logger = Logger.getLogger("");
      logger.setLevel(Level.FINEST);

      logger = Logger.getLogger("cmptcpserver");
      logger.setLevel(Level.FINEST);
      txtLog = new FileHandler(logDir+"/cmptcpserver.log");
      //reduce info
      txtLog.setFormatter(new org.quickserver.util.logging.MicroFormatter());
      logger.addHandler(txtLog);

      myServer.setAppLogger(logger); //imp

      //myServer.setConsoleLoggingToMicro();
View Full Code Here

        }
    }

    public static void main(String args[]) throws Exception {
        if (args.length > 0 && args[0].equalsIgnoreCase("-debug")) {
            Handler fh = new FileHandler("reJ.log");
            Logger.getLogger("net.sf.rej").addHandler(fh);
          Logger.getLogger("net.sf.rej").setLevel(Level.FINEST);         
        } else if (args.length > 0 && args[0].equalsIgnoreCase("-nolog")) {
          // no logging
        } else {
            Handler fh = new FileHandler("reJ.log");
            Logger.getLogger("net.sf.rej").addHandler(fh);
          Logger.getLogger("net.sf.rej").setLevel(Level.WARNING);
        }

        SwingUtilities.invokeLater(new Runnable() {
View Full Code Here

  private DatabaseConnection()
  {
    logger.setLevel(Level.ALL);
    try
    {
      fh = new FileHandler( "log.txt" );
      logger.addHandler(fh);
      fh.setFormatter(new SimpleFormatter());
    }  
    catch (SecurityException exception)
    {
View Full Code Here

  }

  public static void initLogger(Logger logger, String outputLogPath) {
    try {
      logger.setUseParentHandlers(false);
      FileHandler fh = new FileHandler(outputLogPath);
      fh.setFormatter(new TextFormatter());
      fh.setLevel(Level.INFO);
      logger.addHandler(fh);
    }
    catch (SecurityException se) {
      se.printStackTrace();
    }
View Full Code Here

    public void setCount(int count) {
        this._count = count;
    }
   
    protected Handler createNativeHandler() throws Exception {
        final FileHandler fhandler = new FileHandler(_pattern, _limit, _count, _append);
        //MemoryHandler mhandler = new MemoryHandler(fhandler, 1000, Level.SEVERE);
        return fhandler;
    }
View Full Code Here

    if (config.getBoolean(null, ConfigurationValueBoolean.DEBUG_DETAILS)) {
      Logger.getLogger("org.wikipediacleaner").setLevel(Level.FINE);
    }
    if (config.getBoolean(null, ConfigurationValueBoolean.DEBUG_FILE)) {
      try {
        Handler fh = new FileHandler("%t/WPCleaner.log");
        fh.setFormatter(new SimpleFormatter());
        Logger.getLogger("").addHandler(fh);
      } catch (Exception e) {
        // Nothing to do
      }
    }
View Full Code Here

    if (config.getBoolean(null, ConfigurationValueBoolean.DEBUG_DETAILS)) {
      Logger.getLogger("org.wikipediacleaner").setLevel(Level.FINE);
    }
    if (config.getBoolean(null, ConfigurationValueBoolean.DEBUG_FILE)) {
      try {
        Handler fh = new FileHandler("WPCleanerBot.log");
        fh.setFormatter(new SimpleFormatter());
        Logger.getLogger("").addHandler(fh);
      } catch (Exception e) {
        // Nothing to do
      }
    }
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.