com.crashlytics.tools.android_2.1.0

er(b);
  }
  
  protected static Long valueOf(long b)
  {
    return new Long(b);
  }
  
  protected static Float valueOf(float b)
  {
    return new Float(b);
  }
  
  protected static Double valueOf(double b)
  {
    return new Double(b);
  }
  
  protected static Object[] toArray(Object param1)
  {
    return new Object[] { param1 };
  }
  
  protected static Object[] toArray(Object param1, Object param2)
  {
    return new Object[] { param1, param2 };
  }
  
  protected static Object[] toArray(Object param1, Object param2, Object param3)
  {
    return new Object[] { param1, param2, param3 };
  }
  
  protected static Object[] toArray(Object param1, Object param2, Object param3, Object param4)
  {
    return new Object[] { param1, param2, param3, param4 };
  }
  
  public static void entering(Logger logger, String sourceClass, String sourceMethod)
  {
    if (logger.isDebugEnabled()) {
      logger.callAppenders(new LoggingEvent(FQCN, logger, Level.DEBUG, sourceClass + "." + sourceMethod + " ENTRY", null));
    }
  }
  
  public static void entering(Logger logger, String sourceClass, String sourceMethod, String param)
  {
    if (logger.isDebugEnabled())
    {
      String msg = sourceClass + "." + sourceMethod + " ENTRY " + param;
      logger.callAppenders(new LoggingEvent(FQCN, logger, Level.DEBUG, msg, null));
    }
  }
  
  public static void entering(Logger logger, String sourceClass, String sourceMethod, Object param)
  {
    if (logger.isDebugEnabled())
    {
      String msg = sourceClass + "." + sourceMethod + " ENTRY ";
      if (param == null) {
        msg = msg + "null";
      } else {
        try
        {
          msg = msg + param;
        }
        catch (Throwable ex)
        {
          msg = msg + "?";
        }
      }
      logger.callAppenders(new LoggingEvent(FQCN, logger, Level.DEBUG, msg, null));
    }
  }
  
  public static void entering(Logger logger, String sourceClass, String sourceMethod, Object[] params)
  {
    if (logger.isDebugEnabled())
    {
      String msg = sourceClass + "." + sourceMethod + " ENTRY ";
      if ((params != null) && (params.length > 0))
      {
        String delim = "{";
        for (int i = 0; i < params.length; i++)
        {
          try
          {
            msg = msg + delim + params[i];
          }
          catch (Throwable ex)
          {
            msg = msg + delim + "?";
          }
          delim = ",";
        }
        msg = msg + "}";
      }
      else
      {
        msg = msg + "{}";
      }
      logger.callAppenders(new LoggingEvent(FQCN, logger, Level.DEBUG, msg, null));
    }
  }
  
  public static void exiting(Logger logger, String sourceClass, String sourceMethod)
  {
    if (logger.isDebugEnabled()) {
      logger.callAppenders(new LoggingEvent(FQCN, logger, Level.DEBUG, sourceClass + "." + sourceMethod + " RETURN", null));
    }
  }
  
  public static void exiting(Logger logger, String sourceClass, String sourceMethod, String result)
  {
    if (logger.isDebugEnabled()) {
      logger.callAppenders(new LoggingEvent(FQCN, logger, Level.DEBUG, sourceClass + "." + sourceMethod + " RETURN " + result, null));
    }
  }
  
  public static void exiting(Logger logger, String sourceClass, String sourceMethod, Object result)
  {
    if (logger.isDebugEnabled())
    {
      String msg = sourceClass + "." + sourceMethod + " RETURN ";
      if (result == null) {
        msg = msg + "null";
      } else {
        try
        {
          msg = msg + result;
        }
        catch (Throwable ex)
        {
          msg = msg + "?";
        }
      }
      logger.callAppenders(new LoggingEvent(FQCN, logger, Level.DEBUG, msg, null));
    }
  }
  
  public static void throwing(Logger logger, String sourceClass, String sourceMethod, Throwable thrown)
  {
    if (logger.isDebugEnabled()) {
      logger.callAppenders(new LoggingEvent(FQCN, logger, Level.DEBUG, sourceClass + "." + sourceMethod + " THROW", thrown));
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.LogXF
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

import org.apache.log4j.spi.LoggerFactory;
import org.apache.log4j.spi.LoggerRepository;

public class Logger
  extends Category
{
  private static final String FQCN = Logger.class.getName();
  
  protected Logger(String name)
  {
    super(name);
  }
  
  public static Logger getLogger(String name)
  {
    return LogManager.getLogger(name);
  }
  
  public static Logger getLogger(Class clazz)
  {
    return LogManager.getLogger(clazz.getName());
  }
  
  public static Logger getRootLogger()
  {
    return LogManager.getRootLogger();
  }
  
  public static Logger getLogger(String name, LoggerFactory factory)
  {
    return LogManager.getLogger(name, factory);
  }
  
  public void trace(Object message)
  {
    if (repository.isDisabled(5000)) {
      return;
    }
    if (Level.TRACE.isGreaterOrEqual(getEffectiveLevel())) {
      forcedLog(FQCN, Level.TRACE, message, null);
    }
  }
  
  public void trace(Object message, Throwable t)
  {
    if (repository.isDisabled(5000)) {
      return;
    }
    if (Level.TRACE.isGreaterOrEqual(getEffectiveLevel())) {
      forcedLog(FQCN, Level.TRACE, message, t);
    }
  }
  
  public boolean isTraceEnabled()
  {
    if (repository.isDisabled(5000)) {
      return false;
    }
    return Level.TRACE.isGreaterOrEqual(getEffectiveLevel());
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.Logger
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Hashtable;
import org.apache.log4j.helpers.Loader;
import org.apache.log4j.helpers.ThreadLocalMap;

public class MDC
{
  static final MDC mdc = new MDC();
  static final int HT_SIZE = 7;
  boolean java1;
  Object tlm;
  private Method removeMethod;
  
  private MDC()
  {
    java1 = Loader.isJava1();
    if (!java1) {
      tlm = new ThreadLocalMap();
    }
    try
    {
      removeMethod = ThreadLocal.class.getMethod("remove", null);
    }
    catch (NoSuchMethodException e) {}
  }
  
  public static void put(String key, Object o)
  {
    if (mdc != null) {
      mdc.put0(key, o);
    }
  }
  
  public static Object get(String key)
  {
    if (mdc != null) {
      return mdc.get0(key);
    }
    return null;
  }
  
  public static void remove(String key)
  {
    if (mdc != null) {
      mdc.remove0(key);
    }
  }
  
  public static Hashtable getContext()
  {
    if (mdc != null) {
      return mdc.getContext0();
    }
    return null;
  }
  
  public static void clear()
  {
    if (mdc != null) {
      mdc.clear0();
    }
  }
  
  private void put0(String key, Object o)
  {
    if ((java1) || (tlm == null)) {
      return;
    }
    Hashtable ht = (Hashtable)((ThreadLocalMap)tlm).get();
    if (ht == null)
    {
      ht = new Hashtable(7);
      ((ThreadLocalMap)tlm).set(ht);
    }
    ht.put(key, o);
  }
  
  private Object get0(String key)
  {
    if ((java1) || (tlm == null)) {
      return null;
    }
    Hashtable ht = (Hashtable)((ThreadLocalMap)tlm).get();
    if ((ht != null) && (key != null)) {
      return ht.get(key);
    }
    return null;
  }
  
  private void remove0(String key)
  {
    if ((!java1) && (tlm != null))
    {
      Hashtable ht = (Hashtable)((ThreadLocalMap)tlm).get();
      if (ht != null)
      {
        ht.remove(key);
        if (ht.isEmpty()) {
          clear0();
        }
      }
    }
  }
  
  private Hashtable getContext0()
  {
    if ((java1) || (tlm == null)) {
      return null;
    }
    return (Hashtable)((ThreadLocalMap)tlm).get();
  }
  
  private void clear0()
  {
    if ((!java1) && (tlm != null))
    {
      Hashtable ht = (Hashtable)((ThreadLocalMap)tlm).get();
      if (ht != null) {
        ht.clear();
      }
      if (removeMethod != null) {
        try
        {
          removeMethod.invoke(tlm, null);
        }
        catch (IllegalAccessException e) {}catch (InvocationTargetException e) {}
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.MDC
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

class NDC$DiagnosticContext
{
  String fullMessage;
  String message;
  
  NDC$DiagnosticContext(String message, DiagnosticContext parent)
  {
    this.message = message;
    if (parent != null) {
      fullMessage = (fullMessage + ' ' + message);
    } else {
      fullMessage = message;
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.NDC.DiagnosticContext
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Stack;
import java.util.Vector;
import org.apache.log4j.helpers.LogLog;

public class NDC
{
  static Hashtable ht = new Hashtable();
  static int pushCounter = 0;
  static final int REAP_THRESHOLD = 5;
  
  private static Stack getCurrentStack()
  {
    if (ht != null) {
      return (Stack)ht.get(Thread.currentThread());
    }
    return null;
  }
  
  public static void clear()
  {
    Stack stack = getCurrentStack();
    if (stack != null) {
      stack.setSize(0);
    }
  }
  
  public static Stack cloneStack()
  {
    Stack stack = getCurrentStack();
    if (stack == null) {
      return null;
    }
    return (Stack)stack.clone();
  }
  
  public static void inherit(Stack stack)
  {
    if (stack != null) {
      ht.put(Thread.currentThread(), stack);
    }
  }
  
  public static String get()
  {
    Stack s = getCurrentStack();
    if ((s != null) && (!s.isEmpty())) {
      return peekfullMessage;
    }
    return null;
  }
  
  public static int getDepth()
  {
    Stack stack = getCurrentStack();
    if (stack == null) {
      return 0;
    }
    return stack.size();
  }
  
  private static void lazyRemove()
  {
    if (ht == null) {
      return;
    }
    Vector v;
    synchronized (ht)
    {
      if (++pushCounter <= 5) {
        return;
      }
      pushCounter = 0;
      
      int misses = 0;
      v = new Vector();
      Enumeration enumeration = ht.keys();
      while ((enumeration.hasMoreElements()) && (misses <= 4))
      {
        Thread t = (Thread)enumeration.nextElement();
        if (t.isAlive())
        {
          misses++;
        }
        else
        {
          misses = 0;
          v.addElement(t);
        }
      }
    }
    int size = v.size();
    for (int i = 0; i < size; i++)
    {
      Thread t = (Thread)v.elementAt(i);
      LogLog.debug("Lazy NDC removal for thread [" + t.getName() + "] (" + ht.size() + ").");
      
      ht.remove(t);
    }
  }
  
  public static String pop()
  {
    Stack stack = getCurrentStack();
    if ((stack != null) && (!stack.isEmpty())) {
      return popmessage;
    }
    return "";
  }
  
  public static String peek()
  {
    Stack stack = getCurrentStack();
    if ((stack != null) && (!stack.isEmpty())) {
      return peekmessage;
    }
    return "";
  }
  
  public static void push(String message)
  {
    Stack stack = getCurrentStack();
    if (stack == null)
    {
      DiagnosticContext dc = new DiagnosticContext(message, null);
      stack = new Stack();
      Thread key = Thread.currentThread();
      ht.put(key, stack);
      stack.push(dc);
    }
    else if (stack.isEmpty())
    {
      DiagnosticContext dc = new DiagnosticContext(message, null);
      stack.push(dc);
    }
    else
    {
      DiagnosticContext parent = (DiagnosticContext)stack.peek();
      stack.push(new DiagnosticContext(message, parent));
    }
  }
  
  public static void remove()
  {
    if (ht != null)
    {
      ht.remove(Thread.currentThread());
      
      lazyRemove();
    }
  }
  
  public static void setMaxDepth(int maxDepth)
  {
    Stack stack = getCurrentStack();
    if ((stack != null) && (maxDepth < stack.size())) {
      stack.setSize(maxDepth);
    }
  }
  
  private static class DiagnosticContext
  {
    String fullMessage;
    String message;
    
    DiagnosticContext(String message, DiagnosticContext parent)
    {
      this.message = message;
      if (parent != null) {
        fullMessage = (fullMessage + ' ' + message);
      } else {
        fullMessage = message;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.NDC
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

class NameValue
{
  String key;
  String value;
  
  public NameValue(String key, String value)
  {
    this.key = key;
    this.value = value;
  }
  
  public String toString()
  {
    return key + "=" + value;
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.NameValue
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

import org.apache.log4j.helpers.PatternConverter;
import org.apache.log4j.helpers.PatternParser;
import org.apache.log4j.spi.LoggingEvent;

public class PatternLayout
  extends Layout
{
  public static final String DEFAULT_CONVERSION_PATTERN = "%m%n";
  public static final String TTCC_CONVERSION_PATTERN = "%r [%t] %p %c %x - %m%n";
  protected final int BUF_SIZE = 256;
  protected final int MAX_CAPACITY = 1024;
  private StringBuffer sbuf = new StringBuffer(256);
  private String pattern;
  private PatternConverter head;
  
  public PatternLayout()
  {
    this("%m%n");
  }
  
  public PatternLayout(String pattern)
  {
    this.pattern = pattern;
    head = createPatternParser(pattern == null ? "%m%n" : pattern).parse();
  }
  
  public void setConversionPattern(String conversionPattern)
  {
    pattern = conversionPattern;
    head = createPatternParser(conversionPattern).parse();
  }
  
  public String getConversionPattern()
  {
    return pattern;
  }
  
  public void activateOptions() {}
  
  public boolean ignoresThrowable()
  {
    return true;
  }
  
  protected PatternParser createPatternParser(String pattern)
  {
    return new PatternParser(pattern);
  }
  
  public String format(LoggingEvent event)
  {
    if (sbuf.capacity() > 1024) {
      sbuf = new StringBuffer(256);
    } else {
      sbuf.setLength(0);
    }
    PatternConverter c = head;
    while (c != null)
    {
      c.format(sbuf, event);
      c = next;
    }
    return sbuf.toString();
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.PatternLayout
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

public class Priority
{
  transient int level;
  transient String levelStr;
  transient int syslogEquivalent;
  public static final int OFF_INT = Integer.MAX_VALUE;
  public static final int FATAL_INT = 50000;
  public static final int ERROR_INT = 40000;
  public static final int WARN_INT = 30000;
  public static final int INFO_INT = 20000;
  public static final int DEBUG_INT = 10000;
  public static final int ALL_INT = Integer.MIN_VALUE;
  /**
   * @deprecated
   */
  public static final Priority FATAL = new Level(50000, "FATAL", 0);
  /**
   * @deprecated
   */
  public static final Priority ERROR = new Level(40000, "ERROR", 3);
  /**
   * @deprecated
   */
  public static final Priority WARN = new Level(30000, "WARN", 4);
  /**
   * @deprecated
   */
  public static final Priority INFO = new Level(20000, "INFO", 6);
  /**
   * @deprecated
   */
  public static final Priority DEBUG = new Level(10000, "DEBUG", 7);
  
  protected Priority()
  {
    level = 10000;
    levelStr = "DEBUG";
    syslogEquivalent = 7;
  }
  
  protected Priority(int level, String levelStr, int syslogEquivalent)
  {
    this.level = level;
    this.levelStr = levelStr;
    this.syslogEquivalent = syslogEquivalent;
  }
  
  public boolean equals(Object o)
  {
    if ((o instanceof Priority))
    {
      Priority r = (Priority)o;
      return level == level;
    }
    return false;
  }
  
  public final int getSyslogEquivalent()
  {
    return syslogEquivalent;
  }
  
  public boolean isGreaterOrEqual(Priority r)
  {
    return level >= level;
  }
  
  /**
   * @deprecated
   */
  public static Priority[] getAllPossiblePriorities()
  {
    return new Priority[] { FATAL, ERROR, Level.WARN, INFO, DEBUG };
  }
  
  public final String toString()
  {
    return levelStr;
  }
  
  public final int toInt()
  {
    return level;
  }
  
  /**
   * @deprecated
   */
  public static Priority toPriority(String sArg)
  {
    return Level.toLevel(sArg);
  }
  
  /**
   * @deprecated
   */
  public static Priority toPriority(int val)
  {
    return toPriority(val, DEBUG);
  }
  
  /**
   * @deprecated
   */
  public static Priority toPriority(int val, Priority defaultPriority)
  {
    return Level.toLevel(val, (Level)defaultPriority);
  }
  
  /**
   * @deprecated
   */
  public static Priority toPriority(String sArg, Priority defaultPriority)
  {
    return Level.toLevel(sArg, (Level)defaultPriority);
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.Priority
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
import org.apache.log4j.config.PropertySetter;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.helpers.OptionConverter;
import org.apache.log4j.or.RendererMap;
import org.apache.log4j.spi.Configurator;
import org.apache.log4j.spi.ErrorHandler;
import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.LoggerFactory;
import org.apache.log4j.spi.LoggerRepository;
import org.apache.log4j.spi.OptionHandler;
import org.apache.log4j.spi.RendererSupport;
import org.apache.log4j.spi.ThrowableRenderer;
import org.apache.log4j.spi.ThrowableRendererSupport;

public class PropertyConfigurator
  implements Configurator
{
  protected Hashtable registry = new Hashtable(11);
  private LoggerRepository repository;
  protected LoggerFactory loggerFactory = new DefaultCategoryFactory();
  static final String CATEGORY_PREFIX = "log4j.category.";
  static final String LOGGER_PREFIX = "log4j.logger.";
  static final String FACTORY_PREFIX = "log4j.factory";
  static final String ADDITIVITY_PREFIX = "log4j.additivity.";
  static final String ROOT_CATEGORY_PREFIX = "log4j.rootCategory";
  static final String ROOT_LOGGER_PREFIX = "log4j.rootLogger";
  static final String APPENDER_PREFIX = "log4j.appender.";
  static final String RENDERER_PREFIX = "log4j.renderer.";
  static final String THRESHOLD_PREFIX = "log4j.threshold";
  private static final String THROWABLE_RENDERER_PREFIX = "log4j.throwableRenderer";
  private static final String LOGGER_REF = "logger-ref";
  private static final String ROOT_REF = "root-ref";
  private static final String APPENDER_REF_TAG = "appender-ref";
  public static final String LOGGER_FACTORY_KEY = "log4j.loggerFactory";
  private static final String RESET_KEY = "log4j.reset";
  private static final String INTERNAL_ROOT_NAME = "root";
  
  public void doConfigure(String configFileName, LoggerRepository hierarchy)
  {
    Properties props = new Properties();
    FileInputStream istream = null;
    try
    {
      istream = new FileInputStream(configFileName);
      props.load(istream);
      istream.close();
      if (istream != null) {
        try
        {
          istream.close();
        }
        catch (InterruptedIOException ignore)
        {
          Thread.currentThread().interrupt();
        }
        catch (Throwable ignore) {}
      }
      doConfigure(props, hierarchy);
    }
    catch (Exception e)
    {
      if (((e instanceof InterruptedIOException)) || ((e instanceof InterruptedException))) {
        Thread.currentThread().interrupt();
      }
      LogLog.error("Could not read configuration file [" + configFileName + "].", e);
      LogLog.error("Ignoring configuration file [" + configFileName + "].");
    }
    finally
    {
      if (istream != null) {
        try
        {
          istream.close();
        }
        catch (InterruptedIOException ignore)
        {
          Thread.currentThread().interrupt();
        }
        catch (Throwable ignore) {}
      }
    }
  }
  
  public static void configure(String configFilename)
  {
    new PropertyConfigurator().doConfigure(configFilename, LogManager.getLoggerRepository());
  }
  
  public static void configure(URL configURL)
  {
    new PropertyConfigurator().doConfigure(configURL, LogManager.getLoggerRepository());
  }
  
  public static void configure(InputStream inputStream)
  {
    new PropertyConfigurator().doConfigure(inputStream, LogManager.getLoggerRepository());
  }
  
  public static void configure(Properties properties)
  {
    new PropertyConfigurator().doConfigure(properties, LogManager.getLoggerRepository());
  }
  
  public static void configureAndWatch(String configFilename)
  {
    configureAndWatch(configFilename, 60000L);
  }
  
  public static void configureAndWatch(String configFilename, long delay)
  {
    PropertyWatchdog pdog = new PropertyWatchdog(configFilename);
    pdog.setDelay(delay);
    pdog.start();
  }
  
  public void doConfigure(Properties properties, LoggerRepository hierarchy)
  {
    repository = hierarchy;
    String value = properties.getProperty("log4j.debug");
    if (value == null)
    {
      value = properties.getProperty("log4j.configDebug");
      if (value != null) {
        LogLog.warn("[log4j.configDebug] is deprecated. Use [log4j.debug] instead.");
      }
    }
    if (value != null) {
      LogLog.setInternalDebugging(OptionConverter.toBoolean(value, true));
    }
    String reset = properties.getProperty("log4j.reset");
    if ((reset != null) && (OptionConverter.toBoolean(reset, false))) {
      hierarchy.resetConfiguration();
    }
    String thresholdStr = OptionConverter.findAndSubst("log4j.threshold", properties);
    if (thresholdStr != null)
    {
      hierarchy.setThreshold(OptionConverter.toLevel(thresholdStr, Level.ALL));
      
      LogLog.debug("Hierarchy threshold set to [" + hierarchy.getThreshold() + "].");
    }
    configureRootCategory(properties, hierarchy);
    configureLoggerFactory(properties);
    parseCatsAndRenderers(properties, hierarchy);
    
    LogLog.debug("Finished configuring.");
    
    registry.clear();
  }
  
  public void doConfigure(InputStream inputStream, LoggerRepository hierarchy)
  {
    Properties props = new Properties();
    try
    {
      props.load(inputStream);
    }
    catch (IOException e)
    {
      if ((e instanceof InterruptedIOException)) {
        Thread.currentThread().interrupt();
      }
      LogLog.error("Could not read configuration file from InputStream [" + inputStream + "].", e);
      
      LogLog.error("Ignoring configuration InputStream [" + inputStream + "].");
      return;
    }
    doConfigure(props, hierarchy);
  }
  
  public void doConfigure(URL configURL, LoggerRepository hierarchy)
  {
    Properties props = new Properties();
    LogLog.debug("Reading configuration from URL " + configURL);
    InputStream istream = null;
    URLConnection uConn = null;
    try
    {
      uConn = configURL.openConnection();
      uConn.setUseCaches(false);
      istream = uConn.getInputStream();
      props.load(istream);
      if (istream != null) {
        try
        {
          istream.close();
        }
        catch (InterruptedIOException ignore)
        {
          Thread.currentThread().interrupt();
        }
        catch (IOException ignore) {}catch (RuntimeException ignore) {}
      }
      doConfigure(props, hierarchy);
    }
    catch (Exception e)
    {
      if (((e instanceof InterruptedIOException)) || ((e instanceof InterruptedException))) {
        Thread.currentThread().interrupt();
      }
      LogLog.error("Could not read configuration file from URL [" + configURL + "].", e);
      
      LogLog.error("Ignoring configuration file [" + configURL + "].");
    }
    finally
    {
      if (istream != null) {
        try
        {
          istream.close();
        }
        catch (InterruptedIOException ignore)
        {
          Thread.currentThread().interrupt();
        }
        catch (IOException ignore) {}catch (RuntimeException ignore) {}
      }
    }
  }
  
  protected void configureLoggerFactory(Properties props)
  {
    String factoryClassName = OptionConverter.findAndSubst("log4j.loggerFactory", props);
    if (factoryClassName != null)
    {
      LogLog.debug("Setting category factory to [" + factoryClassName + "].");
      loggerFactory = ((LoggerFactory)OptionConverter.instantiateByClassName(factoryClassName, LoggerFactory.class, loggerFactory));
      
      PropertySetter.setProperties(loggerFactory, props, "log4j.factory.");
    }
  }
  
  void configureRootCategory(Properties props, LoggerRepository hierarchy)
  {
    String effectiveFrefix = "log4j.rootLogger";
    String value = OptionConverter.findAndSubst("log4j.rootLogger", props);
    if (value == null)
    {
      value = OptionConverter.findAndSubst("log4j.rootCategory", props);
      effectiveFrefix = "log4j.rootCategory";
    }
    if (value == null)
    {
      LogLog.debug("Could not find root logger information. Is this OK?");
    }
    else
    {
      Logger root = hierarchy.getRootLogger();
      synchronized (root)
      {
        parseCategory(props, root, effectiveFrefix, "root", value);
      }
    }
  }
  
  protected void parseCatsAndRenderers(Properties props, LoggerRepository hierarchy)
  {
    Enumeration enumeration = props.propertyNames();
    while (enumeration.hasMoreElements())
    {
      String key = (String)enumeration.nextElement();
      if ((key.startsWith("log4j.category.")) || (key.startsWith("log4j.logger.")))
      {
        String loggerName = null;
        if (key.startsWith("log4j.category.")) {
          loggerName = key.substring("log4j.category.".length());
        } else if (key.startsWith("log4j.logger.")) {
          loggerName = key.substring("log4j.logger.".length());
        }
        String value = OptionConverter.findAndSubst(key, props);
        Logger logger = hierarchy.getLogger(loggerName, loggerFactory);
        synchronized (logger)
        {
          parseCategory(props, logger, key, loggerName, value);
          parseAdditivityForLogger(props, logger, loggerName);
        }
      }
      else if (key.startsWith("log4j.renderer."))
      {
        String renderedClass = key.substring("log4j.renderer.".length());
        String renderingClass = OptionConverter.findAndSubst(key, props);
        if ((hierarchy instanceof RendererSupport)) {
          RendererMap.addRenderer((RendererSupport)hierarchy, renderedClass, renderingClass);
        }
      }
      else if ((key.equals("log4j.throwableRenderer")) && 
        ((hierarchy instanceof ThrowableRendererSupport)))
      {
        ThrowableRenderer tr = (ThrowableRenderer)OptionConverter.instantiateByKey(props, "log4j.throwableRenderer", ThrowableRenderer.class, null);
        if (tr == null)
        {
          LogLog.error("Could not instantiate throwableRenderer.");
        }
        else
        {
          PropertySetter setter = new PropertySetter(tr);
          setter.setProperties(props, "log4j.throwableRenderer.");
          ((ThrowableRendererSupport)hierarchy).setThrowableRenderer(tr);
        }
      }
    }
  }
  
  void parseAdditivityForLogger(Properties props, Logger cat, String loggerName)
  {
    String value = OptionConverter.findAndSubst("log4j.additivity." + loggerName, props);
    
    LogLog.debug("Handling log4j.additivity." + loggerName + "=[" + value + "]");
    if ((value != null) && (!value.equals("")))
    {
      boolean additivity = OptionConverter.toBoolean(value, true);
      LogLog.debug("Setting additivity for \"" + loggerName + "\" to " + additivity);
      
      cat.setAdditivity(additivity);
    }
  }
  
  void parseCategory(Properties props, Logger logger, String optionKey, String loggerName, String value)
  {
    LogLog.debug("Parsing for [" + loggerName + "] with value=[" + value + "].");
    
    StringTokenizer st = new StringTokenizer(value, ",");
    if ((!value.startsWith(",")) && (!value.equals("")))
    {
      if (!st.hasMoreTokens()) {
        return;
      }
      String levelStr = st.nextToken();
      LogLog.debug("Level token is [" + levelStr + "].");
      if (("inherited".equalsIgnoreCase(levelStr)) || ("null".equalsIgnoreCase(levelStr)))
      {
        if (loggerName.equals("root")) {
          LogLog.warn("The root logger cannot be set to null.");
        } else {
          logger.setLevel(null);
        }
      }
      else {
        logger.setLevel(OptionConverter.toLevel(levelStr, Level.DEBUG));
      }
      LogLog.debug("Category " + loggerName + " set to " + logger.getLevel());
    }
    logger.removeAllAppenders();
    while (st.hasMoreTokens())
    {
      String appenderName = st.nextToken().trim();
      if ((appenderName != null) && (!appenderName.equals(",")))
      {
        LogLog.debug("Parsing appender named \"" + appenderName + "\".");
        Appender appender = parseAppender(props, appenderName);
        if (appender != null) {
          logger.addAppender(appender);
        }
      }
    }
  }
  
  Appender parseAppender(Properties props, String appenderName)
  {
    Appender appender = registryGet(appenderName);
    if (appender != null)
    {
      LogLog.debug("Appender \"" + appenderName + "\" was already parsed.");
      return appender;
    }
    String prefix = "log4j.appender." + appenderName;
    String layoutPrefix = prefix + ".layout";
    
    appender = (Appender)OptionConverter.instantiateByKey(props, prefix, Appender.class, null);
    if (appender == null)
    {
      LogLog.error("Could not instantiate appender named \"" + appenderName + "\".");
      
      return null;
    }
    appender.setName(appenderName);
    if ((appender instanceof OptionHandler))
    {
      if (appender.requiresLayout())
      {
        Layout layout = (Layout)OptionConverter.instantiateByKey(props, layoutPrefix, Layout.class, null);
        if (layout != null)
        {
          appender.setLayout(layout);
          LogLog.debug("Parsing layout options for \"" + appenderName + "\".");
          
          PropertySetter.setProperties(layout, props, layoutPrefix + ".");
          LogLog.debug("End of parsing for \"" + appenderName + "\".");
        }
      }
      String errorHandlerPrefix = prefix + ".errorhandler";
      String errorHandlerClass = OptionConverter.findAndSubst(errorHandlerPrefix, props);
      if (errorHandlerClass != null)
      {
        ErrorHandler eh = (ErrorHandler)OptionConverter.instantiateByKey(props, errorHandlerPrefix, ErrorHandler.class, null);
        if (eh != null)
        {
          appender.setErrorHandler(eh);
          LogLog.debug("Parsing errorhandler options for \"" + appenderName + "\".");
          parseErrorHandler(eh, errorHandlerPrefix, props, repository);
          Properties edited = new Properties();
          String[] keys = { errorHandlerPrefix + "." + "root-ref", errorHandlerPrefix + "." + "logger-ref", errorHandlerPrefix + "." + "appender-ref" };
          for (Iterator iter = props.entrySet().iterator(); iter.hasNext();)
          {
            Map.Entry entry = (Map.Entry)iter.next();
            for (int i = 0; i < keys.length; i++) {
              if (keys[i].equals(entry.getKey())) {
                break;
              }
            }
            if (i == keys.length) {
              edited.put(entry.getKey(), entry.getValue());
            }
          }
          PropertySetter.setProperties(eh, edited, errorHandlerPrefix + ".");
          LogLog.debug("End of errorhandler parsing for \"" + appenderName + "\".");
        }
      }
      PropertySetter.setProperties(appender, props, prefix + ".");
      LogLog.debug("Parsed \"" + appenderName + "\" options.");
    }
    parseAppenderFilters(props, appenderName, appender);
    registryPut(appender);
    return appender;
  }
  
  private void parseErrorHandler(ErrorHandler eh, String errorHandlerPrefix, Properties props, LoggerRepository hierarchy)
  {
    boolean rootRef = OptionConverter.toBoolean(OptionConverter.findAndSubst(errorHandlerPrefix + "root-ref", props), false);
    if (rootRef) {
      eh.setLogger(hierarchy.getRootLogger());
    }
    String loggerName = OptionConverter.findAndSubst(errorHandlerPrefix + "logger-ref", props);
    if (loggerName != null)
    {
      Logger logger = loggerFactory == null ? hierarchy.getLogger(loggerName) : hierarchy.getLogger(loggerName, loggerFactory);
      
      eh.setLogger(logger);
    }
    String appenderName = OptionConverter.findAndSubst(errorHandlerPrefix + "appender-ref", props);
    if (appenderName != null)
    {
      Appender backup = parseAppender(props, appenderName);
      if (backup != null) {
        eh.setBackupAppender(backup);
      }
    }
  }
  
  void parseAppenderFilters(Properties props, String appenderName, Appender appender)
  {
    String filterPrefix = "log4j.appender." + appenderName + ".filter.";
    int fIdx = filterPrefix.length();
    Hashtable filters = new Hashtable();
    Enumeration e = props.keys();
    String name = "";
    while (e.hasMoreElements())
    {
      String key = (String)e.nextElement();
      if (key.startsWith(filterPrefix))
      {
        int dotIdx = key.indexOf('.', fIdx);
        String filterKey = key;
        if (dotIdx != -1)
        {
          filterKey = key.substring(0, dotIdx);
          name = key.substring(dotIdx + 1);
        }
        Vector filterOpts = (Vector)filters.get(filterKey);
        if (filterOpts == null)
        {
          filterOpts = new Vector();
          filters.put(filterKey, filterOpts);
        }
        if (dotIdx != -1)
        {
          String value = OptionConverter.findAndSubst(key, props);
          filterOpts.add(new NameValue(name, value));
        }
      }
    }
    Enumeration g = new SortedKeyEnumeration(filters);
    while (g.hasMoreElements())
    {
      String key = (String)g.nextElement();
      String clazz = props.getProperty(key);
      if (clazz != null)
      {
        LogLog.debug("Filter key: [" + key + "] class: [" + props.getProperty(key) + "] props: " + filters.get(key));
        Filter filter = (Filter)OptionConverter.instantiateByClassName(clazz, Filter.class, null);
        if (filter != null)
        {
          PropertySetter propSetter = new PropertySetter(filter);
          Vector v = (Vector)filters.get(key);
          Enumeration filterProps = v.elements();
          while (filterProps.hasMoreElements())
          {
            NameValue kv = (NameValue)filterProps.nextElement();
            propSetter.setProperty(key, value);
          }
          propSetter.activate();
          LogLog.debug("Adding filter of type [" + filter.getClass() + "] to appender named [" + appender.getName() + "].");
          
          appender.addFilter(filter);
        }
      }
      else
      {
        LogLog.warn("Missing class definition for filter: [" + key + "]");
      }
    }
  }
  
  void registryPut(Appender appender)
  {
    registry.put(appender.getName(), appender);
  }
  
  Appender registryGet(String name)
  {
    return (Appender)registry.get(name);
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.PropertyConfigurator
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

import org.apache.log4j.helpers.FileWatchdog;

class PropertyWatchdog
  extends FileWatchdog
{
  PropertyWatchdog(String filename)
  {
    super(filename);
  }
  
  public void doOnChange()
  {
    new PropertyConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.PropertyWatchdog
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

import java.util.Vector;

class ProvisionNode
  extends Vector
{
  private static final long serialVersionUID = -4479121426311014469L;
  
  ProvisionNode(Logger logger)
  {
    addElement(logger);
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.ProvisionNode
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;

class RollingCalendar
  extends GregorianCalendar
{
  private static final long serialVersionUID = -3560331770601814177L;
  int type = -1;
  
  RollingCalendar() {}
  
  RollingCalendar(TimeZone tz, Locale locale)
  {
    super(tz, locale);
  }
  
  void setType(int type)
  {
    this.type = type;
  }
  
  public long getNextCheckMillis(Date now)
  {
    return getNextCheckDate(now).getTime();
  }
  
  public Date getNextCheckDate(Date now)
  {
    setTime(now);
    switch (type)
    {
    case 0: 
      set(13, 0);
      set(14, 0);
      add(12, 1);
      break;
    case 1: 
      set(12, 0);
      set(13, 0);
      set(14, 0);
      add(11, 1);
      break;
    case 2: 
      set(12, 0);
      set(13, 0);
      set(14, 0);
      int hour = get(11);
      if (hour < 12)
      {
        set(11, 12);
      }
      else
      {
        set(11, 0);
        add(5, 1);
      }
      break;
    case 3: 
      set(11, 0);
      set(12, 0);
      set(13, 0);
      set(14, 0);
      add(5, 1);
      break;
    case 4: 
      set(7, getFirstDayOfWeek());
      set(11, 0);
      set(12, 0);
      set(13, 0);
      set(14, 0);
      add(3, 1);
      break;
    case 5: 
      set(5, 1);
      set(11, 0);
      set(12, 0);
      set(13, 0);
      set(14, 0);
      add(2, 1);
      break;
    default: 
      throw new IllegalStateException("Unknown periodicity type.");
    }
    return getTime();
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.RollingCalendar
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

import java.io.File;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.io.Writer;
import org.apache.log4j.helpers.CountingQuietWriter;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.helpers.OptionConverter;
import org.apache.log4j.spi.LoggingEvent;

public class RollingFileAppender
  extends FileAppender
{
  protected long maxFileSize = 10485760L;
  protected int maxBackupIndex = 1;
  private long nextRollover = 0L;
  
  public RollingFileAppender() {}
  
  public RollingFileAppender(Layout layout, String filename, boolean append)
    throws IOException
  {
    super(layout, filename, append);
  }
  
  public RollingFileAppender(Layout layout, String filename)
    throws IOException
  {
    super(layout, filename);
  }
  
  public int getMaxBackupIndex()
  {
    return maxBackupIndex;
  }
  
  public long getMaximumFileSize()
  {
    return maxFileSize;
  }
  
  public void rollOver()
  {
    if (qw != null)
    {
      long size = ((CountingQuietWriter)qw).getCount();
      LogLog.debug("rolling over count=" + size);
      
      nextRollover = (size + maxFileSize);
    }
    LogLog.debug("maxBackupIndex=" + maxBackupIndex);
    
    boolean renameSucceeded = true;
    if (maxBackupIndex > 0)
    {
      File file = new File(fileName + '.' + maxBackupIndex);
      if (file.exists()) {
        renameSucceeded = file.delete();
      }
      for (int i = maxBackupIndex - 1; (i >= 1) && (renameSucceeded); i--)
      {
        file = new File(fileName + "." + i);
        if (file.exists())
        {
          File target = new File(fileName + '.' + (i + 1));
          LogLog.debug("Renaming file " + file + " to " + target);
          renameSucceeded = file.renameTo(target);
        }
      
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd