Package com.firefly.utils.log.file

Examples of com.firefly.utils.log.file.FileLog


    logTask.start();
  }

  private void defaultLog() {
    String name = "firefly-system";
    FileLog fileLog = new FileLog();
    fileLog.setName(name);
    fileLog.setLevel(2);
    fileLog.setFileOutput(false);
    fileLog.setConsoleOutput(true);
    System.out.println(name + "|console");
    logMap.put(name, fileLog);
  }
View Full Code Here


      if (strs.length < 2)
        throw new LogException("config format error");

      int level = levelMap.get(strs[0]);
      String path = strs[1];
      FileLog fileLog = new FileLog();
      fileLog.setName(name);
      fileLog.setLevel(level);

      if ("console".equalsIgnoreCase(path)) {
        fileLog.setFileOutput(false);
        fileLog.setConsoleOutput(true);
      } else {
        File file = new File(path);
        if (!file.exists()) {
          boolean mkdirRet = file.mkdir();
          if (!mkdirRet)
            throw new LogException("create dir " + path
                + " failure");
        }

        if (!file.isDirectory())
          throw new LogException(path + " is not directory");

        fileLog.setPath(path);
        fileLog.setFileOutput(true);
        if (strs.length > 2)
          fileLog.setConsoleOutput("console".equalsIgnoreCase(strs[2]));
      }

      logMap.put(name, fileLog);
    }
  }
View Full Code Here

  public void flush() {
    for (Entry<String, Log> entry : logMap.entrySet()) {
      Log log = entry.getValue();
      if (log instanceof FileLog) {
       
        FileLog fileLog = (FileLog) log;
        fileLog.flush();
//        System.out.println(">>> flush all " + fileLog.getName());
      }
    }
  }
View Full Code Here

    logTask.start();
  }

  private void defaultLog() {
    String name = "firefly-system";
    FileLog fileLog = new FileLog();
    fileLog.setName(name);
    fileLog.setLevel(2);
    fileLog.setFileOutput(false);
    fileLog.setConsoleOutput(true);
    System.out.println(name + "|console");
    logMap.put(name, fileLog);
  }
View Full Code Here

      if (strs.length < 2)
        throw new LogException("config format error");

      int level = levelMap.get(strs[0]);
      String path = strs[1];
      FileLog fileLog = new FileLog();
      fileLog.setName(name);
      fileLog.setLevel(level);

      if ("console".equalsIgnoreCase(path)) {
        fileLog.setFileOutput(false);
        fileLog.setConsoleOutput(true);
      } else {
        File file = new File(path);
        if (!file.exists()) {
          boolean mkdirRet = file.mkdirs();
          if (!mkdirRet) {
            throw new LogException("create dir " + path + " failure");
          }
        }

        if (!file.isDirectory()) {
          throw new LogException(path + " is not directory");
        }

        fileLog.setPath(path);
        fileLog.setFileOutput(true);
        if (strs.length > 2)
          fileLog.setConsoleOutput("console".equalsIgnoreCase(strs[2]));
      }

      logMap.put(name, fileLog);
    }
  }
View Full Code Here

TOP

Related Classes of com.firefly.utils.log.file.FileLog

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.