Gets the {@link LoggerContext} associated with the given caller class.

@param callerClass the caller class
@return the LoggerContext for the calling class
161596
protected LoggerContext getContext(final Class<?> callerClass) {
        ClassLoader cl = null;
        if (callerClass != null) {
            cl = callerClass.getClassLoader();
        }
        if (cl == null) {
            cl = LoaderUtil.getThreadContextClassLoader();
        }
        return LogManager.getContext(cl, false);
    }
1114366
@Pure
	public static Object getContextResolver() throws AndroidException {
		Object resolver;
		synchronized (Android.class) {
			resolver = (contextResolver == null) ? null : contextResolver.get();
		}
		if (resolver == null) {
			final Object context = getContext();
			try {
				final Class<?> resolverType = getContextResolverClass();
				final Class<?> contextType = context.getClass();
				final Method getContextResolverMethod = contextType.getMethod("getContentResolver"); //$NON-NLS-1$
				resolver = getContextResolverMethod.invoke(context);
				resolver = resolverType.cast(resolver);
				synchronized (Android.class) {
					contextResolver = new WeakReference<>(resolver);
				}
			} catch (AssertionError e) {
				throw e;
			} catch (Throwable e) {
				throw new AndroidException(e);
			}
		}
		return resolver;
	}
563288
public static ClassLoader getContextClassLoader() {
        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
            @Override
            public ClassLoader run() {
                ClassLoader cl = null;
                try {
                    cl = Thread.currentThread().getContextClassLoader();
                } catch (final SecurityException ex) {
                    // fall through
                }
                return cl;
            }
        });
    }
1364973
private static ContextProvider createContextProvider(final Collection<LoggingProvider> loggingProviders) {
		Collection<ContextProvider> contextProviders = new ArrayList<ContextProvider>(loggingProviders.size());
		for (LoggingProvider loggingProvider : loggingProviders) {
			contextProviders.add(loggingProvider.getContextProvider());
		}
		return new BundleContextProvider(contextProviders);
	}
720609
public static ApplicationContext get() {
        ClassLoader classLoader = getContextClassLoader();
        while (classLoader != null) {
            ApplicationContext applicationContext = contextMap.get(classLoader);
            if (applicationContext != null) {
                return applicationContext;
            }
            classLoader = classLoader.getParent();
        }
        return null;
    }
650395
@SuppressWarnings("resource")
    public static List<Logger> getAllLoggers() {

        LoggerContext context = (LoggerContext)(LogManager.getContext(false));
        Map<String, Logger> loggersByName = new TreeMap<String, Logger>();
        for (Logger logger : context.getLoggers()) {
            String loggerName = logger.getName();
            while (loggerName != null) {
                if (!loggersByName.containsKey(loggerName)) {
                    Logger currentLogger = (Logger)(LogManager.getLogger(loggerName));
                    loggersByName.put(loggerName, currentLogger);
                }
                loggerName = getParentLoggerName(loggerName);

            }
        }
        return new ArrayList<Logger>(loggersByName.values());

    }
103606
public static <T extends Credential> T getCredential(final RequestContext context, final @NonNull Class<T> clazz) {
        val credential = getCredential(context);
        if (credential == null) {
            return null;
        }
        if (!clazz.isAssignableFrom(credential.getClass())) {
            throw new ClassCastException("credential [" + credential.getId()
                + " is of type " + credential.getClass()
                + " when we were expecting " + clazz);
        }
        return (T) credential;
    }
283677
public static synchronized AbstractApplicationContext getContext(Class<?> springConfigurationClass) {
        if (!CONTEXTS.containsKey(springConfigurationClass)) {
            AbstractApplicationContext context = new AnnotationConfigApplicationContext(springConfigurationClass);
            context.registerShutdownHook();
            CONTEXTS.put(springConfigurationClass, context);
        }

        return CONTEXTS.get(springConfigurationClass);
    }
704285
public static Context getContext()
    {
        if (ctx == null)
        {
            try
            {
                setContext(null);
            }
            catch (Exception e)
            {
                log.error("Cannot instantiate the InitialContext", e);
                throw new OJBRuntimeException(e);
            }
        }
        return ctx;
    }
871169
private static Class<?>[] getCallStackViaSecurityManager(final LogNode log) {
        try {
            return new CallerResolver().getClassContext();
        } catch (final SecurityException e) {
            // Creating a SecurityManager can fail if the current SecurityManager does not allow
            // RuntimePermission("createSecurityManager")
            if (log != null) {
                log.log("Exception while trying to obtain call stack via SecurityManager", e);
            }
            return null;
        }
    }
425085
public static MjdbcLogger getLogger(Class clazz) {
        MjdbcLogger mjdbcLogger = new MjdbcLogger(clazz.getName(), null);

        if (isSLF4jAvailable() == true) {
            try {
                mjdbcLogger = new MjdbcLogger(clazz.getName(), null);
                mjdbcLogger.setSlfLogger(MappingUtils.invokeStaticFunction(Class.forName("org.slf4j.LoggerFactory"), "getLogger", new Class[]{Class.class}, new Object[]{clazz}));
            } catch (MjdbcException e) {
                setSLF4jAvailable(false);
            } catch (ClassNotFoundException e) {
                setSLF4jAvailable(false);
            }
        }

        return mjdbcLogger;
    }
1354092
public static Logger getLogger(final String logger)
   {
      LogAdapterFactory adapterFactory = getAdapterFactory();
      return adapterFactory.createLogAdapter(logger);
   }
1057365
public static FluentLogger forEnclosingClass() {
    // NOTE: It is _vital_ that the call to "caller finder" is made directly inside the static
    // factory method. See getCallerFinder() for more information.
    String loggingClass = Platform.getCallerFinder().findLoggingClass(FluentLogger.class);
    return new FluentLogger(Platform.getBackend(loggingClass));
  }
82827
public static Class<?> getCallingClass() {
        ClassContextSecurityManager securityManager = getSecurityManager();
        if (securityManager == null)
            return null;
        Class<?>[] trace = securityManager.getClassContext();
        String thisClassName = Util.class.getName();

        // Advance until Util is found
        int i;
        for (i = 0; i < trace.length; i++) {
            if (thisClassName.equals(trace[i].getName()))
                break;
        }

        // trace[i] = Util; trace[i+1] = caller; trace[i+2] = caller's caller
        if (i >= trace.length || i + 2 >= trace.length) {
            throw new IllegalStateException("Failed to find org.slf4j.helpers.Util or its caller in the stack; " + "this should not happen");
        }

        return trace[i + 2];
    }
280205
JCAContextProvider getJCAContextProvider(Class<?> workContextClass) {
        JCAContextProvider provider = null;
        for (Class<?> cl = workContextClass; provider == null && cl != null; cl = cl.getSuperclass())
            provider = contextProviders.getService(cl.getName());

        return provider;
    }
154590
public Logger getLogger(Class<?> clazz) {
      if (clazz == null) {
         return getGlobalLogger();
      }
      return getLogger(clazz.getName());
   }
1332128
@Override
    public <T> T getContext(Class<T> type) {
        for (Context context : contexts) {
            if (type.isInstance(context)) {
                return type.cast(context);
            }
        }
        return null;
    }