package org.kurento.commons;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ConfigFileManager {

	private static final Logger log = LoggerFactory
			.getLogger(ConfigFileManager.class);

	private static final String CONFIG_FILE_PATH_PROPERTY = "configFilePath";

	public static void loadConfigFile() {
		loadConfigFile("kurento.conf.json");
	}

	public static void loadConfigFile(String configFileName) {

		try {

			String configFilePath = System
					.getProperty(CONFIG_FILE_PATH_PROPERTY);

			Path configFile = null;

			if (configFilePath != null) {
				configFile = Paths.get(configFilePath);

				if (!Files.exists(configFile)) {
                    configFile = ConfigFileFinder
                            .getPathInClasspath("/wowza-controller.conf.json");
                }

			} else {
				configFile = ConfigFileFinder
						.searchConfigFileInDefaultPlaces(configFileName);
			}

			if (configFile != null && Files.exists(configFile)) {
				ConfigFilePropertyHolder
						.configurePropertiesFromConfigFile(configFile);
			} else {
				log.warn("Config file not found. Using all default values");
			}

		} catch (IOException e) {
			log.warn("Exception loading config file", e);
		}
	}

}

@@ -773,156 +773,461 @@
 ) %7B%0A
-                    configFile = ConfigFileFinder%0A                            .getPathInClasspath(%22/wowza-controller.conf.json%22);%0A                %7D%0A
+%09%09%09%09%09log.warn(%0A%09%09%09%09%09%09%09%22Property '%7B%7D' points to an invalid location '%7B%7D'. Searching default config file '%7B%7D' in classpath and workdir%22,%0A%09%09%09%09%09%09%09CONFIG_FILE_PATH_PROPERTY, configFilePath,%0A%09%09%09%09%09%09%09configFileName);%0A%09%09%09%09%09configFile = ConfigFileFinder%0A%09%09%09%09%09%09%09.searchConfigFileInDefaultPlaces(configFileName);%0A%09%09%09%09%7D else %7B%0A%09%09%09%09%09log.info(%22Property %7B%7D points to a valid location. Will use the config from %7B%7D%22, CONFIG_FILE_PATH_PROPERTY, configFilePath);%0A%09%09%09%09%7D%0A%09%09%09%09
 %0A%09%09%09
@@ -1421,18 +1421,16 @@
 der%0A%09%09%09%09
-%09%09
 .configu
@@ -1506,16 +1506,19 @@
 fig file
+ %7B%7D
  not fou
@@ -1546,16 +1546,32 @@
  values%22
+, configFileName
 );%0A%09%09%09%7D%0A

Add logs in config file management