Get a Logger with an associated resource bundle.

@param cls the Class to contain the Logger
@param resourcename the resource name
@return an appropriate Logger
496617
public static Logger getLogger(Class<?> cls, String resourcename) {
        //Liberty Change for CXF Begin
        return createLogger(cls, resourcename, cls.getName() + cls.getClassLoader());
        //Liberty Change for CXF End
    }
1262072
public static Logger getLogger(String name) {
    if (name == null) {
      throw new NullPointerException("Logger name may not be null.");
    }
    init();
    return (instance.internalGetLogger(name));
  }
323989
public static <T> Class<T> classForName(ResourceLoader resourceLoader, String className) {
        try {
            return cast(resourceLoader.classForName(className));
        } catch (Exception e) {
            CommonLogger.LOG.cannotLoadClassUsingResourceLoader(className);
            CommonLogger.LOG.catchingTrace(e);
        }
        try {
            return cast(Class.forName(className));
        } catch (Exception | LinkageError e) {
            throw CommonLogger.LOG.cannotLoadClass(className, e);
        }
    }
1296735
private Class<?> getClassFromBundle(Object resource, String className, String versionRange)
    {
        Class<?> c = null;
        if (resource == null)
        {
            Object classAccess = this.getClassBundleService(null, className, versionRange, null, 0);
            if (classAccess != null)
            {
            	try {
                	c = Class.forName(className);
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                }
            }
        }
        else
        {
        	Bundle bundle = this.findBundle(resource, bundleContext, ClassFinderActivator.getPackageName(className, false), versionRange);
        	try {
	            c = bundle.loadClass(className);
            } catch (ClassNotFoundException e) {
                c = null;
            }
        }
        return c;
    }
347474
def getLogger(cls):
        
        # Only do the setup once, so we don't add a handler every time we log. Use a lock to do
        # so safely even if we're being called in different threads. Use double-checked locking
        # to reduce the overhead introduced by the lock.
        if cls.logger is None:
            with cls.lock:
                if cls.logger is None:
                    cls.logger = logging.getLogger('toil-rt')
                    try:
                        level = os.environ[cls.envPrefix + 'LEVEL']
                    except KeyError:
                        # There is no server running on the leader, so suppress most log messages
                        # and skip the UDP stuff.
                        cls.logger.setLevel(logging.CRITICAL)
                    else:
                        # Adopt the logging level set on the leader.
                        toil.lib.bioio.setLogLevel(level, cls.logger)
                        try:
                            address = os.environ[cls.envPrefix + 'ADDRESS']
                        except KeyError:
                            pass
                        else:
                            # We know where to send messages to, so send them.
                            host, port = address.split(':')
                            cls.logger.addHandler(JSONDatagramHandler(host, int(port)))
        return cls.logger
261454
def getLogger(cls, name=None):
        
        return logging.getLogger("{0}.{1}".format(cls.BASENAME, name) if name else cls.BASENAME)
686001
private Logger internalGetLogger(String name) {
    assert name != null : "Name was null";
    Logger rv = instances.get(name);

    if (rv == null) {
      Logger newLogger = null;
      try {
        newLogger = getNewInstance(name);
      } catch (Exception e) {
        throw new RuntimeException("Problem getting logger", e);
      }
      Logger tmp = instances.putIfAbsent(name, newLogger);
      // Return either the new logger we've just made, or one that was
      // created while we were waiting
      rv = tmp == null ? newLogger : tmp;
    }

    return (rv);
  }
693712
private static @CheckForNull ResourceBundle getBundle(@Nonnull String baseName, @Nonnull Locale locale, @Nonnull ClassLoader classLoader) {
        try {
            return ResourceBundle.getBundle(baseName, locale, classLoader);
        } catch (MissingResourceException e) {
            // fall through and return null.
            logger.finer(e.getMessage());
        }
        return null;
    }
