Loads the native library if not loaded before.

@param   logger
The logger
439515
public static void loadNativeLibrary(Logger logger)
    {
        synchronized(WindowsFaxClientSpiHelper.NATIVE_LOCK)
        {
            if(!WindowsFaxClientSpiHelper.nativeLibraryLoaded)
            {
                try
                {
                    //get temporary directory
                    File directory=IOHelper.getFax4jInternalTemporaryDirectory();

                    //get dll path
                    File dllFile=new File(directory,"fax4j.dll");

                    //get path
                    String path=dllFile.getPath();

                    //load native library
                    System.load(path);
                    logger.logDebug(new Object[]{"Loaded native library runtime path."},null);
                    
                    //set flag
                    WindowsFaxClientSpiHelper.nativeLibraryLoaded=true;
                }
                catch(Throwable throwable)
                {
                    logger.logError(new Object[]{"Error while loading native library from runtime path."},throwable);
                }

                if(!WindowsFaxClientSpiHelper.nativeLibraryLoaded)
                {
                    try
                    {
                        //load native library
                        System.loadLibrary("fax4j");
                        logger.logDebug(new Object[]{"Loaded native library from native path."},null);
                        
                        //set flag
                        WindowsFaxClientSpiHelper.nativeLibraryLoaded=true;
                    }
                    catch(Throwable throwable)
                    {
                        logger.logError(new Object[]{"Error while loading native library from native path."},throwable);
                    }
                }
            }
        }
    }
171622
public static void logException( Logger logger, Throwable t ) {
		logException( logger, Level.FINEST, t );
	}
745504
public void log(Logger targetLogger)
    {
        Object[] argumentArray = getArgumentArray();
        if (getArgumentArray() == null) {
            log(targetLogger, getLevel(), getMarker(), getMessage(), getThrowable());
        } else {
            if (getThrowable() != null) {
                argumentArray = ArrayUtils.add(getArgumentArray(), getThrowable());
            }

            log(targetLogger, getLevel(), getMarker(), getMessage(), argumentArray);
        }
    }
517572
public void add(final ClassLoader classLoader) {
        if (classLoader == null) {
            return;
        }
        if (added.add(classLoader)) {
            final ClassLoaderHandlerRegistryEntry entry = getRegistryEntry(classLoader);
            if (entry != null) {
                classLoaderOrder.add(new SimpleEntry<>(classLoader, entry));
            }
        }
    }
1354092
public static Logger getLogger(final String logger)
   {
      LogAdapterFactory adapterFactory = getAdapterFactory();
      return adapterFactory.createLogAdapter(logger);
   }
1047246
def install_logger(logger=None, module=None):
    

    logger = logging.getLogger(Constants.logger) if logger is None else logger
    if module is None:
        # Note: inspect.getmodule() can return the wrong module if it has been imported with different relatives paths.
        module = sys.modules.get(inspect.currentframe().f_back.f_globals["__name__"])
    setattr(module, "LOGGER", logger)

    foundations.trace.register_module(module)

    return logger
868295
public void setClassLoader(GroovyClassLoader loader) {
        ClassLoader parent = Thread.currentThread().getContextClassLoader();
        if (parent == null) parent = ProcessingUnit.class.getClassLoader();
        this.classLoader = (loader == null ? new GroovyClassLoader(parent, configuration) : loader);
    }
719936
private static void loadVisitorHandlers(HandlerLibrary lib, Trees trees) throws IOException {
		//No, that seemingly superfluous reference to JavacASTVisitor's classloader is not in fact superfluous!
		for (JavacASTVisitor visitor : SpiLoadUtil.findServices(JavacASTVisitor.class, JavacASTVisitor.class.getClassLoader())) {
			visitor.setTrees(trees);
			lib.visitorHandlers.add(new VisitorContainer(visitor));
		}
	}
