示例#1
0
文件: Log.java 项目: nihed/magnetism
  private static void createLogger(
      String pattern, String logName, long maxLogSize, Logger logger, Priority priority) {
    // debug log file
    ExtendedPatternFormatter formatter = new ExtendedPatternFormatter(pattern);
    StreamTarget target = null;
    Exception ioe = null;

    try {
      // home was not setup correctly
      if (logName == null) {
        throw new IOException("LogName was null - WildfireHome not set?");
      } else {
        RevolvingFileStrategy fileStrategy = new RevolvingFileStrategy(logName, 5);
        RotateStrategyBySize rotateStrategy = new RotateStrategyBySize(maxLogSize * 1024);
        target = new RotatingFileTarget(formatter, rotateStrategy, fileStrategy);
      }
    } catch (IOException e) {
      ioe = e;
      // can't log to file, log to stderr
      target = new StreamTarget(System.err, formatter);
    }

    logger.setLogTargets(new LogTarget[] {target});
    logger.setPriority(priority);

    if (ioe != null) {
      logger.debug("Error occurred opening log file: " + ioe.getMessage());
    }
  }
示例#2
0
文件: Log.java 项目: nihed/magnetism
 public static void fatal(String s, Throwable throwable) {
   if (isFatalEnabled()) {
     errorLog.fatalError(s, throwable);
     if (isDebugEnabled()) {
       printToStdErr(s, throwable);
     }
   }
 }
示例#3
0
文件: Log.java 项目: nihed/magnetism
 public static void error(String s, Throwable throwable) {
   if (isErrorEnabled()) {
     errorLog.error(s, throwable);
     if (isDebugEnabled()) {
       printToStdErr(s, throwable);
     }
   }
 }
示例#4
0
文件: Log.java 项目: nihed/magnetism
 public static void error(String s) {
   if (isErrorEnabled()) {
     errorLog.error(s);
     if (isDebugEnabled()) {
       printToStdErr(s, null);
     }
   }
 }
示例#5
0
文件: Log.java 项目: nihed/magnetism
 public static void error(Throwable throwable) {
   if (isErrorEnabled()) {
     errorLog.error("", throwable);
     if (isDebugEnabled()) {
       printToStdErr(null, throwable);
     }
   }
 }
示例#6
0
文件: Log.java 项目: nihed/magnetism
 public static void fatal(String s) {
   if (isFatalEnabled()) {
     errorLog.fatalError(s);
     if (isDebugEnabled()) {
       printToStdErr(s, null);
     }
   }
 }
示例#7
0
文件: Log.java 项目: nihed/magnetism
 public static void fatal(Throwable throwable) {
   if (isFatalEnabled()) {
     errorLog.fatalError("", throwable);
     if (isDebugEnabled()) {
       printToStdErr(null, throwable);
     }
   }
 }
示例#8
0
文件: Log.java 项目: nihed/magnetism
 public static void rotateErrorLogFile() {
   RotatingFileTarget target = (RotatingFileTarget) errorLog.getLogTargets()[0];
   try {
     target.rotate();
   } catch (IOException e) {
     System.err.println(
         "Warning: There was an error rotating the Jive error log file. "
             + "Logging may not work correctly until a restart happens.");
   }
 }
示例#9
0
文件: Log.java 项目: nihed/magnetism
 public static void markErrorLogFile(String username) {
   RotatingFileTarget target = (RotatingFileTarget) errorLog.getLogTargets()[0];
   markLogFile(username, target);
 }
示例#10
0
文件: Log.java 项目: nihed/magnetism
 public static void warn(String s, Throwable throwable) {
   if (isWarnEnabled()) {
     warnLog.warn(s, throwable);
   }
 }
示例#11
0
文件: Log.java 项目: nihed/magnetism
 public static boolean isWarnEnabled() {
   return warnLog.isWarnEnabled();
 }
示例#12
0
文件: Log.java 项目: nihed/magnetism
 public static void info(String s, Throwable throwable) {
   if (isInfoEnabled()) {
     infoLog.info(s, throwable);
   }
 }
示例#13
0
文件: Log.java 项目: nihed/magnetism
 public static void info(Throwable throwable) {
   if (isInfoEnabled()) {
     infoLog.info("", throwable);
   }
 }
示例#14
0
文件: Log.java 项目: nihed/magnetism
 public static void info(String s) {
   if (isInfoEnabled()) {
     infoLog.info(s);
   }
 }
示例#15
0
文件: Log.java 项目: nihed/magnetism
 public static void debug(String s, Throwable throwable) {
   if (isDebugEnabled()) {
     debugLog.debug(s, throwable);
   }
 }
示例#16
0
文件: Log.java 项目: nihed/magnetism
 public static void debug(Throwable throwable) {
   if (isDebugEnabled()) {
     debugLog.debug("", throwable);
   }
 }
示例#17
0
文件: Log.java 项目: nihed/magnetism
 public static void debug(String s) {
   if (isDebugEnabled()) {
     debugLog.debug(s);
   }
 }
示例#18
0
文件: Log.java 项目: nihed/magnetism
 public static boolean isFatalEnabled() {
   return errorLog.isFatalErrorEnabled();
 }
示例#19
0
文件: Log.java 项目: nihed/magnetism
 public static void warn(Throwable throwable) {
   if (isWarnEnabled()) {
     warnLog.warn("", throwable);
   }
 }
示例#20
0
文件: Log.java 项目: nihed/magnetism
 public static void warn(String s) {
   if (isWarnEnabled()) {
     warnLog.warn(s);
   }
 }
示例#21
0
文件: Log.java 项目: nihed/magnetism
 public static boolean isInfoEnabled() {
   return infoLog.isInfoEnabled();
 }