Init java util logging

@param level the Level of message to log
@param isRedirectStdOutErr whether we redirect std out&amp;err
@param format the format to log
325491
public static void loggerInit(Level level, boolean isRedirectStdOutErr, String format)
      throws IOException {
    // Set the java util logging format
    setLoggingFormat(format);

    // Configure the root logger and its handlers so that all the
    // derived loggers will inherit the properties
    Logger rootLogger = Logger.getLogger("");
    for (Handler handler : rootLogger.getHandlers()) {
      handler.setLevel(level);
    }

    rootLogger.setLevel(level);

    if (rootLogger.getLevel().intValue() < Level.WARNING.intValue()) {
      // zookeeper logging scares me. if people want this, we can patch to config-drive this
      Logger.getLogger("org.apache.zookeeper").setLevel(Level.WARNING);
    }

    // setting logging for http client to be error level
    System.setProperty(
        "org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
    System.setProperty(
        "org.apache.commons.logging.simplelog.log.httpclient.wire", "ERROR");
    System.setProperty(
        "org.apache.commons.logging.simplelog.log.org.apache.http", "ERROR");
    System.setProperty(
        "org.apache.commons.logging.simplelog.log.org.apache.http.headers", "ERROR");

    if (isRedirectStdOutErr) {

      // Remove ConsoleHandler if present, to avoid StackOverflowError.
      // ConsoleHandler writes to System.err and since we are redirecting
      // System.err to Logger, it results in an infinite loop.
      for (Handler handler : rootLogger.getHandlers()) {
        if (handler instanceof ConsoleHandler) {
          rootLogger.removeHandler(handler);
        }
      }

      // now rebind stdout/stderr to logger
      Logger logger;
      LoggingOutputStream los;

      logger = Logger.getLogger("stdout");
      los = new LoggingOutputStream(logger, StdOutErrLevel.STDOUT);
      System.setOut(new PrintStream(los, true));

      logger = Logger.getLogger("stderr");
      los = new LoggingOutputStream(logger, StdOutErrLevel.STDERR);
      System.setErr(new PrintStream(los, true));
    }
  }
424132
public static boolean log(Log log, Level level, Throwable t, String format, Object... arguments) {
		if (log instanceof LocationAwareLog) {
			((LocationAwareLog) log).log(FQCN, level, t, format, arguments);
			return true;
		} else {
			return false;
		}
	}
1339241
public void e(String format, Object... args) {
    println(LogLevel.ERROR, format, args);
  }
799922
@Override
    public void log(int level, String message) {
        switch (level) {
        case LogChute.WARN_ID:
            log.warn(message);
            break;
        case LogChute.INFO_ID:
            log.info(message);
            break;
        case LogChute.TRACE_ID:
            log.trace(message);
            break;
        case LogChute.ERROR_ID:
            log.error(message);
            break;
        case LogChute.DEBUG_ID:
        default:
            log.debug(message);
            break;
        }
    }
225209
public synchronized void log(String formattedLog)
    {
        if (_reopen || _out==null)
        {
            stop();
            start();
        }
        try
        {
            _buffer.write(formattedLog);
            _buffer.write(StringUtil.__LINE_SEPARATOR);
            if (_flushOn || _buffer.size()>_bufferSize)
            {
                _buffer.writeTo(_out);
                _buffer.resetWriter();
                _out.flush();
            }
        }
        catch(IOException e){e.printStackTrace();}
    }
553983
public void tracef(String format, Object... params) {
        doLogf(Level.TRACE, FQCN, format, params, null);
    }
377310
public static void v(String format, Object... args) {
    assertInitialization();
    sLogger.v(format, args);
  }
9976
@Override
    protected void logImpl(LogLevel level,Object[] message,Throwable throwable)
    {
        //format log message
        String text=this.formatLogMessage(level,message,throwable);
        
        //print text to system out
        System.out.println(text);
    }
298136
public void logf(Level level, String format, Object param1) {
        if (isEnabled(level)) {
            doLogf(level, FQCN, format, new Object[] { param1 }, null);
        }
    }
630683
public void logv(Level level, String format, Object... params) {
        doLog(level, FQCN, format, params, null);
    }
711974
public void debug(String format, Object arg1, Object arg2) {
        if (!logger.isDebugEnabled())
            return;

        if (instanceofLAL) {
            String formattedMessage = MessageFormatter.format(format, arg1, arg2).getMessage();
            ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.DEBUG_INT, formattedMessage, new Object[] { arg1, arg2 }, null);
        } else {
            logger.debug(format, arg1, arg2);
        }
    }
889001
public void logv(Level level, String format, Object param1) {
        if (isEnabled(level)) {
            doLog(level, FQCN, format, new Object[] { param1 }, null);
        }
    }
593722
public void log(LogLevel level, String msg, Throwable t)
	{
		if (level != LogLevel.OFF && level.level <= logLevel.level)
			logger.add(writers, name, level, msg, t);
	}
272567
public static void log(String format, Object...args) {
    System.out.println(String.format(format, args));
  }
299603
public void d(String format, Object... args) {
    println(LogLevel.DEBUG, format, args);
  }
17693
public void trace(String format, Object... args) {
        if (!logger.isTraceEnabled())
            return;

        if (instanceofLAL) {
            String formattedMessage = MessageFormatter.arrayFormat(format, args).getMessage();
            ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.TRACE_INT, formattedMessage, args, null);
        } else {
            logger.trace(format, args);
        }
    }
776919
public static void logPrintf(String format, String... v) {
        if (enableLog) {
            String tmp = String.format(format, (Object[]) v);
            logger.log(Level.INFO, tmp);
        }
    }