271672
public static ResourceBundle getBaseResourceBundle(Class<?> aClass, String aBundleName) {

        ResourceBundle bundle = null;
        final Class<?> clazz = aClass;
        final String bundleName = aBundleName;

        // Need a special classloader trick to load the ENGLISH messages (from the base bundle).
        // See BaseResourceBundleClassLoader for more info.
        ClassLoader cl = AccessController.doPrivileged(
                        new PrivilegedAction<ClassLoader>() {
                            public ClassLoader run() {
                                return new TraceNLSBundleClassLoader(clazz.getClassLoader(), bundleName);
                            }
                        });

        bundle = ResourceBundle.getBundle(bundleName, Locale.ENGLISH, cl);
        return bundle;

    }
515976
public static Logger getInstance(Class loggerClient) {
        return new Logger(org.apache.commons.logging.LogFactory.getLog(loggerClient.getName()));
    }
154590
public Logger getLogger(Class<?> clazz) {
      if (clazz == null) {
         return getGlobalLogger();
      }
      return getLogger(clazz.getName());
   }
497431
private Logger getLogger()
    {
        if ( logger != null )
        {
            return logger;
        }

        logger = LoggerFactory.getLogger( ResourceReaderImpl.class );

        return logger;
    }
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;
    }
54767
public static <T, E extends I18nId> SLF4JLogger<T, ?, E> getLogger(Class<T> clazz, Class<?> caller) {
		org.slf4j.Logger logger = LoggerFactory.getLogger(clazz);
		if(logger instanceof LocationAwareLogger) {
			return new SLF4JCallerLocationAwareLogger<T, E>((LocationAwareLogger)logger, caller);
		} else {
			return new SLF4JLogger<T, org.slf4j.Logger, E>(logger);
		}
	}
1011919
public static Logger getL7dLogger(Class<?> cls) {
        //Liberty Change for CXF Begin
        return createLogger(cls, null, cls.getName() + getClassLoader(cls));
        //Liberty Change for CXF End
    }
863362
public ResourceBundle getResourceBundle(String baseName) {
//    System.out.println(this + " " + this.locale+" ("+resourceBundles.size()+")");
    ResourceBundle bundle = (ResourceBundle) resourceBundles.get(baseName);
    if(null == bundle) {
      resourceBundles.put(baseName, bundle = findBundle(baseName));
    }
    return bundle;
  }
817264
private ResourceBundle getResourceBundle() {
		ResourceBundle rb = null;

		/*
		 * make sure we have a valid bundle name
		 */
		if (null != ivBundleName && !"".equals(ivBundleName.trim())) {
			ClassLoader classLoader = null;

			/*
			 * get the context classloader to lookup bundle
			 */
			try {
                classLoader = AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>() {
					public ClassLoader run() throws Exception {
						return Thread.currentThread().getContextClassLoader();
					}
				});
			} catch (PrivilegedActionException e) {
				// convert to a runtime exception since callers already have
				// to deal
				// with that type
				throw new java.lang.RuntimeException(e.getMessage());
			}

			/*
			 * if there is a context classloader
			 * OPTION 1 - look in context classloader
			 */
			if (null != classLoader) {

				try {
					rb = ResourceBundle.getBundle(ivBundleName, ivLocale, classLoader);

				} catch (MissingResourceException e) {
					// if (quiet) {
					//
					// logger.log(Level.FINEST,
					// "Cannot find resource bundle {0} for locale {1} in Thread context loader, will try system class loader",
					// new Object[] { ivBundleName, ivLocale.toString() });
					// }
				}
			}

			/*
			 * OPTION 2: Climb up the stack and get class that loaded the class
			 *            Use this classloader to get bundle. This helps with OSGI bundle
			 */
			if(null == rb) {
				// if (quiet) {
				//
				// logger.log(Level.FINEST,
				// "Cannot find resource bundle {0} for locale {1} in System Class loader, will try callee classloader",
				// new Object[] { ivBundleName, ivLocale.toString() });
				rb = locateBundleFromCallee();
				// }

			}

			/*
			 * OPTION 3: Look in system classloader
			 */
			if (null == rb) {
				try {
					rb = ResourceBundle.getBundle(ivBundleName, ivLocale);
				} catch (MissingResourceException e2) {
					/*
					 * left empty on purpose, since we cannot log
					 */
				}
			}
			

		}
		return rb;
	}