(Re)Loads the config file using {@link DOMConfigurator} for {@code .xml} files and {@link PropertyConfigurator} for {@code .proeprties} files.

@param configFile log4j configuration file, {@code .properties} or {@code .xml}
437467
public static void reload(String configFile) {
    	LogLog.debug("Will reload log4j based on config-file " + configFile);
        if (configFile != null) {
            if (configFile.endsWith(XML_FILE_EXENSION)) {
            	LogLog.debug("...using DOMConfigurator.configure()");
            	DOMConfigurator.configure(configFile);

            } else if (configFile.endsWith(".properties")) {
            	LogLog.debug("...using PropertyConfigurator.configure()");
                PropertyConfigurator.configure(configFile);

            }
            if (logger.isInfoEnabled()) {
                logger.info("Reloads log4j configuration: " + configFile);
            }
        }
    }
64415
@Override
  public final Parameters load(final File configFile) throws IOException {
    final Loading loading = new Loading();
    loading.topLoad(configFile);
    return Parameters.fromMap(loading.ret);
  }
1024842
public static void loadPropertiesFile(final String filenameOrUrl)
    {
        final Properties properties = new Properties(System.getProperties());
        System.getProperties().forEach(properties::put);

        final URL resource = ClassLoader.getSystemClassLoader().getResource(filenameOrUrl);
        if (null != resource)
        {
            try (InputStream in = resource.openStream())
            {
                properties.load(in);
            }
            catch (final Exception ignore)
            {
            }
        }

        final File file = new File(filenameOrUrl);
        if (file.exists())
        {
            try (FileInputStream in = new FileInputStream(file))
            {
                properties.load(in);
            }
            catch (final Exception ignore)
            {
            }
        }

        try (InputStream in = new URL(filenameOrUrl).openStream())
        {
            properties.load(in);
        }
        catch (final Exception ignore)
        {
        }

        System.setProperties(properties);
    }
801351
private function configure($configFile) {
    if (!file_exists($configFile)) {
      throw new ConfigurationException('Configuration file '.$configFile.' not found');
    }
    $config = parse_ini_file($configFile, true);

    // default settings
    if (isset($config[self::ROOT_SECTION_NAME])) {
      $rootConfig = $config[self::ROOT_SECTION_NAME];
      self::$defaultLevel = isset($rootConfig['level']) ?
              constant('Monolog\Logger::'.strtoupper($rootConfig['level'])) :
              self::$defaultLevel;
      self::$logTarget = isset($rootConfig['target']) ?
              $rootConfig['target'] : WCMF_BASE.self::$logTarget;
    }

    // log levels
    self::$levels = isset($config[self::LOGGER_SECTION_NAME]) ?
            $config[self::LOGGER_SECTION_NAME] : [];
    foreach (self::$levels as $key => $val) {
      self::$levels[$key] = constant('Monolog\Logger::'.strtoupper($val));
    }
  }
723137
private void checkForConfigPath(File configFile) {
        String desktopLayoutFilePath = configFile.getAbsolutePath();
        String configDirPath = desktopLayoutFilePath.substring(0, desktopLayoutFilePath.lastIndexOf(System
                .getProperty("file.separator")));
        File configDir = new File(configDirPath);

        // create config dir if it does not exist
        if (!configDir.exists()) {
            boolean success = configDir.mkdirs();
            if(success)
                logger.debug("Newly created config directory");
            else
                logger.warn("Could not create config directory");
        }
    }