691005
static void loadLibrary0(String pLibrary, String pResource, ClassLoader pLoader) {
        if (pLibrary == null) {
            throw new IllegalArgumentException("library == null");
        }

        // Try loading normal way
        UnsatisfiedLinkError unsatisfied;
        try {
            System.loadLibrary(pLibrary);
            return;
        }
        catch (UnsatisfiedLinkError err) {
            // Ignore
            unsatisfied = err;
        }

        final ClassLoader loader = pLoader != null ? pLoader : Thread.currentThread().getContextClassLoader();
        final String resource = pResource != null ? pResource : getResourceFor(pLibrary);

        // TODO: resource may be null, and that MIGHT be okay, IFF the resource
        // is allready unpacked to the user dir... However, we then need another
        // way to resolve the library extension...
        // Right now we just fail in a predictable way (no NPE)!
        if (resource == null) {
            throw unsatisfied;
        }

        // Default to load/store from user.home
        File dir = new File(System.getProperty("user.home") + "/.twelvemonkeys/lib");
        dir.mkdirs();
        //File libraryFile = new File(dir.getAbsolutePath(), pLibrary + LIBRARY_EXTENSION);
        File libraryFile = new File(dir.getAbsolutePath(), pLibrary + "." + FileUtil.getExtension(resource));

        if (!libraryFile.exists()) {
            try {
                extractToUserDir(resource, libraryFile, loader);
            }
            catch (IOException ioe) {
                UnsatisfiedLinkError err = new UnsatisfiedLinkError("Unable to extract resource to dir: " + libraryFile.getAbsolutePath());
                err.initCause(ioe);
                throw err;
            }
        }

        // Try to load the library from the file we just wrote
        System.load(libraryFile.getAbsolutePath());
    }
68316
private Throwable loadLib(String _lib) {
        try {
            System.load(_lib);
            return null;
        } catch (Throwable _ex) {
            return _ex;
        }
    }
1018243
private void resetLogger(Logger logger) {
        // Close all the Logger's handlers.
        Handler[] targets = logger.getHandlers();
        for (int i = 0; i < targets.length; i++) {
            Handler h = targets[i];
            logger.removeHandler(h);
            try {
                h.close();
            } catch (Exception ex) {
                // Problems closing a handler?  Keep going...
            }
        }
        String name = logger.getName();
        if (name != null && name.equals("")) {
            // This is the root logger.
            logger.setLevel(defaultLevel);
        } else {
            logger.setLevel(null);
        }
    }
771328
public void initialize(ClassLoader classLoader)
    {
        ComponentAnnotationLoader loader = new ComponentAnnotationLoader();
        loader.initialize(this, classLoader);

        // Extension point to allow component to manipulate ComponentManager initialized state.
        try {
            List<ComponentManagerInitializer> initializers = this.getInstanceList(ComponentManagerInitializer.class);
            for (ComponentManagerInitializer initializer : initializers) {
                initializer.initialize(this);
            }
        } catch (ComponentLookupException e) {
            // Should never happen
            this.logger.error("Failed to lookup ComponentManagerInitializer components", e);
        }
    }
1022621
@Nullable
  public boolean loadLibraries() {
    synchronized (mLock) {
      if (mLoadLibraries == false) {
        return mLibrariesLoaded;
      }
      try {
        if (mLibraryNames != null) {
          for (String name : mLibraryNames) {
            SoLoader.loadLibrary(name);
          }
        }
        initialNativeCheck();
        mLibrariesLoaded = true;
        mLibraryNames = null;
      } catch (UnsatisfiedLinkError error) {
        Log.e(TAG, "Failed to load native lib (initial check): ", error);
        mLinkError = error;
        mLibrariesLoaded = false;
      } catch (Throwable other) {
        Log.e(TAG, "Failed to load native lib (other error): ", other);
        mLinkError = new UnsatisfiedLinkError("Failed loading libraries");
        mLinkError.initCause(other);
        mLibrariesLoaded = false;
      }
      mLoadLibraries = false;
      return mLibrariesLoaded;
    }
  }
