Exemplo n.º 1
0
  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());
    }
  }
Exemplo n.º 2
0
 public static void debug(String s, Throwable throwable) {
   if (isDebugEnabled()) {
     debugLog.debug(s, throwable);
   }
 }
Exemplo n.º 3
0
 public static void debug(Throwable throwable) {
   if (isDebugEnabled()) {
     debugLog.debug("", throwable);
   }
 }
Exemplo n.º 4
0
 public static void debug(String s) {
   if (isDebugEnabled()) {
     debugLog.debug(s);
   }
 }