114991
private void readConfigFile() {

        m_isValid = false;
        if ((null != m_configFile) && m_configFile.exists()) {
            if (m_configFile.canRead()) {
                Properties props = new Properties();
                try (FileInputStream input = new FileInputStream(m_configFile)) {
                    props.load(input);
                    for (Entry<Object, Object> entry : props.entrySet()) {
                        String key = (String)entry.getKey();
                        String propValue = (String)entry.getValue();
                        if (key.equals(DEFAULT_MODULES_TO_EXPORT)) {
                            String value = getValueFromProp(propValue).trim();
                            if (value.contains(",")) {
                                m_configuredModules = Arrays.asList(value.split(" *, *"));
                            } else {
                                m_configuredModules = Arrays.asList(value.split(" +"));
                            }
                        }

                        if (key.equals(DEFAULT_MODULE_PATH)) {
                            m_modulesPath = getValueFromProp(propValue).trim();
                        }

                        if (key.equals(DEFAULT_MODULE_RESOURCES_SUBFOLDER)) {
                            m_resourcesSubfolder = getValueFromProp(propValue).trim();
                        }

                        if (key.equals(DEFAULT_PULL_MODE_BEFORE)) {
                            String value = getValueFromProp(propValue);
                            value = value.trim();
                            if (value.equals("1")) {
                                m_defaultPullModeBefore = true;
                            }
                        }
                        if (key.equals(DEFAULT_PULL_MODE_AFTER)) {
                            String value = getValueFromProp(propValue);
                            value = value.trim();
                            if (value.equals("1")) {
                                m_defaultPullModeAfter = true;
                            }
                        }
                        if (key.equals(DEFAULT_PUSH_MODE)) {
                            String value = getValueFromProp(propValue);
                            value = value.trim();
                            if (value.equals("1")) {
                                m_defaultPushMode = true;
                            }
                        }
                        if (key.equals(DEFAULT_MODULE_EXPORT_PATH)) {
                            String value = getValueFromProp(propValue);
                            m_defaultModuleExportPath = value.trim();
                        }
                        if (key.equals(DEFAULT_REPOSITORY_PATH)) {
                            String value = getValueFromProp(propValue);
                            m_repositoryPath = value.trim();
                        }
                        if (key.equals(DEFAULT_EXPORT_MODE)) {
                            String value = getValueFromProp(propValue);
                            m_defaultExportMode = (value.trim().equals("1")) ? 1 : 0;
                        }
                        if (key.equals(DEFAULT_COMMIT_MESSAGE)) {
                            String value = getValueFromProp(propValue);
                            m_defaultCommitMessage = value;
                        }
                        if (key.equals(DEFAULT_GIT_USER_NAME)) {
                            String value = getValueFromProp(propValue);
                            m_defaultGitUserName = value;
                        }
                        if (key.equals(DEFAULT_GIT_USER_EMAIL)) {
                            String value = getValueFromProp(propValue);
                            m_defaultGitUserEmail = value;
                        }
                        if (key.equals(DEFAULT_EXCLUDE_LIBS)) {
                            String value = getValueFromProp(propValue);
                            m_defaultExcludeLibs = (value.trim().equals("1")) ? true : false;
                        }
                        if (key.equals(DEFAULT_COMMIT_MODE)) {
                            String value = getValueFromProp(propValue);
                            m_defaultCommitMode = (value.trim().equals("1")) ? true : false;
                        }
                        if (key.equals(DEFAULT_IGNORE_UNCLEAN)) {
                            String value = getValueFromProp(propValue);
                            m_defaultIgnoreUnclean = (value.trim().equals("1")) ? true : false;
                        }
                        if (key.equals(DEFAULT_COPY_AND_UNZIP)) {
                            String value = getValueFromProp(propValue);
                            m_defaultCopyAndUnzip = (value.trim().equals("1")) ? true : false;
                        }
                    }
                    m_isValid = true;
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
701544
static ConfigurationStream resolveConfigFileAsStream(String configFilePath) throws ConfigurationException {
        InputStream fileStream;
        String fileExtention;
        
        if (configFilePath != null) {
            if (new File(configFilePath).isDirectory()) {
                String path = scanConfigFile(configFilePath);
                fileStream = getFileAsStream(new File(path));
                fileExtention = FilenameUtils.getExtension(path);
            } else {
                fileStream = getFileAsStream(configFilePath);
                fileExtention = FilenameUtils.getExtension(configFilePath);
            }
        } else if (hasEnvironmentVariable(ENVIRONMENT_CONFIG_VARIABLE_NAME)) {
            fileStream = getFileAsStream(getEnvironemtVariableConfigFilePath());
            fileExtention = FilenameUtils.getExtension(getEnvironemtVariableConfigFilePath().toFile().getName());
        } else if (hasSystemPropertyVariable(SYSTEM_PROPERTY_CONFIG_VARIABLE_NAME)) {
            fileStream = getFileAsStream(getSystemPropertyConfigFilePath());
            fileExtention = FilenameUtils.getExtension(getSystemPropertyConfigFilePath().toFile().getName());
        } else if (getClasspathResourceAsStream(CONFIG_FILE_NAME + "." + YML_EXTENTION) != null) {
            fileStream = getClasspathResourceAsStream(CONFIG_FILE_NAME + "." + YML_EXTENTION);
            fileExtention = YML_EXTENTION;
        } else if (getClasspathResourceAsStream(CONFIG_FILE_NAME + "." + YAML_EXTENTION) != null) {
            fileStream = getClasspathResourceAsStream(CONFIG_FILE_NAME + "." + YAML_EXTENTION);
            fileExtention = YAML_EXTENTION;
        } else if (getClasspathResourceAsStream(CONFIG_FILE_NAME + "." + XML_EXTENTION) != null) {
            fileStream = getClasspathResourceAsStream(CONFIG_FILE_NAME + "." + XML_EXTENTION);
            fileExtention = XML_EXTENTION;
        } else {

            String defaultConfigDir = System.getProperty("user.dir");
            String defaultConfigPath = scanConfigFile(defaultConfigDir);
            fileExtention = FilenameUtils.getExtension(defaultConfigPath);
            fileStream = getFileAsStream(new File(defaultConfigPath));
        }
        ConfigurationStream config = new ConfigurationStream();
        config.setExtention(fileExtention);
        config.setInputStream(fileStream);
        return config;
    }
616131
public static CentralDogma forConfig(File configFile) throws IOException {
        requireNonNull(configFile, "configFile");
        return new CentralDogma(Jackson.readValue(configFile, CentralDogmaConfig.class));
    }
785892
public static function config($configFile = null)
    {
        if (!$configFile && self::$config) {
            return self::$config;
        }

        if (self::$config && self::$lock) {
            return self::$config;
        }

        if ($configFile === null) {
            $configFile = getcwd() . DIRECTORY_SEPARATOR . 'codeception.yml';
        }

        if (is_dir($configFile)) {
            $configFile = $configFile . DIRECTORY_SEPARATOR . 'codeception.yml';
        }

        $dir = realpath(dirname($configFile));
        self::$dir = $dir;

        $configDistFile = $dir . DIRECTORY_SEPARATOR . 'codeception.dist.yml';

        if (!(file_exists($configDistFile) || file_exists($configFile))) {
            throw new ConfigurationException("Configuration file could not be found.\nRun `bootstrap` to initialize Codeception.", 404);
        }

        // Preload config to retrieve params such that they are applied to codeception config file below
        $tempConfig = self::$defaultConfig;

        $distConfigContents = "";
        if (file_exists($configDistFile)) {
            $distConfigContents = file_get_contents($configDistFile);
            $tempConfig = self::mergeConfigs($tempConfig, self::getConfFromContents($distConfigContents, $configDistFile));
        }

        $configContents = "";
        if (file_exists($configFile)) {
            $configContents = file_get_contents($configFile);
            $tempConfig = self::mergeConfigs($tempConfig, self::getConfFromContents($configContents, $configFile));
        }
        self::prepareParams($tempConfig);

        // load config using params
        $config = self::mergeConfigs(self::$defaultConfig, self::getConfFromContents($distConfigContents, $configDistFile));
        $config = self::mergeConfigs($config, self::getConfFromContents($configContents, $configFile));

        if ($config == self::$defaultConfig) {
            throw new ConfigurationException("Configuration file is invalid");
        }

        // we check for the "extends" key in the yml file
        if (isset($config['extends'])) {
            // and now we search for the file
            $presetFilePath = codecept_absolute_path($config['extends']);
            if (file_exists($presetFilePath)) {
                // and merge it with our configuration file
                $config = self::mergeConfigs(self::getConfFromFile($presetFilePath), $config);
            }
        }

        self::$config = $config;

        // compatibility with suites created by Codeception < 2.3.0
        if (!isset($config['paths']['output']) and isset($config['paths']['log'])) {
            $config['paths']['output'] = $config['paths']['log'];
        }

        if (isset(self::$config['actor'])) {
            self::$config['actor_suffix'] = self::$config['actor']; // old compatibility
        }

        if (!isset($config['paths']['support']) and isset($config['paths']['helpers'])) {
            $config['paths']['support'] = $config['paths']['helpers'];
        }

        if (!isset($config['paths']['output'])) {
            throw new ConfigurationException('Output path is not defined by key "paths: output"');
        }

        self::$outputDir = $config['paths']['output'];

        // fill up includes with wildcard expansions
        $config['include'] = self::expandWildcardedIncludes($config['include']);

        // config without tests, for inclusion of other configs
        if (count($config['include'])) {
            self::$config = $config;
            if (!isset($config['paths']['tests'])) {
                 return $config;
            }
        }

        if (!isset($config['paths']['tests'])) {
            throw new ConfigurationException(
                'Tests directory is not defined in Codeception config by key "paths: tests:"'
            );
        }

        if (!isset($config['paths']['data'])) {
            throw new ConfigurationException('Data path is not defined Codeception config by key "paths: data"');
        }

        if (!isset($config['paths']['support'])) {
            throw new ConfigurationException('Helpers path is not defined by key "paths: support"');
        }

        self::$dataDir = $config['paths']['data'];
        self::$supportDir = $config['paths']['support'];
        self::$testsDir = $config['paths']['tests'];

        if (isset($config['paths']['envs'])) {
            self::$envsDir = $config['paths']['envs'];
        }

        Autoload::addNamespace(self::$config['namespace'], self::supportDir());
        self::loadBootstrap($config['settings']['bootstrap']);
        self::loadSuites();

        return $config;
    }
108994
public void configure(Properties props) {
        this.refreshCount.set(0);
        this.overrideProps.clear();
        
        this.originalAsyncAppenderNameMap.clear();
       // First try to load the log4j configuration file from the classpath
        String log4jConfigurationFile = System.getProperty(PROP_LOG4J_CONFIGURATION);
        
        NFHierarchy nfHierarchy = null;
        
        // Make log4j use blitz4j implementations
        if ((!NFHierarchy.class.equals(LogManager.getLoggerRepository().getClass()))) {
            nfHierarchy = new NFHierarchy(new NFRootLogger(org.apache.log4j.Level.INFO));
            org.apache.log4j.LogManager.setRepositorySelector(new NFRepositorySelector(nfHierarchy), guard);
        }
        
        String log4jLoggerFactory = System.getProperty(PROP_LOG4J_LOGGER_FACTORY);
        if (log4jLoggerFactory != null) {
            this.initialProps.setProperty(PROP_LOG4J_LOGGER_FACTORY, log4jLoggerFactory);
            if (nfHierarchy != null) {
                try {
                    LoggerFactory loggerFactory = (LoggerFactory) Class.forName(log4jLoggerFactory).newInstance();
                    nfHierarchy.setLoggerFactory(loggerFactory);
                } catch (Exception e) {
                    System.err.println("Cannot set the logger factory. Hence reverting to default.");
                    e.printStackTrace();
                }
            }
        } else {
            this.initialProps.setProperty(PROP_LOG4J_LOGGER_FACTORY, BLITZ_LOGGER_FACTORY);

        }
        if (log4jConfigurationFile != null) {
            loadLog4jConfigurationFile(log4jConfigurationFile);
            // First configure without async so that we can capture the output
            // of dependent libraries
            clearAsyncAppenderList();
            PropertyConfigurator.configure(this.initialProps);
        }

        this.blitz4jConfig = new DefaultBlitz4jConfig(props);

        if ((log4jConfigurationFile == null) && (blitz4jConfig.shouldLoadLog4jPropertiesFromClassPath())) {
            try {
                URL url = Loader.getResource(LOG4J_PROPERTIES);
                if (url != null) {
                    try (InputStream in = url.openStream()) {
                        this.initialProps.load(in);
                    }
                }
            } catch (Exception t) {
                System.err.println("Error loading properties from " + LOG4J_PROPERTIES);
            } 
        }   
        
        Enumeration enumeration = props.propertyNames();
        while (enumeration.hasMoreElements()) {
            String key = (String) enumeration.nextElement();
            String propertyValue = props.getProperty(key);
            this.initialProps.setProperty(key, propertyValue);
        }
        
        this.blitz4jConfig = new DefaultBlitz4jConfig(this.initialProps);
    
        String[] asyncAppenderArray = blitz4jConfig.getAsyncAppenders();
        if (asyncAppenderArray == null) {
            return;
        }
        for (int i = 0; i < asyncAppenderArray.length; i++) {
            String oneAppenderName = asyncAppenderArray[i];
            if ((i == 0) || (oneAppenderName == null)) {
                continue;
            }
            oneAppenderName = oneAppenderName.trim();
            String oneAsyncAppenderName = oneAppenderName + ASYNC_APPENDERNAME_SUFFIX;
            originalAsyncAppenderNameMap.put(oneAppenderName, oneAsyncAppenderName);
        }
        try {
            convertConfiguredAppendersToAsync(this.initialProps);
        } catch (Exception e) {
            throw new RuntimeException("Could not configure async appenders ",
                    e);
        }
        // Yes second time init required as properties would have been during async appender conversion
        this.blitz4jConfig = new DefaultBlitz4jConfig(this.initialProps);
        clearAsyncAppenderList();
        PropertyConfigurator.configure(this.initialProps);
        closeNonexistingAsyncAppenders();
        this.logger = org.slf4j.LoggerFactory.getLogger(LoggingConfiguration.class);
        ConfigurationManager.getConfigInstance().addConfigurationListener(
                new ExpandedConfigurationListenerAdapter(this));
    }
776092
public CmsUgcConfiguration readConfiguration(CmsFile configFile) throws CmsException {

        m_content = CmsXmlContentFactory.unmarshal(m_cms, configFile);
        String resourceType = getStringValue(N_CONTENT_TYPE);
        String contentPath = getStringValue(N_CONTENT_PATH);
        CmsResource contentPathResource = m_cms.readResource(contentPath);
        String namePattern = getStringValue(N_NAME_PATTERN);
        String localeStr = getStringValue(N_LOCALE);
        OpenCms.getLocaleManager();
        Locale locale = CmsLocaleManager.getLocale(localeStr);
        Optional<CmsResource> uploadPathResource = Optional.absent();
        String uploadPath = getStringValue(N_UPLOAD_PATH);
        if (uploadPath != null) {
            uploadPathResource = Optional.of(m_cms.readResource(uploadPath));
        }
        Optional<Long> maxUploadSize = getLongValue(N_MAX_UPLOAD_SIZE);
        Optional<Integer> maxNumContents = getIntValue(N_MAX_NUM_CONTENTS);
        Optional<Long> queueWaitTime = getLongValue(N_QUEUE_WAIT_TIME);
        Optional<Integer> maxQueueLength = getIntValue(N_QUEUE_MAX_LENGTH);
        boolean autoPublish = Boolean.parseBoolean(getStringValue(N_AUTO_PUBLISH));
        String validExtensionsStr = getStringValue(N_VALID_EXTENSIONS);
        Optional<List<String>> validExtensions = Optional.absent();
        if (validExtensionsStr != null) {
            validExtensionsStr = validExtensionsStr.trim();
            List<String> extensions = CmsStringUtil.splitAsList(validExtensionsStr, EXTENSIONS_SEPARATOR);
            validExtensions = Optional.of(extensions);
        }

        String userForGuestStr = getStringValue(N_USER_FOR_GUEST);
        Optional<CmsUser> userForGuest = Optional.absent();
        if (userForGuestStr != null) {
            userForGuest = Optional.of(m_cms.readUser(userForGuestStr.trim()));
        }

        String projectGroupStr = getStringValue(N_PROJECT_GROUP);
        CmsGroup projectGroup = m_cms.readGroup(projectGroupStr.trim());
        CmsUUID id = configFile.getStructureId();
        CmsUgcConfiguration result = new CmsUgcConfiguration(
            id,
            userForGuest,
            projectGroup,
            resourceType,
            contentPathResource,
            namePattern,
            locale,
            uploadPathResource,
            maxUploadSize,
            maxNumContents,
            queueWaitTime,
            maxQueueLength,
            autoPublish,
            validExtensions);
        result.setPath(configFile.getRootPath());
        return result;
    }
1284787
private Properties loadConfigurationProperties() {
        String configurationFileName = getConfigurationFileName();
        if (Strings.isNullOrEmpty(configurationFileName)) {
            log.info("JSLint property file not specified. Using default configuration.");
            return null;
        }
        return loadProperties(configurationFileName);
    }
660462
private static HashMap<String, HashMap<String, String>> readConfigurations(
      ResourceLoader resourceLoader, String configFile, String className)
      throws IOException {
    HashMap<String, HashMap<String, String>> configs = null;
    InputStream reader = resourceLoader.openResource(configFile);
    // parse xml
    XMLInputFactory factory = XMLInputFactory.newInstance();
    try {
      XMLStreamReader streamReader = factory.createXMLStreamReader(reader);
      String currentElement = null;
      ArrayList<String> currentElements = new ArrayList<String>();
      QName qname;
      boolean skipCurrentConfigurations = false;
      try {
        int event = streamReader.getEventType();
        while (true) {
          switch (event) {
          case XMLStreamConstants.START_DOCUMENT:
            if (!streamReader.getCharacterEncodingScheme().equals("UTF-8")) {
              throw new IOException("XML not UTF-8 encoded");
            }
            break;
          case XMLStreamConstants.END_DOCUMENT:
            break;
          case XMLStreamConstants.SPACE:
            break;
          case XMLStreamConstants.START_ELEMENT:
            // get data
            qname = streamReader.getName();
            if (configs == null) {
              if (qname.getLocalPart().equals(CONFIGURATIONS_MTAS)) {
                configs = new HashMap<String, HashMap<String, String>>();
              } else {
                throw new IOException("no Mtas Configurations File");
              }
            } else if (currentElement != null
                && currentElement.equals(CONFIGURATIONS_MTAS)) {
              if (qname.getLocalPart().equals(CONFIGURATIONS_CONFIGURATIONS)) {
                skipCurrentConfigurations = true;
                if (className != null) {
                  for (int i = 0; i < streamReader.getAttributeCount(); i++) {
                    if (streamReader.getAttributeLocalName(i).equals("type")) {
                      if (streamReader.getAttributeValue(i).equals(className)) {
                        skipCurrentConfigurations = false;
                      }
                    }
                  }
                }
              } else {
                throw new IOException("unexpected " + qname.getLocalPart());
              }
            } else if (currentElement != null
                && currentElement.equals(CONFIGURATIONS_CONFIGURATIONS)
                && !skipCurrentConfigurations) {
              if (qname.getLocalPart().equals(CONFIGURATIONS_CONFIGURATION)) {
                String configurationName = null;
                HashMap<String, String> configurationValues = new HashMap<String, String>();
                for (int i = 0; i < streamReader.getAttributeCount(); i++) {
                  if (streamReader.getAttributeLocalName(i)
                      .equals(CONFIGURATIONS_CONFIGURATION_NAME)) {
                    configurationName = streamReader.getAttributeValue(i);
                  } else {
                    configurationValues.put(
                        streamReader.getAttributeLocalName(i),
                        streamReader.getAttributeValue(i));
                  }
                }
                if (configurationName != null) {
                  configs.put(configurationName, configurationValues);
                } else {
                  throw new IOException("configuration without "
                      + CONFIGURATIONS_CONFIGURATION_NAME);
                }
              } else {
                throw new IOException("unexpected tag " + qname.getLocalPart());
              }
            }
            currentElement = qname.getLocalPart();
            currentElements.add(currentElement);
            break;
          case XMLStreamConstants.END_ELEMENT:
            if (currentElement != null
                && currentElement.equals(CONFIGURATIONS_CONFIGURATIONS)) {
              skipCurrentConfigurations = false;
            }
            int i = currentElements.size();
            currentElements.remove((i - 1));
            if (i > 1) {
              currentElement = currentElements.get(i - 2);
            } else {
              currentElement = null;
            }
            break;
          case XMLStreamConstants.CHARACTERS:
            break;
          }
          if (!streamReader.hasNext()) {
            break;
          }
          event = streamReader.next();
        }
      } finally {
        streamReader.close();
      }
    } catch (XMLStreamException e) {
      log.debug(e);
    }
    return configs;
  }
518541
public static final void xmlConfig(File configFile) throws IOException
    {
        try
        {
            JAXBContext jaxbCtx = JAXBContext.newInstance("org.vesalainen.util.jaxb");
            Unmarshaller unmarshaller = jaxbCtx.createUnmarshaller();
            JavaLoggingConfig javaLoggingConfig = (JavaLoggingConfig) unmarshaller.unmarshal(configFile);
            Map<String,String> expressionMap = new HashMap<>();
            Properties properties = javaLoggingConfig.getProperties();
            if (properties != null)
            {
                for (Element element : properties.getAny())
                {
                    String property = element.getTagName();
                    String expression = element.getTextContent();
                    expressionMap.put(property, expression);
                }
            }
            ExpressionParser ep = new ExpressionParser(expressionMap);
            for (LoggerType loggerType : javaLoggingConfig.getLogger())
            {
                String name = ep.replace(loggerType.getName());
                JavaLogging javaLogging = getLogger(name);
                Logger logger = javaLogging.getLogger();
                String lev = ep.replace(loggerType.getLevel());
                Level level = lev != null ? BaseLogging.parseLevel(lev) : null;
                if (level != null)
                {
                    logger.setLevel(level);
                }
                logger.setUseParentHandlers(parseBoolean(ep.replace(loggerType.getUseParentHandlers())));
                String resourceBundleString = ep.replace(loggerType.getResourceBundle());
                if (resourceBundleString != null)
                {
                    Locale locale;
                    String languageTag = ep.replace(loggerType.getLocale());
                    if (languageTag != null)
                    {
                        locale = Locale.forLanguageTag(languageTag);
                    }
                    else
                    {
                        locale = Locale.getDefault();
                    }
                    ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceBundleString, locale);
                    logger.setResourceBundle(resourceBundle);
                }
                logger.setFilter(getInstance(ep.replace(loggerType.getFilter())));
                for (ConsoleHandlerType consoleHandlerType : loggerType.getConsoleHandler())
                {
                    logger.addHandler(createConsoleHandler(ep, consoleHandlerType, level));
                }
                for (FileHandlerType fileHandlerType : loggerType.getFileHandler())
                {
                    logger.addHandler(createFileHandler(ep, fileHandlerType, level));
                }
                for (MemoryHandlerType memoryHandlerType : loggerType.getMemoryHandler())
                {
                    logger.addHandler(createMemoryHandler(ep, memoryHandlerType, level));
                }
                for (SocketHandlerType socketHandlerType : loggerType.getSocketHandler())
                {
                    logger.addHandler(createSocketHandler(ep, socketHandlerType, level));
                }
            }
        }
        catch (JAXBException ex)
        {
            throw new RuntimeException(ex);
        }
    }
187815
public static void configureLog4j() {
        LoggingTool localLogger = new LoggingTool(LoggingTool.class);
        try { // NOPMD
            org.apache.log4j.PropertyConfigurator.configure(LoggingTool.class
                    .getResource("/org/openscience/cdk/config/data/log4j.properties"));
        } catch (NullPointerException e) { // NOPMD
            localLogger.error("Properties file not found: ", e.getMessage());
            localLogger.debug(e);
        } catch (Exception e) {
            localLogger.error("Unknown error occurred: ", e.getMessage());
            localLogger.debug(e);
        }
    }
678772
static void createConfigFile(String xmlName, Resource configFile) throws IOException {
	configFile.createFile(true);
	createFileFromResource("/resource/config/" + xmlName + ".xml", configFile.getAbsoluteResource());
    }
844331
public SSLConfig[] loadPropertiesFile(final String propertiesURL, final boolean multiConfigURL) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "loadPropertiesFile", new Object[] { propertiesURL, Boolean.valueOf(multiConfigURL) });
        // sslConfigs is used when multiConfigURL=true;
        SSLConfig[] sslConfigs = null;

        if (propertiesURL == null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(tc, "loadPropertiesFile (null props file)");
            return null;
        }
        try {
            sslConfigs = AccessController.doPrivileged(
                                                       new PrivilegedExceptionAction<SSLConfig[]>() {
                                                           @Override
                                                           public SSLConfig[] run() throws Exception {

                                                               InputStream istream = null;
                                                               BufferedReader in = null;

                                                               try {
                                                                   URL url = new URL(propertiesURL);
                                                                   istream = url.openStream();

                                                                   if (!multiConfigURL) {
                                                                       load(istream);
                                                                   } else {
                                                                       String s = null;
                                                                       in = new BufferedReader(new InputStreamReader(istream));
                                                                       List<SSLConfig> sslConfigList = new ArrayList<SSLConfig>();
                                                                       SSLConfig currentSSLConfig = new SSLConfig();
                                                                       currentSSLConfig.clear(); // clear the default properties

                                                                       while ((s = in.readLine()) != null) {
                                                                           if (!(s.trim().startsWith("#") || s.trim().length() <= 0)) {
                                                                               if (s.trim().startsWith("com.ibm.ssl.alias")) {
                                                                                   if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                                                                       Tr.debug(tc, "Saving SSL configuration...");
                                                                                   sslConfigList.add(currentSSLConfig);

                                                                                   // now start a new one.
                                                                                   currentSSLConfig = new SSLConfig();

                                                                                   int index = s.indexOf('=');
                                                                                   String name = s.substring(0, index);
                                                                                   String value = s.substring(index + 1);
                                                                                   if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                                                                       Tr.debug(tc, "Parsing SSL configuration with alias: " + value);
                                                                                   currentSSLConfig.setProperty(name, value, true);
                                                                               } else if (s.trim().indexOf('=') != -1) {
                                                                                   int index = s.indexOf('=');
                                                                                   String name = s.substring(0, index);
                                                                                   String value = null;
                                                                                   if (name != null)
                                                                                       value = System.getProperty(name);
                                                                                   if (value == null)
                                                                                       value = s.substring(index + 1);
                                                                                   if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                                                                       Tr.debug(tc, "Parsing SSL property: " + name + " = " + value);
                                                                                   currentSSLConfig.setProperty(name, value, true);
                                                                               }
                                                                           }
                                                                       }

                                                                       if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                                                           Tr.debug(tc, "Saving SSL configuration...");
                                                                       sslConfigList.add(currentSSLConfig);
                                                                       return sslConfigList.toArray(new SSLConfig[sslConfigList.size()]);
                                                                   }
                                                               } finally {
                                                                   if (null != in) {
                                                                       in.close();
                                                                   }
                                                                   if (istream != null)
                                                                       istream.close();
                                                               }
                                                               return null;
                                                           }
                                                       });

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(tc, "loadPropertiesFile");
            return sslConfigs;
        } catch (PrivilegedActionException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "loadPropertiesFile exception; " + e.getException());
            FFDCFilter.processException(e.getException(), getClass().getName(), "loadPropertiesFile", this);
            // TODO shouldn't this be throwing the error?
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "loadPropertiesFile");
        return null;
    }