1058205
protected static void initialize(boolean load) {
		if (load && initialized.compareAndSet(false, true)) {
			boolean nativeFound = getNativeDiscovery().discover();
			if (!nativeFound) {
				throw new IllegalStateException("The libvlc native library has not been found");
			}
			// Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
		}
	}
1277619
public static synchronized void init(LogProviderConfig config) {
        if (config == null)
            throw new NullPointerException("LogProviderConfig must not be null");

        if (loggingConfig.get().compareAndSet(null, config)) {
            // Only initialize Tr once -- all subsequent changes go through update
            // The synchronization of this method is gratuitous (just makes us feel better), 
            // it is called while the system is single threaded at startup. 

            // config.getTrDelegate() must not return null -- it should either
            // return a dummy/disabled delegate, or throw an exception so that startup
            // does not proceed.
            final TrService tr = config.getTrDelegate();
            if (tr == null)
                throw new NullPointerException("LogProviderConfig must provide a TrService delegate");
            Callable<TrService> result = new Callable<TrService>() {
                @Override
                public TrService call() throws Exception {
                    return tr;
                }
            };
            delegate = StaticValue.mutateStaticValue(delegate, result);
            delegate.get().init(config);

            // Validate and propagate the initial trace specification 
            setTraceSpec(config.getTraceString());

            // Set class that we want the LogManager to instantiate when someone
            // calls getLogger: This logger interacts only with the Tr/FFDC API: 
            // it is not dependent on the implementation of the underlying delegate
            WsLogManager.setWsLogger(com.ibm.ws.logging.internal.WsLogger.class);
        }
    }
792855
protected void load()
    {
        Logger bootLogger = LoggerFactory.getBootLogger();

        // first we check whether the system property
        //   org.apache.ojb.broker.util.logging.Logger
        // is set (or its alias LoggerClass which is deprecated)
        ClassLoader contextLoader   = ClassHelper.getClassLoader();
        String      loggerClassName;

        _loggerClass      = null;
        properties        = new Properties();
        loggerClassName   = getLoggerClass(System.getProperties());
        _loggerConfigFile = getLoggerConfigFile(System.getProperties());

        InputStream ojbLogPropFile;
        if (loggerClassName == null)
        {
            // now we're trying to load the OJB-logging.properties file
            String ojbLogPropFilePath = System.getProperty(OJB_LOGGING_PROPERTIES_FILE, OJB_LOGGING_PROPERTIES_FILE);
            try
            {
                URL ojbLoggingURL = ClassHelper.getResource(ojbLogPropFilePath);
                if (ojbLoggingURL == null)
                {
                    ojbLoggingURL = (new File(ojbLogPropFilePath)).toURL();
                }
                ojbLogPropFile = ojbLoggingURL.openStream();
                try
                {
                    bootLogger.info("Found logging properties file: " + ojbLogPropFilePath);
                    properties.load(ojbLogPropFile);
                    _loggerConfigFile = getLoggerConfigFile(properties);
                    loggerClassName = getLoggerClass(properties);
                }
                finally
                {
                    ojbLogPropFile.close();
                }
            }
            catch (Exception ex)
            {
                if(loggerClassName == null)
                {
                    bootLogger.warn("Can't read logging properties file using path '" + ojbLogPropFilePath
                            + "', message is: " + SystemUtils.LINE_SEPARATOR + ex.getMessage()
                            + SystemUtils.LINE_SEPARATOR + "Will try to load logging properties from OJB.properties file");
                }
                else
                {
                    bootLogger.info("Problems while closing resources for path '" + ojbLogPropFilePath
                            + "', message is: " + SystemUtils.LINE_SEPARATOR + ex.getMessage(), ex);
                }
            }
        }
        if (loggerClassName == null)
        {
            // deprecated: load the OJB.properties file
            // this is not good because we have all OJB properties in this config
            String ojbPropFile = System.getProperty("OJB.properties", "OJB.properties");

            try
            {
                ojbLogPropFile = contextLoader.getResourceAsStream(ojbPropFile);
                if (ojbLogPropFile != null)
                {
                    try
                    {
                        properties.load(ojbLogPropFile);
                        loggerClassName   = getLoggerClass(properties);
                        _loggerConfigFile = getLoggerConfigFile(properties);
                        if (loggerClassName != null)
                        {
                            // deprecation warning for after 1.0
                            bootLogger.warn("Please use a separate '"+OJB_LOGGING_PROPERTIES_FILE+"' file to specify your logging settings");
                        }
                    }
                    finally
                    {
                        ojbLogPropFile.close();
                    }
                }
            }
            catch (Exception ex)
            {}
        }
        if (loggerClassName != null)
        {
            try
            {
                _loggerClass = ClassHelper.getClass(loggerClassName);
                bootLogger.info("Logging: Found logger class '" + loggerClassName);
            }
            catch (ClassNotFoundException ex)
            {
                _loggerClass = PoorMansLoggerImpl.class;
                bootLogger.warn("Could not load logger class "+loggerClassName+", defaulting to "+_loggerClass.getName(), ex);
            }
        }
        else
        {
            // still no logger configured - lets check whether commons-logging is configured
            if ((System.getProperty(PROPERTY_COMMONS_LOGGING_LOG) != null) ||
                (System.getProperty(PROPERTY_COMMONS_LOGGING_LOGFACTORY) != null))
            {
                // yep, so use commons-logging
                _loggerClass = CommonsLoggerImpl.class;
                bootLogger.info("Logging: Found commons logging properties, use " + _loggerClass);
            }
            else
            {
                // but perhaps there is a log4j.properties file ?
                try
                {
                    ojbLogPropFile = contextLoader.getResourceAsStream("log4j.properties");
                    if (ojbLogPropFile != null)
                    {
                        // yep, so use log4j
                        _loggerClass      = Log4jLoggerImpl.class;
                        _loggerConfigFile = "log4j.properties";
                        bootLogger.info("Logging: Found 'log4j.properties' file, use " + _loggerClass);
                        ojbLogPropFile.close();
                    }
                }
                catch (Exception ex)
                {}
                if (_loggerClass == null)
                {
                    // or a commons-logging.properties file ?
                    try
                    {
                        ojbLogPropFile = contextLoader.getResourceAsStream("commons-logging.properties");
                        if (ojbLogPropFile != null)
                        {
                            // yep, so use commons-logging
                            _loggerClass      = CommonsLoggerImpl.class;
                            _loggerConfigFile = "commons-logging.properties";
                            bootLogger.info("Logging: Found 'commons-logging.properties' file, use " + _loggerClass);
                            ojbLogPropFile.close();
                        }
                    }
                    catch (Exception ex)
                    {}
                    if (_loggerClass == null)
                    {
                        // no, so default to poor man's logging
                        bootLogger.info("** Can't find logging configuration file, use default logger **");
                        _loggerClass = PoorMansLoggerImpl.class;
                    }
                }
            }
        }
    }
1263903
private void init(ResourceLoader resourceLoader) throws IOException {
    if (config == null && configs == null) {
      if (typeArgument == null && configArgument == null) {
        throw new IOException("no configuration");
      } else {
        if (typeArgument != null) {
          config = new MtasConfiguration();
          config.attributes.put(MtasConfiguration.CHARFILTER_CONFIGURATION_TYPE,
              typeArgument);
          config.attributes.put(
              MtasConfiguration.CHARFILTER_CONFIGURATION_PREFIX,
              prefixArgument);
          config.attributes.put(
              MtasConfiguration.CHARFILTER_CONFIGURATION_POSTFIX,
              postfixArgument);
        }
        if (configArgument != null) {
          if (resourceLoader != null) {
            try {
              configs = MtasConfiguration.readMtasCharFilterConfigurations(
                  resourceLoader, configArgument);
            } catch (IOException e) {
              throw new IOException(
                  "problem loading configurations from " + configArgument, e);
            }
          }
        }
      }
    }
  }